合并Ubuntu的home和root分区

之前安装Ubuntu的时候把home和根分区分在两个分区里了,后来因为涉及备份的问题,需要把它们合并在一起,所以找答案找到了这个。

转载自:What is the easiest way to merge / and /home?,htorque的答案

  • Boot the live CD/USB.

  • Mount the root partition to /mnt/root.

  • Mount the home partition to /mnt/oldhome.

  • Copy the data using rsync:

    1
    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.