Merge Partitions – Easiest Way to Merge / and /home Partitions

filesystemhome-directorypartitioning

I have separate / and /home partitions, of which both use ext4 as their filesystem.
How can I merge them, and what is the easiest way?

Best Answer

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 /mnt/root.
  • Mount the home partition to /mnt/oldhome.
  • Copy the data using rsync:

    sudo rsync -avz --hard-links --numeric-ids /mnt/oldhome/ /mnt/root/home
    
  • Open /mnt/root/etc/fstab and 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:
  • Open Gparted.
  • Delete the old home partition, resize the root partition.

That should be it.