Thursday, October 8, 2015

Centos disk space allocation

You need to unmount a filesystem to shrink it. So, for /home you'll want to be log in as root and umount /home. If it's 'busy'. You may need to stop any processes using files here.

Then, shrink the file system to just below your targeted logical volume size.

resize2fs /dev/mapper/vg_nastgweblls01-lv_home 99G

Shrink the logical volume to the targeted size.

lvreduce -L 100G /dev/mapper/vg_nastgweblls01-lv_home

Grow the filesystem to the logical volume's capacity.

resize2fs /dev/mapper/vg_nastgweblls01-lv_home

The reason I do it this so I don't have to do any math and keep the filesystem the size of the container. A bit lazy, but it works great.

Now, you have free space to grow root.

lvextend -L 75G /dev/mapper/vg_nastgweblls01-lv_root
resize2fs /dev/mapper/vg_nastgweblls01-lv_root


* remembered that I need to mount the home drive

mount /home

No comments:

Post a Comment