I am running centos 7 minimal. My /home partition is about 500gb and root is only 50gb. I need help figuring out how to reduce the /home partition so I have free space to allocate to the root partition.

My /home and root partitions are XFS file systems. I have not been able to find steps of how to get root to have more space by reducing other partitions because I know I cannot shrink an XFS file systems. So I am confused about how I can accomplish this since this is xfs.

[root@openstackcontroller ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   50G   15G   36G  29% /
devtmpfs              63G     0   63G   0% /dev
tmpfs                 63G     0   63G   0% /dev/shm
tmpfs                 63G  9.0M   63G   1% /run
tmpfs                 63G     0   63G   0% /sys/fs/cgroup
/dev/sda1           1014M  233M  782M  23% /boot
tmpfs                 13G     0   13G   0% /run/user/0
/dev/mapper/cl-home  503G  4.2G  499G   1% /home
[root@openstackcontroller ~]#

For the end result, I'd like to have the /home be 20gb so I can give all the rest to root.


First of all, 50GB for / is plenty in most cases.

If you need to shrink XFS anyway, the only way is to recreate the FS and restore from backup.

The steps would be:

  • Do a backup.
  • Unmount the /home FS
  • Resize the partitions and grow the one for / (or use lvresize in case you use LVM, which appears to be the case).
  • xfs_grow /.
  • mkfs a new /home FS and mount it.
  • Restore from backup.

As it appears that your current /home is nearly empty, this should be a very quick process that doesn't even need a reboot.

Another option: Move stuff to /home and link it back. Things like database data directories, /var/log and /opt are good candidates.

  • Thanks! Would I use xfsdump and xfsrestore to backup and restore the /home FS? – Joey Corkey Dec 15 '17 at 17:14
  • You can, but in most cases, plain cp or rsync would be sufficient. – Sven Dec 15 '17 at 17:16
  • I thought I could not do lvresize on fxs FS's? – Joey Corkey Dec 15 '17 at 17:34
  • After you reduced the size of /home with lvresize, you need to recreate the filesystem with mkfs. All that lvresize does is to alter the size of the block device where the file system is living, but not the filesystem itself. – Sven Dec 15 '17 at 17:37
  • I just double checking since I'm very new to linux file systems I would run the following commands: 1. cp /home PATH_TO_BACKUP 2. umount /home 3. lvresize -L 20G /dev/mapper/cl-home 4. xfs_grow / 5. mkfs.xfs -f /home 6. rsync PATH_TO_BACKUP – Joey Corkey Dec 15 '17 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.