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 as a follow up, I just tried changing the PV to allocatable that fixed the issue. No problems that I can see from making that change. – deltaray Feb 24 '11 at 4:56

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.

# pvchange -x y /dev/volume

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 :

# lvcreate -l 2939 -n test LocalVG
  • 1
    Thanks, but I don't think this would have changed anything. Using a MB or GB value with -L probably just converts to extents in the program before actually expanding since that's what it actually works with, so its the same difference. Anyways, I've been using it after I fixed it above (note my comment) for months now and its been fine. – deltaray Jul 2 '11 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.