Reducing a root LVM

In this post I want to reduce root volume to free up the space for other volumes. Let’s discuss it step by step:

1. Download Linux system rescue disk such as SYSTEMRESCUECD or KNOPPIX available as a bootable CD-ROM . I prefer systemrescuecd.

Official site for systemrescuecd: http://www.sysresccd.org . Direct download link is this.
Official site for knoppix: http://www.knoppix.net

2.  Boot  SYSTEMRESCUECD on start-up. This step is done because we need volume, that should be shrunk, to be unmounted. As you know root volume cannot be unmounted when the OS is running on it.

3.  Make all LVM volumes found available to the rescue kernel:

root@sysresccd ~ % lvm vgchange -a y

4. List logical volume names:

root@sysresccd ~ % ls /dev/VolGroup00/
LogVol00 LogVol01

5. Before shrinking file system , it is recommended to check file system and fix any errors:

root@sysresccd ~ %  e2fsck -f /dev/VolGroup00/LogVol00

6. After the check is successful, shrink the file system on LVM. I am reducing it to 50G.

root@sysresccd ~ % resize2fs -f /dev/VolGroup00/LogVol00 50G

7.  Re-run e2fsck.

root@sysresccd ~ %  e2fsck -f /dev/VolGroup00/LogVol00

8.  Now reduce the logical volume itself to 50G.

root@sysresccd ~ % lvm lvreduce -L50G /dev/VolGroup00/LogVol00

Note : If you want to reduce size of the volume by some value, you should use minus sign in front of the number value like : –L  -50G.

Reboot the system.

Advertisement

About Mariami Kupatadze
Oracle Certified Master Linkedin: https://www.linkedin.com/in/mariami-kupatadze-01074722/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: