Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted
  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

share|improve this answer
    
I can do this on a live system without any issues, right? –  Oxwivi Oct 20 '11 at 15:18
    
@Oxwivi Do it as a different user than the one you're migrating, preferably. –  belacqua Oct 20 '11 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 '11 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 '11 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. –  Capt.Nemo Oct 20 '11 at 20:41
show 2 more comments
  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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.