Move /home to a New Partition (Ubuntu 10.04 or 10.10)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Whether you are running out of your disk space or just were not aware of the advantages of having a separate /home partition, it is still possible to move your /home folder to a new partition. Steps involved are completely risk free IMHO, and simple. While I am carrying this out on a Ubuntu Lucid system, it can be adapted to any other partition based *nix installation (Fedora, OpenSUSE etc.). Lets list out all we need to do:

  1. Creation of new partition (ext3 or ext4, ext4 recommended)
  2. Moving all your files to the new partition
  3. Creating a new entry in /etc/fstab to ensure that it is mounted as /home when you restart your computer
  4. Getting rid of old /home

Let’s go over each of these steps in detail

Step 1: Preparing a new partition

If you are looking at this article you already know how to do this. To make your life easy you can just use gparted, which is a GUI partition utility which is very simple and intuitive to use. Nevertheless, install gparted using this

sudo apt-get install gparted

Launch it and create a partition in ext3 (old distros) or ext4 (highly recommended for Karmic or Lucid).

Step 2: We need to mount this new partition, do the following

sudo mkdir /mnt/newhome
sudo mount -t ext4 /dev/sda3 /mnt/newhome

In the command above you would have to replace ext4 with the partition type of the partition that you have created. Also replace sda3 with the appropriate partition name/number. You can find this information using gparted or using command

sudo fdisk -l

Once the partition has been mounted we need to move the content of current /home to this new location. Don’t use cp command, as it might not respect softlinks and hard links if any present in your home folder. I used rsync and it worked very well, so use the command below

sudo rsync -axS --exclude='/*/.gvfs' /home/. /mnt/newhome/.

Now, wait till the copying gets over. After which go to the copied files in /mnt/newhome to double check that everything got copied correctly. Once you are sure about it, unmount the new partition

sudo umount /mnt/newhome

Step 3: Now we create a new entry in /etc/fstab to auto mount /home at each boot. Open /etc/fstab file using your favorite text editor or gedit

sudo gedit /etc/fstab

Make a new entry like this

#Entry for /dev/sda3 :
UUID=e749e432-3cd0-46e0-91e5-32bdda50d206    /home    ext4    errors=remount-ro    0    1

You would need to replace the UUID information above with the UUID for your partition. You can find it using Gparted by right clicking over the partition and selecting information as shown below

Note that, you won’t see it mounted as /home at this point. You can see the UUID on the screenshot below. Step 4: Now we would move the current /home to a different folder to make way for the /home located on the new partition.

sudo mv /home /old_home

Create a new /home folder where the new partition would be mounted

sudo mkdir /home

Now restart your computer to check it everything is working fine. Once you are sure of it you can delete /old_home by doing this

sudo rm -rf /old_home

With this you have successfully moved your /home to a new partition.

However, if you have any problems at the reboot, you can just delete the new entry you made in the /etc/fstab and  delete current /home and then move /old_home back to /home to recover your old setup. If you follow the instructions carefully, this situation is not going to arise. 🙂

You might also like

Install Fedora 13 Goddard without LVM with Separate /home While LVM has...
Dual Boot Ubuntu 10.04 and Fedora 13 Goddard with Shared /home How often people...
Shrink or Reduce Partition Size in Windows 7 If your want...
Free Tools for Harddrive Partition and Disk/Partition Cloning Managing disk...

About the Author

has written 346 posts on this blog.

Meditating towards his "nerdvana", lifehacker is a teacher by the day and a nerdy blogger by the night. He lives to learn and yearns to learn living.

5 Comments on “Move /home to a New Partition (Ubuntu 10.04 or 10.10)”

  • kokoklems wrote on 25 October, 2010, 7:21

    Worked like a charm on Ubuntu 10.10!

    Like or Dislike: Thumb up 0 Thumb down 0


    lifehacker Reply:

    Most welcome, thanks for letting me know that it worked for Ubuntu 10.10 as well (which it should have)

    Like or Dislike: Thumb up 0 Thumb down 0


  • hel wrote on 1 November, 2010, 20:28

    I added an argument to the rsync command, v for verbose, so it would tell me what it was doing. I found this very helpful. The command is then
    sudo rsync -axS –exclude=’/*/.gvfs’ /home/. /mnt/newhome/.

    Like or Dislike: Thumb up 0 Thumb down 0


    lifehacker Reply:

    @hel, I think you missed v in your command, should be

    sudo rsync -axSv –exclude=’/*/.gvfs’ /home/. /mnt/newhome/

    Like or Dislike: Thumb up 0 Thumb down 0


  • Liv wrote on 28 June, 2011, 14:19

    Seems to have worked just fine here, too. I’m using Xubuntu 10.04 Lucid. Thanks!

    Like or Dislike: Thumb up 0 Thumb down 0


Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!


Copyright © 2017 Hack Your Life!. All rights reserved.
Proudly powered by WordPress. Developed by Deluxe Themes