[linux-lvm] Problems resizing physical volume

Avi Kivity avi at redhat.com
Wed Apr 14 09:42:11 UTC 2010


(resending, first try didn't seem to make it to the archives)

Due to dracut creating huge initrds, I now need a larger /boot.  So I'd 
like to reduce my lvm physical volume on the same disk in order to make 
room.

However, lvm doesn't want me to:

> lvm> pvs
>   PV         VG   Fmt  Attr PSize   PFree
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G

Seems I have enough room.

> lvm> pvresize --setphysicalvolumesize 148.54G /dev/sda2
>   /dev/sda2: cannot resize to 4753 extents as later ones are allocated.
>   0 physical volume(s) resized / 1 physical volume(s) not resized

So it seems lvm wants me to move the data around instead of doing it by 
itself.  What did I do (besides not reading the manual)?

Let's find a new home for the data:

> [root at violet-regb ~]# pvs --segments
>   PV         VG   Fmt  Attr PSize   PFree  Start SSize
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G     0   480
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G   480   192
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G   672   320
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G   992   320
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G  1312   320
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G  1632  2560
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G  4192   128
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G  4320    64
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G  4384   320
>   /dev/sda2  vg0  lvm2 a-   148.94G 10.00G  4704    62

Looks like all extents are already allocated (that's the 'a', right?). 
But it claims that 10G are free!  And sure, if I create a new volume, 
space is found at extent 4384:

> [root at violet-regb ~]# lvcreate -L 1G -n new vg0
>   Logical volume "new" created
> [root at violet-regb ~]# pvs --segments
>   PV         VG   Fmt  Attr PSize   PFree Start SSize
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G     0   480
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G   480   192
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G   672   320
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G   992   320
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G  1312   320
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G  1632  2560
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G  4192   128
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G  4320    64
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G  4384    32
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G  4416   288
>   /dev/sda2  vg0  lvm2 a-   148.94G 9.00G  4704    62

32 extents, 32MB each = 1GB.  Let's move the 62 extents at the end manually:

> [root at violet-regb ~]# lvremove vg0/new
> Do you really want to remove active logical volume new? [y/n]: y
>   Logical volume "new" successfully removed
> [root at violet-regb ~]# pvmove /dev/sda2:4704-4765 /dev/sda2:4384-4445
>   No extents available for allocation

At this point I gave up.  Is there any way to accomplish this?

-- 
error compiling committee.c: too many arguments to function




More information about the linux-lvm mailing list