Home MiscellaneousReducing an LVM Mounted as Root Partition ( / partition)

Reducing an LVM Mounted as Root Partition ( / partition)

by SupportPRO Admin

Since resizing (especially reducing) an LVM partition requires us to unmount the partition, we need to boot server via a rescue CD to proceed with the reduction of the root partition. SystemRescueCd available from http://www.sysresccd.org/Download can be used for this purpose.

In order to boot the system in rescue mode, burn the SystemRescueCd image to a CD and insert it to the drive or mount the iso image via KVM if physical access to the server is not available. Make sure to check for the details of the LVM partition mounted as ‘/’ before proceeding with the further steps in case you have multiple LVM partitions ( this can be found either from /etc/fstab file or using the lvdisplay command :: LV Path parameter from lvdisplay) since we need to the name of the partition mounted under /dev/<volumegroupname>/ inorder to reduce the LVM. Reboot the server and go to BIOS upon the server boot, make sure that the primary boot device is set to CD/DVD drive in the server, save and exit. Follow the on-screen instructions to boot via the rescue CD.

Since the LVM partition won’t be mounted upon boot from via the rescue CD ( which is what we need to proceed with the LVM reduction) run the following command to activate all known volume groups in the system:

#vgchange -a y

After running the command, forcefully check the lvm partition using the command

#e2fsck -f /dev/<volume group name>/<name of lvm partition>

Once the filesystem check is complete we can proceed with file system resizing using the command

#resize2fs /dev/<volume group name>/<name of lvm partition> <~85-90% of final LVM size>

Eg:: In order to reduce the partition to about 300G use the command below to resize the file system to around 270G

#resize2fs /dev/<volume group name>/<name of lvm partition> 270G

Now reduce the size of the partition to 300G partition using the command

#lvreduce -L 300G /dev/<volume group name>/<name of lvm partition>

Once this is complete, the details of the resized lvm partition can be checked via the lvdisplay command.

If you require help, contact SupportPRO Server Admin

Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value

You may also like

Leave a Comment