I have separate
/home partitions, of which both use ext4 as their filesystem.
How can I merge them, and what is the easiest way?
I don't think there's an easier way. You need to copy the data from one partition to the other. You need to delete the old home partition and resize the root partition. That cannot be done on a running system, so a live CD or USB seems like as good as it gets.
- Boot the live CD/USB.
- Mount the root partition to
- Mount the home partition to
Copy the data using
sudo rsync -avz --hard-links --numeric-ids /mnt/oldhome/ /mnt/root/home
/mnt/root/etc/fstaband delete the entry for your home partition.
- Unmount the root and home partition and reboot the system. If everything works as expected you can reboot again into the live system and then:
- Delete the old home partition, resize the root partition.
That should be it.
I dont know about the easiest or the best approach but here is how I would do it. I would just create folder in
/ and then copy all data from
/home to it. Then I will reboot my system using live cd and delete the partition for
/home and rename the folder that I created in
home and then delete entry for
/home in fstab. And the last step would be to resize my root partition to consume empty space created by deleting partition for /home.
I know this is an old question, but for anyone like me who are looking for a good solution this tutorial: MERGE (OR RESIZE) THE /HOME PARTITION ON CENTOS 7 worked great for me!
Just don't forget to do
chown -R <USER> /path/to/new/home for all end users. System/program users are fine as well as root, but any users you set up will need that command.
The other benefit of this is that you don't need to use the install media, you can just do it from a root terminal, so if your server is of site you'll still be able to do this!