Centos/RHEL 7 – How to reduce volume size of HOME and add space to ROOT logical volume using Webmin

Recently I ran across a bit of an issue in my installation of CentOS 7, where I needed to increase the size of ROOT partition by reducing the size of HOME logical volume. I’ve resolved the problem by moving free space from HOME to ROOT volume.

So originally the situation looked like this:

2015-11-29_15-44-42

or in Webmin (under Logical Volume Management tab) like this:

2015-11-29_14-24-50

This is what I wanted to achieve:

  • Reduce size of HOME from 180 GB to 5 GB
  • Extend size of ROOT by 175 GB from 50 GB to 225 GB

Without much of thinking, first step I took was to go to Webmin LVM tab, clicked on Logical Volumes, selected HOME a decided to change the volume size to 5GB, like this:

2015-11-29_14-24-26

Upon saving, this resulted in an error saying: “The filesystem on this logical volume cannot be shrunk while it is mounted”.

Realizing above wouldn’t work, I followed by taking these steps:

Created a new temporary HOME 2 directory /home:

Then copied content of HOME to HOME2 directory by running following command:

Then un-mounted HOME:

Then removed HOME logical volume entirely:

Once this was done, I went back to Webmin LVM tab, clicked on Logical Volumes and towards the bottom, I’ve clicked on ‘Create a logical volume in centos’ option, I’ve created a new HOME logical volume and assigned to it 5GB. So it looked like this:

2015-11-29_16-24-22

Next step was to copy content of HOME2 to HOME directory:

 

And deleting home2 directory:

As a last step, all I needed to do was to go back to Webmin LVM tab, click on Logical Volumes, select ROOT logical volume and change the volume size from 50GB to maximum available space. This can be done without any manual calculation by using option: ‘Use all free VG space‘ and pressing the SAVE button.

Once done, resulting volumes are re-sized exactly as I wished:

2015-11-29_15-41-55

2015-11-29_16-34-38

I hope this gives you some idea how to go about the process on your own.

 

 

 

Facebook Comments