Saturday, June 14, 2008

How to move the /home directory to a separate partition (ie - a separate hard drive)

When ubuntu installs, the home directory is created on the same partition as the os. However, it would be nice to move the home directory to its own partition so that the os can be reinstalled/upgraded without affecting user files. Here's how I did it.

1) Create a new partition (see previous post about how to format and mount a second hard drive)
2) Mount new partition using mount (mount to anywhere except /home)
3) Copy user directories in /home to new partition
4) Delete everything in /home (but keep the actual /home directory)
5) Edit /etc/fstab to have new partition mount to /home
(note that you may have to update the UUID of the new partition in /etc/fstab, see previous post about adding an entry to /etc/fstab)
(another note, if the mount fails, when you try to login, you will get an error that says that the user directory cannot be found)

No comments: