I'm using LVM on a single disk and now I need to resize the partition (sda2) I'm using.
I've already resized the Logical Volume but I can't manage to shrink the Volume Group. I know that vgreduce can remove Physical Volumes entirely but I have only one and I need too shrink that one.
Is it possible?
Best Answer
Assuming Linux LVM.
Reducing the size of a PV, and keeping the same PV partition, is a multiple step process. A little bit dangerous, data corruption is possible if the volumes are reduced too small for the file system.
lvreduce --resizefs --size
the LV.--resizefs
does step #2 at the same time, ensuring the sizes match.pvresize --setphysicalvolumesize
the PV.vgreduce
removes entire PVs from the VG, and is not useful in this example.As an alternative, if you move to using entire disks and not partitions, this process can be simpler.
lvreduce --resizefs --size
if necessary to fit in the new diskvgextend /dev/sdb
pvmove /dev/sda1
vgreduce /dev/sda1
End result, VG moved to new disk, old partition empty and can be deleted.