[linux-lvm] Shrinking LVM partition at beginning
zkabelac at redhat.com
Sat Apr 9 17:52:07 UTC 2016
Dne 9.4.2016 v 12:12 Nick Urbanik napsal(a):
> Dear Folks,
> I want to shrink an LVM partition and expand a preceding, non-LVM
> partition. The LVM partition contains three logical volumes. I
> shrank the larger, middle home volume at the volume's end successfully
> with a command something like this:
> sudo lvresize --verbose --resizefs -L -40G /dev/fedora/home
> and then used pvmove to move all the pysical extents towards the end
> of the disk, using some commands something like this:
> sudo pvmove --alloc anywhere /dev/sda6:24387-34626 /dev/sda6:34627-44866
> until all the extents are towards the end of the disk, and there are
> 10240 unused at the beginning of the volume.
> So: can anyone suggest how I can shrink the volume group by that 10240
> physical extents, so that I can shrink the partition, and expand the
> previous partition?
Unsupported - requires very good understanding about lvm2 metadata format
and very good precision in all calculations if you would do it by hand...
Basically you need to recreate PV header at different position,
and recompute all 'PV' extents in use.
IMHO easiest&safest for a normal user is to just 'copy' disk elsewhere,
reformat with new layout and copy data back (yeah - takes some time,
but with significantly less probability of data loose...)
lvm2 is not meant to be used with other volume manager (like partitions)
so do not expect it will support such sort of operations...
More information about the linux-lvm