0

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.

user1118764
  • 129
  • 1
  • 1
  • 4

1 Answers1

6

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 ;)

HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • 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? – user1118764 Oct 07 '14 at 08:13
  • Yes, back to /home and indeed from then on it resides on the root file system. You may need to expand that somewhat if you would have a lot of data in /home – HBruijn Oct 07 '14 at 08:26