5

Currently my /home partition and / are on different disks (configured at install time). Can anyone guide me to move the /home directory to the disk where my / currently resides in?

2 Answers 2

4
  1. Create a new folder /new_home.
  2. Use rsync to migrate all data from /home into /new_home. (See instructions at wiki)
  3. Edit fstab to remove the mount for /home/
  4. Unmount /home/
  5. Delete /home (This only deletes the empty folder)
  6. Rename new_home to home

You may need to resize your partitions to make space for your new home directory using gparted. Also gparted can help you reclaim space after moving home.

Reference: Moving home at Ubuntu Wiki

7
  • I can do this on a live system without any issues, right?
    – Oxwivi
    Oct 20, 2011 at 15:18
  • @Oxwivi Do it as a different user than the one you're migrating, preferably.
    – belacqua
    Oct 20, 2011 at 18:15
  • @belacqua Will it make a difference? I mean a directory will also be created for the new user in /home.
    – Oxwivi
    Oct 20, 2011 at 18:27
  • @Oxwivi It probably isn't absolutely necessary, but there can be temp files, session-specific data, etc. that would be better moved from a logged-out state. I usually do this kind of thing from an X-less session from root, from a liveCD, or with a temp user (e.g., adduser blah, and use to sudo). See also cweiske's first two steps. For the temp user, yes, it would be ideal to modify the home dir mount point (move it to / for example).
    – belacqua
    Oct 20, 2011 at 18:31
  • 2
    @Oxwivi use sudo adduser temp --home /tmp/t followed by sudo adduser temp admin to add temp user to the admin group (So you can mount and unmount stuff). And remove the user later.
    – Nemo
    Oct 20, 2011 at 20:41
4
  1. logoff
  2. logon as root on the terminal (press ctrl+alt+F1 to get to the shell, you can go back with alt+F7)
  3. unmount /home
  4. create /oldhome
  5. remount the home partition under a new name, e.g. /oldhome
  6. rsync the files from the "new name mount" to /home with -a option
  7. remove the home partition from /etc/fstab

You must log in to answer this question.

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