[linux-lvm] shrink VG and PV
malahal at us.ibm.com
Mon May 17 20:56:07 UTC 2010
Dael Elcar [kanonmatswe at gmail.com] wrote:
> My system is archlinux i386. lvm version 2.02.62(1) (2010-03-09)
> I'd like to shrink a partition with lvm on it. Can this be done? In order
> to shrink it I need to reduce the size of the PV, right? I have
> successfully removed an LV (from the end on the VG) and there is no
> mention of it with lvdisplay or in the file i get with vgcfgbackup. I
> think the next step is to reduce the size of the VG and remove the now
> unallocated 3884 PEs from it. I can't find a command for that. I have
> tried pvresize. How do I solve the problem with "metadata areas"?
> vgdisplay says VG Status is "resizable".
You will need to resize the PV and that would automatically reduce the
VG size. That is why you don't find a command to resize VG.
> pvresize /dev/sda2 --test --setphysicalvolumesize 49256M
> Test mode: Metadata will NOT be updated.
> /dev/sda2: too many metadata areas for pvresize
> 0 physical volume(s) resized / 1 physical volume(s) not resized
> --- Volume group ---
> VG Name nonxpvg
> System ID
> Format lvm2
> Metadata Areas 2
Looks like you have 2 copies of metadata (one at the front and another
one at the end of the PV). Resize on this PV is not supported. Here is
what I see from 'man pvresize':
"pvresize won't currently work correctly on LVM1 volumes or
PVs with extra metadata areas."
Unfortunately, there is no easy way to reduce the metadata copies,
resize and add another copy as you have now.
More information about the linux-lvm