1

I have my linux install on a small disk. I want to put the home directory on a different hard-drive. I was thinking of using this and then this. Would this work? Is there a better way? Should I just move the entire thing to the new harddrive? The first article describes how to put your home directory into a new partition. The second one describes how to move a partition to a new hard drive.

2
  • I'd recommend fsarchiver for copying the data across, rather than rsync and dd or whatever is recommended in those links. Jan 25, 2014 at 16:39
  • 3
    Please explain what you want to do in a bit more detail. I don't want to have to read two long external pages to understand what you're asking
    – terdon
    Jan 25, 2014 at 16:39

1 Answer 1

2

Here's the real easy way.

  1. Log out and log in as root. Not su or anything else. You don't need a GUI to do this, either. Just make sure all your normal /home/whoever users are logged out.

  2. Create a new partition, and mount it on (e.g.) /mnt/tmp.

  3. cp -a /home/ /mnt/tmp/. You can actually leave the stuff that's in home there for a while until you are happy all this went smoothly. When you mount the new partition there, the stuff in /home will become inaccessible until you umount it, but it will be safe and sound until you delete it (see REMEMBER below).

  4. Remount the partition. I.e., umount /mnt/tmp, mount /dev/mypartition /home.

You can now try logging back in as a regular user; everything should work. As mentioned in one of your links, you may want to remove gvfs related stuff from your new $HOME first. If all this works, add a line to /etc/fstab to make it automatic at boot; first you need the UUID of the newpartition (blkid /dev/mypartition).

UUID=theuuidyougotfromblkid /home  ext4 defaults 0 2

This presumes that the partition is ext4 and there isn't another 2 in the last column. If so make it 3 or whatever.

REMEMBER

The stuff you copied from /home is still there "underneath" the mount point, meaning you can't access as it as long as the new partition is mounted there. You can leave it as long as you want (note: it WILL NOT parallel changes made in the new home, it will remain as it was), but beware it will still be taking up space on that original partition, so at some point you will want to (logged out, as root) umount /home and delete the stuff underneath.

1
  • 1
    You don't need to unmount /home to get to the stuff underneath. You can bind mount / to another location and access it there. eg - mount -o bind / /mnt/root; rm -rf /mnt/root/home.
    – jordanm
    Jan 25, 2014 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .