Shrinking a Physical Volume on Linux

November 1st, 2005

Here is a quick guide on how to shrink/reduce a physical volume on linux:

First backup the configuration so we can edit and restore it.

# vgcfgbackup

Now you need to edit the backup config file. Go to the physical volume you want to resize (in my case pv0) and change the block size to what you want it to be. In my case I changed it from 4708 to 2874. Also take note of the ID.

# vi /etc/lvm/backup/VolGroup00

Next you need to commit the changes to the partition: The UUID is the id from the step above. You’ll also want to use the correct hard drive - which is most likely not /dev/hdd2. Run the “pvdisplay” command to figure out which one it is.

# pvcreate --restorefile ./VolGroup00 --uuid "l4wJi3-JDQb-7sjZ-B3oH-Va0D-v2Sp-FX2s3q" /dev/hdd2 -ff

Last, you need to restore your edited backup file:

# vgcfgrestore

And presto, your volume should be smaller now.

Comments are closed.