Shrinking or removing home partition in CentOS 7 installation

10,799

Yes, XFS doesn't shrink.

Yes, there is no mandatory requirement to have /home as a separate file-system (although a number of reasons to do so are listed here)

Back-up the contents of /home, unmount the home directory and discard the logical volume with lvremove and the blocks you had assigned will be returned to the volume group as free space, which can be used for new volumes with lvcreate or to expand existing logical volumes and file-systems.
Then restore the back-up of /home and don't forget to remove the entry in /home from /etc/fstab.

I won't comment on your habit of doing everything as root ;)

Share:
10,799

Related videos on Youtube

user1118764
Author by

user1118764

Updated on September 18, 2022

Comments

  • user1118764
    user1118764 over 1 year

    I made the mistake of creating a home partition that fills up all my disk space, and it's formatted in XFS, which to my knowledge isn't shrinkable.

    Since I have no use for the home partition anyway (I'm always root), can I just lvremove /dev/mapper/centos-home and reclaim the unused space with lvcreate? I notice when I lvremove it, my Free PE/SIZE increased from 0 to a large value in vgdisplay.

    Thanks.

    • FooBee
      FooBee over 9 years
      The correct approach is to be never root, or nearly never.
  • user1118764
    user1118764 over 9 years
    Thanks! This is a test setup so being always root is for convenience sake. It wouldn't be the case in a production system. :) I have backed up /home/user, unmounted, lvremoved, and commented out the /home entry in /etc/fstab. Where do I restore the back-up of /home? Back to /home? Once I've unmounted /home, does /home move to the /root partition?