27

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
  • 2
  • 13
  • 30
argrubbs
  • 323
  • 1
  • 4
  • 6
  • 2
    I think it's best to follow the [Ubuntu wiki guide](https://help.ubuntu.com/community/Partitioning/Home/Moving). I used it a while ago and it worked just fine. – chris Oct 10 '10 at 06:43
  • 1
    I like how that guide shows you how to find the GUID of your disks. I didn't know how to do that until now. – djangofan Jan 13 '11 at 20:06

3 Answers3

17

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

BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
evgeny
  • 9,475
  • 3
  • 27
  • 28
  • I make change in /etc/fstab but don't know how copy the files in /home to new partition /home becouse I have only one physicali disk with 4 partitions. "boot", "/ ", "/home" and "swap". Where can I create the nev /home that one is still there. I need remove whole partiton "/home" on sdb2 and move it to sdb1 "/" After I restart PC I can see my root account but password didn't work. Now I can reinstal whole ubuntu again :( – pa4k Aug 15 '17 at 21:39
  • But I olny need to resize partition using GParted but it did't work, first I must delete last "SWAP" partition than I can resizing partition before it which was mounted as "/home" but I able resize only up not down (I need to make partition smaller) – pa4k Aug 16 '17 at 07:27
  • 1
    "I suggest using UUIDs for the partition identifier in fstab" is not clear; What command is "the partition identifier", and how is it used to retrieve UUID? – MRule Jul 21 '22 at 07:07
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
  • 634
  • 2
  • 7
  • 17
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

BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
C.S.Cameron
  • 18,890
  • 10
  • 64
  • 105