With default installation of CentOS 7 we have rather small ROOT partition, with the rest of disk given to HOME partition. If you however, use your server for hosting or mail purposes, most of the space will be required in ROOT partition, while HOME is almost unused.

Therefore, we need to re-partition our disk by increasing ROOT, while shrinking HOME partition.

At first, main steps in short:

  1. Backup HOME partition
  2. Unmount and remove HOME logical volume
  3. Resize ROOT partition
  4. Restore HOME
  5. Remove HOME from fstab

Now everything in detail.

While checking disk space you can use “df –h”, however, “lsblk” gives much nicer output. Here we can see that Home partition is 440GB, while Root is only 50GB.

[root@server /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 499.5G 0 part
 ├─centos-root 253:0 0 50G 0 lvm /
 ├─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
 └─centos-home 253:2 0 441.6G 0 lvm /home
 sr0 11:0 1 1024M 0 rom


1. Backup Home partiton
There are several ways to backup and restore Home partition, but I mostly use “tar”, which is quick-and-dirty.
[root@server home]# cd /home
[root@server home]# tar cvf home.tar *
[root@server home]# cd /tmp
[root@server tmp]# cp /home/home.tar /tmp


2. Unmount and remove Home logical volume
[root@server /]# umount /home
[root@server /]# lvremove /dev/centos/home
Do you really want to remove active logical volume home? [y/n]: y
Logical volume “home” successfully removed
[root@server /]#


3. Resize Root partition
With “vgs” command you can see how much free space is available. By issuing lvresize command you can either use exact amount to extend or percentage. In my example I use 100%, but it could’ve been 441.63GB

[root@server /]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- 499.51g 441.63g
/* Issue resize command */
[root@server /]# lvresize -l +100%FREE centos/root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 491.63 GiB (125858 extents).
Logical volume root successfully resized.
[root@server /]#
/* Confirm the size of your partitions */
[root@server /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 499.5G 0 part
├─centos-root 253:0 0 491.6G 0 lvm /
└─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
[root@server /]#


4. Remove entry of Home partition from fstab or comment it out so that system would not mount it at startup

[root@server etc]# sed -i ‘/centos-home/d’ /etc/fstab


Reboot and you are done!