29

I have a wonderful running Maverick Meerkat install going on right now. I want to move my /home to another partition as per many suggestions.

How can I go about doing this without reinstalling the entire Ubuntu system? Can I simply create the partition with gparted and then change the mount point of /home in fstab to reflect it or is it a bit more difficult?

César
  • 807
argrubbs
  • 343

3 Answers3

18

Yes, it is only a matter of adding a new entry to /etc/fstab and then copying the files over.

I suggest using UUIDs for the partition identifier in fstab, the syntax similar to this:

UUID=abcdabcd-acbd-abcd-abcd-abcdabcd /home ext4 defaults 0 2

Copying is best done as root, with the -a flag passed to cp. Also, better play safe and not remove the files immediately:

cp -a /home/* /path/to/new/partition/
mv /home /old_home
mkdir /home

Note that the user directories must be straight inside the partition, not in /partition/home/.

evgeny
  • 9,865
1

Are you planning on sharing your /home with windows? If so, I made a few mistakes but it is do-able. Read my learning curve here.

Also, How-To Geek has a good tutorial on merging linux and windows /home and My Documents here as well as many others (HTG is my other source of invaluable info!)

Andrew
  • 644
1

Special Case: Copy home directory to Portable USB drive

There are some good reasons to copy your home directory to a USB drive. Not having to leave home at home when traveling is one. Not trusting your room mate is another.

  • Format flash drive to ext4.

  • As root, use Grsync to copy /home/{username} from the internal drive to the flash drive. Preserving owner, permissions and group works for me.

    Grsync window

  • Copy the UUID of the new partition.

  • Edit /etc/fstab on the internal drive to add the /home UUID:

    UUID={UUID from above} /home   ext4    defaults        0       0
    

Notes:

  • It might be a good idea to use an encrypted home when traveling.

  • If USB home permissions get messed up, they can be updated from the internal drive.

  • You will either need the USB to boot the computer or edit the USB's home fstab entry with an # in front of it.

Thanks to ubfan1 for the hint: Using existing home directory from a bootable external drive

C.S.Cameron
  • 20,530
  • 12
  • 78
  • 125