I want to shrink my LVM physical volume and use this free space to create another partition for another OS.
I resized my root and home logical volumes using
lvresize and now I'm trying to use
pvresize, but I get the following error:
/dev/sda2: cannot resize to xxxxx extents as later ones are allocated.
This PV's free space is allocated between two logical volumes and I think that's the reason that can't shrink the partition.
The output for
pvs -v --segments /dev/sda2 is:
PV VG Fmt Attr PSize PFree Start SSize LV Start Type PE Ranges /dev/sda2 volgroup0 lvm2 a-- 446.64g 148.00g 0 7680 lv_root 0 linear /dev/sda2:0-7679 /dev/sda2 volgroup0 lvm2 a-- 446.64g 148.00g 7680 51712 lv_home 0 linear /dev/sda2:7680-59391 /dev/sda2 volgroup0 lvm2 a-- 446.64g 148.00g 59392 37888 0 free /dev/sda2 volgroup0 lvm2 a-- 446.64g 148.00g 97280 17060 lv_root 7680 linear /dev/sda2:97280-114339
The free space is allocated between the segments 59392 and 97279. I know that
pmove can move the free space to another segment, but I honestly don't know how to use it and I'm afraid of corrupting my data.
Could anyone please help me on this? Thanks!