I have a virtual machine running on LVM. Its working ok except that now I can't expand or create any logical volumes. It gives me the error:
# lvcreate -L10G -n test LocalVG
Insufficient free space: 320 extents needed, but only 0 available
But I have much more than that available to the volume group:
# vgdisplay LocalVG
--- Volume group ---
VG Name LocalVG
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 13
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 9
Open LV 9
Max PV 0
Cur PV 1
Act PV 1
VG Size 299.84 GB
PE Size 32.00 MB
Total PE 9595
Alloc PE / Size 6656 / 208.00 GB
Free PE / Size 2939 / 91.84 GB
And the cow image on which this vm is residing is 300MB and is on a filesystem on the host that currently has 101GB free. So it shouldn't be failing. I did notice that the physical volume that the VG uses in the VM is set to unallocatable:
# pvdisplay
--- Physical volume ---
PV Name /dev/vda2
VG Name LocalVG
PV Size 299.85 GB / not usable 6.83 MB
Allocatable NO
PE Size (KByte) 32768
Total PE 9595
Free PE 2939
Allocated PE 6656
Maybe this is normal, but my other hosts show their PVs set allocateable = yes. So my questions are, should I be running "pvchange -x y /dev/vda2" on this PV or is there something else wrong? Can the host be online when I do this? Does the PV have to be allocatable in order for an LV to get extents from a VG?
Well this was a while ago, but at the time I tried switching the PV to be allocatable as shown above and that fixed the issue. Its been two years since then and I haven't had any further issues. Must have been an obscure bug. Hopefully this info will help someone in the same boat someday.
You can mark a physical volume as allocatable with
pvchange
.I think it must be allocatable, but try using the lvresize command with the -l (small L) option and after add the number of Free PEs you want to give to it.
Something like this :