You are on page 1of 25

3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

How to Move Your Home Folder to Another Partition


[Linux/Ubuntu]

Damien 25th Jul 2013

If you have accepted the default option while installing Ubuntu, or that your computer comes with
Ubuntu pre-installed, chances are that your Home folder and the system folders all lie in the same
partition. This is perfectly ne, but if you want to upgrade your existing Ubuntu version, or reinstall
Ubuntu, you wont be able to preserve your app settings, or even retain your les and documents. One of
the good practice is to give the Home folder its own partition, so whatever changes you made to the
System folder wont affect your Home directory, and you can easily upgrade or reinstall Ubuntu with
ease.

If you want to move your Home folder to another partition, here is how you can do so.

Creating a new partition


Note: You can skip this step if you already has an existing external partition that you can use.

Assuming that your computer has only one hard disk and it contains only one partition. To create a new
partition, you have to rst obtain a Ubuntu Live CD/USB and boot into it. You cant partition the hard disk
when it is running.
LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 1/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

Once you are booted into the Live session, open the app GParted. Select the hard disk from the list. It
should be labelled something like sda.

You should see a number of entries in the list. Select the entry that corresponds to the main partition. It
should be the one with the biggest le size and is either in the ext3 or ext4 lesystem format. Right click
on it and select Resize/Move.

Set the size for the new partition in the Free Space Following eld. The number is represented in MB,
so if you want to set aside 10GB for the new partition, enter 10000. You will notice that as you enter
LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 2/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

the number, the number in the New Size eld will decrease accordingly. My usual practice is to set
aside 10GB for the system les and allocate the rest to the Home partition. Click Resize/Move.

Back to the GParted main screen, you should now see a new Unallocated entry with the le size that
you have set earlier. Right click on it and select New. Select ext4 as the lesystem and click Add.

Lastly. click the green check button to apply the changes. Depending on your hard disk size, the resizing
process might take a long time

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 3/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

After the process is completed, you should see something like the screen below. Record down the new
partition number.

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 4/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

Now shut down the live session, remove the live CD/USB and boot up the computer.

Migrating the Home folder


To migrate your current Home folder to an external partition, there are four things that you need to do:

1. Mount the external partition onto a temporary Home location.

2. Copy the les from your current Home folder to this temporary Home folder.

3. Relocate the current Home folder

4. Mount the new Home folder.

1. Create a temporary Home folder


Open a terminal and type the following:

sudo blkid

This will display the UID of all the partitions. Record down the UUID for the partition that you have
created earlier.

Next, open the fstab le:

sudo nano /etc/fstab

and add the following line to the end of the le. LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 5/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

UUID=xxx-xxxxx-xxxxx /media/home ext4 nodev,nosuid 0 2

Replace the UUID with the UUID value of the external partition.

Save (Ctrl + o) and exit (ctrl + x) the le.

Next, create a mount point:

sudo mkdir /media/home

and reload the updated fstab.

sudo mount -a

You should now see a home folder in the Media directory.

2. Copy the les from your current Home folder to the new Home
folder
The next thing we are going to do is to copy all the les from the current Home folder to the new Home
folder. You can simply do a Select all, Copy and Paste to transfer all the les to the new Home
folder. However, you might be missing out the hidden les and some of the le permissions might not be
preserved. A more complete method would be usingL Orsync
A D I N G .. . .

https://www.maketecheasier.com/move-home-folder-ubuntu/ 6/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

sudo rsync -aXS /home/. /media/home/.

3. Relocate the current Home folder


Once we have set up the new Home folder, we need to remove the existing Home folder to make way for
the new Home folder in the external partition. To do that, type the following commands in the terminal:

cd /
sudo mv /home /home_backup
sudo mkdir /home

What the above commands do is to move the existing Home folder to Home_backup, and create an
empty Home folder for the new Home folder to mount to.

4. Mount the new Home folder


The last step to complete the migration is to mount the new Home folder as /home. To do that, we
have to revisit the fstab le again.

sudo nano /etc/fstab

All you have to do is to change the /media/home to /home. Save and exit the le.

Lastly, reload the fstab le:

sudo mount -a

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 7/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

Thats it. You have now migrated your Home folder to an external partition.

Optional: removing the Home_backup folder

Once you are done with the migration, you can either use the old Home folder as a backup, or remove it
to release the storage space. To remove it, use the command:

sudo rm -rf /home_backup

Let us know in the comments if you encountered any dif culty.

Image credit: Moving House Kiwi Style

Is this article useful? Yes No

Related Ebooks

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 8/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

The Beginner's Guide to KDE

The Beginner's Guide to Linux Command Line

The Complete Beginner's Guide to Ubuntu 16.04

You Might Also Like Sponsored by Revcontent

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 9/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

Joven De Mexico Desarrolla App Que Lo Hizo Ganar Millones. Descrgala Aqu

Get Paid $875 Everyday From Home in Mexico !

Madre Borra 20 Aos de Arrugas Siguiendo Este Sencillo Truco

Rusas Ardientes Quieren Conocer a Los Hombres Mayores

Itching This Part of Your Body is a Sign of Alzheimer's

Bellas Rusas Quieren Quedar Con Los Hombres Experimentados

38 comments
Neil Greenwood
Since Ubuntu 8.04, reinstalling without formatting the existing partitions will save the previous home folder
even if its all on a single partition.

Jul 25, 2013 at 12:57 pm

Damien
Yes, but that is only when you have set it up properly. In addition, not all ubuntu-based distro
retain the same installation process as Ubuntu. I installed one and it wipe out my har d disk
entirely.

Jul 25, 2013 at 7:59 pm

John Billot
Damian, thanks a million for this, you obviously work for GCHQ in the UK and have been monitoring my
emails!
I have been researching buying a small SSD (say 64Gb) to put my Ubuntu/Linux OS on with the HDD

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 10/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

being used for the Home folder. This would do the trick perfectly.
Thanks again.

Jul 25, 2013 at 1:02 pm

Damien
Shh dont reveal my *undercover* position :p Hopefully you are not implying I am working for
NSA

Glad that this tutorial works for you.

Jul 25, 2013 at 8:00 pm

dragonmouth
I have been researching buying a small SSD (say 64Gb) to put my Ubuntu/Linux OS on with
the HDD being used for the Home folder .
The following article might help you:
http://www.makeuseof.com/tag/using-a-small-ssd-and-a-r egular-hard-drive-how-to-organize-
your- les/

Nov 1, 2013 at 6:03 am

John Billot
Thanks for that, have bought a 64GB SSD and plucking up the cour
age to install
Ubuntu 13:10 plus various apps on it.

Nov 4, 2013 at 9:02 am

dragonmouth
Make sure that any partitions that are written to frequently, are
allocated to the HDD. It will extend the life of your SSD.

Nov 5, 2013 at 3:37 am

Tim12in
thanks for taking the time o
t put all the details. Really helps

Oct 4, 2013 at 12:05 pm

Mark
LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 11/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

This is a really well-written and easy o


t follow article. Thanks.

I have found the rsync command you gave has not been transferring all my les (e.g. the .thunderbird
directory, which is obviously important I dont lose).

Do you have any idea why?

Thanks.

Oct 22, 2013 at 9:55 am

dragonmouth
I use the following procedure to set up my /home partition:
Since whenever we are to change anythingon the HD we should back it up,
1) I rst back up my /home partition to another drive (usually an external).
2) Then I re-partition the drive, setting up separate /, /home and swap partitions.
3) Do a fresh install of the O/S.
4) Con gure the O/S, setting up all the users.
5) Restore the backed up /home partition to its new location.
6) Reboot.

This procedure avoids the use of Terminal and editing of system les.Any error in editing or in issuing a
command can result in an unbootable system.

BTW I use a Live GParted CD rather than a Live Ubuntu CD. GParted Live loads much faster and goes
right into the partitioning screen.

Nov 1, 2013 at 6:32 am

Damien
That will work, but you will have to reformat your hard disk.

Nov 4, 2013 at 10:17 pm

dragonmouth
It does work. What do you mean reformat hard disk? That gets done as part of
the re-partitioning process.

For my next trick I will put the / partition on an SSD and /home and /var on an
HDD. :)

Nov 5, 2013 at 3:33 am

Ogui
LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 12/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

kindly let me know how to undo this it did not work. I get major error on startup and now only starts
without my data partition mounted (and does not let me mount it!) thanks.

Nov 2, 2013 at 2:25 pm

dragonmouth
I get major error on startup
What does the error message say?

kindly let me know how to undo this it did not work.


You backed up your /home before trying to move it, right?
One way of undoing this is to do a fresh install of the distro, letting it do default partitioning.
Set up your userids and then restore the les from the backup to the respective
/home/userid/ partition.

Nov 5, 2013 at 3:47 am

MaxK
Brilliantly clear and easy to follow steps not all of which I understand which is irr
elevant. What puzzles
me: HOME is still in the le directory list on the boot partition. On opening HOME(boot) it opens in thethe
new partition. What concerns me: A new OS install will wipe the Boot par tition but wont deletion of the le
link cause the data in the other partition to be deleted as well?? Thank you very much. MaxK

Nov 4, 2013 at 9:56 pm

Damien
The data wont be deleted. It is just a mounting point. All oyu need to do is to update the fstab
le and it will remount the external partition as Home again.

When you are install a new Linux distro, you can set the external partition as /home and set it
to Do not format. In this case, you can preserve your data in the home folder.

Nov 4, 2013 at 10:16 pm

xolani
I used the following to ensure ALL my les where copied over and I could see the progress:
sudo rsync -avrXS /home/. /media/home/.

Nov 14, 2013 at 1:57 am

vimbai-naye chatitai
LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 13/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

This was super-easy to follow. My OS is on a 20gig SSD and space was running out, quick. o
Yu
saved my bacon with this post Siyabonga :-)

Jan 2, 2014 at 12:00 am

Leo Newburn
I have 2 older SATA drives, each 300 GB and each with their own distr os UBU STudio 12.04.4 LTS 64 bit,
and UBU 13.10 64 bit.
I just installed a new WD SATA drive, 1 TB, partitioned it at 200GB for Windows 7 (now installed rst) as
NTFS. The remaining I partitioned ext4.
How can I migrate my 2 Ubuntu OSs into the new 1TB drive? I intend to follow your suggestions here to:
1) Move the /home folders of each Ubu OS into its own separate /home folder on its each own partition in
the new drive;
2) Delete the old /home folders;
3) Migrate the old Ubuntu OSs to their own separate partitions on the new drive;
4) Reformat each old SATA drives as ext4;
5) My goal as an end result would be:
a) Keep the WIN 7 partition as is with its own world;
b) Set up each Ubu Distro with its own separate /home folder on SATA #1 (old drive) /home folder, so that
any data happening through my everyday use of those distros would automatically save that data in its
new /home location.
After all this I will setup SATA #2 as a backup medium, which is another matter thatIm not asking about
here.

Cheers, and any kind of direction/help you can offer I would be grateful.
~Leo Newburn
leokn@yahoo.com

Jan 13, 2014 at 10:30 am

Damien
Your scenario is pretty complicated. It is easy to move les and folders, but not thewhole OS. I
would advise you to partition the ext4 into several smaller partitions, then reinstall the 2
Ubuntu OS to each partition. Once you have installed and booted up Ubuntu, you can then
transfer les over from the old SATA drive.

Jan 13, 2014 at 7:06 pm

Jim Smith
Thanks for the timely information.Just one question.What about data that might be somewher e besides
the /home directory? and how do you know if there is any elsewhere? Im thinking of db les or scripts
youve installed.
LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 14/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

Best Regards,
Jim

Feb 12, 2014 at 3:50 am

Damien
It depends on the con guration of each individual application. Most
applications do store their data in the Home folder. One thing though, as
long as your le structure is intact, it doesnt really matter where they
are stored. You can still access them even though you have changed to a new
Home partition

Feb 12, 2014 at 6:55 pm

Hank
Hey Damien,

First of all, thanks a bunch for this clear tut


orial! It seems to work ok, however I get an error whenever I
close gedit: ** (gedit:2698): WARNING **: Could not write gedit state le: a Filed to create le
/home/user/.gnome2/gedit/gedit-2.PWGJBX: P ermission denied

I believe this has to do with the rights to the home folder? Do you have any idea to what I should change
this, given that this is indeed the issue?

Feb 20, 2014 at 5:31 am

Hank
Nvm, I had to change the owner to user (chown user:user dir/). Solved!

Feb 20, 2014 at 5:51 am

Kris
This is a very well writen post, thanks. I e
r commend using:

sudo rsync -aSXv /home/. /media/home/.

The [v] for verbose will show users that rsync is still runing if the
y get an error. Panic might unsue if they
think the process has stopped or hung-up causing them ot do something silly. Like kill the machine.

Dont forget to backup everything before starting this. That cant be stressed enough.

My System:
Mint Linux 14
LOADING...
1- 2 TB Drive 2 Partitions /home /shared media
https://www.maketecheasier.com/move-home-folder-ubuntu/ 15/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

1- 500 GB Drive /
2- 650 GB Drive in Hardware RAID 1 /backup (location of all backup les)

If I want to upgrade the kernel or any failure in the OS I unplug the 2 TB drive and do all the repair or
upgrades. Once everything is working properly then reconnect the 2 TB and mount back at /home. W orks
great! I have a persistant copy of home data going back 12 yrs.

Feb 25, 2014 at 7:24 am

Venki
Clean and simpleinstructions, I just followed it and it work
ed great.

Mar 5, 2014 at 2:24 pm

hr
thats very good instruction

Mar 18, 2014 at 4:34 am

Anna
Looks promising.
I have on question: will your old settings/desktop etc. not break your updated machine? For example: I am
on Ubuntu 12.04 and want o t update to 14.04, will the settings/desktop settings not break my updated
14.04? How will this works when you want another distro, because all settings, les and desktop will be
maintained?

https://help.ubuntu.com/community/Partitioning/Home/Moving

settings, les, and desktop will be maintained if you upgrade, (re)install Ubuntu or another distro.

Apr 8, 2014 at 4:28 am

Damien
It shouldnt break the settings. Only the system les will get updated. The Home folder and
settings will still be intact.

Apr 8, 2014 at 6:35 pm

Duarte
Worked perfectly, thanks!

Apr 13, 2014 at 11:03 pm LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 16/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

Frans
Worked like a charm for me on SolydX!
(Added second WD harddisk 320Gb)

Apr 14, 2014 at 10:03 am

Roberto
Great technique to havea shared storage drive between Windwes and Ubuntu. However, it did not work
perfectly for me. The home folders on theleft sidebar of Unity are there, but when I click on them I get an
error: Documents could not be found. Perhaps it has recently been deleted.

However, my storage drive is now under the home folders, and that s how I can access my les. How do I
make those folders on the left bar er present the folders in the shared drive?

Apr 17, 2014 at 4:34 pm

Damien
Did you check that the Documents and all other system folders ar e in the
new Home partition? If it still doesnt work, one of the alternative is to
create bookmarks for the folder you want to access.

Apr 17, 2014 at 8:25 pm

Roberto
After rebooting Ubuntu, I see that the Documents, Picutres, etc. folders from the
storage partition are now accessible in /home. But the shortcut folders in Unity
have gone back to the default Ubuntu home folders, not the shar ed partition folder.
They are in /home/my-name. It would be nice if they were the same folders as the
ones in /home. When I right-click on then, the option of Remo ve is ghosted out.

Apr 18, 2014 at 10:40 am

roadrawts
Thank you. Very clear instructions with good examples. Worked perfectly.

May 31, 2014 at 12:17 pm

GusCor
How I migrated the data from a HDD with bad blocks
L O A D I No
tGa. . new
. HDD.
https://www.maketecheasier.com/move-home-folder-ubuntu/ 17/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

I have Linux Mint running in a SDD and the /home folder in a HDD
. The HDD developed bad blocks and was
under warranty. WD sent me a new HDD o t replace my old new 2TB HDD. After much reading and
researching online this is what I did:

First plug the new HDD into a SATA slot in motherboard, then

1. Boot from linux mint live CD


2. Open Gparted
3. Format and partition new HDD. I decided to format as GUID, even though the old HDD was MSDOS with
4 partitions in LVM
4. Copy-Paste partitions from the old drive to the new drive. This will copy everything including le
structure and UUID. Now you have 2 partitions with the same UUID (recipe for a mess).
5. Asign new UUID to the old HDD partitions (right click on a partition and select New UUID).
This will give the old partitions their own random UUID.
No need to modify fstab.
6. restart computer normally
7. to be safe you can compare the old and new HDD with diff or Meld (diff with a nic e GUI
http://meldmerge.org/)
6. If you are getting rid of old HDD secure erase everything with hdparm:
https://ata.wiki.kernel.org/index.php/ATA_Secure_Erase
7. Done now you should have a working new HDD, and a securely erased old HDD ready to ship to WD.

Hope this helps someone.

Jun 1, 2014 at 7:07 pm

Ana
Well thank you very much, it worked like a charm. =)

Jul 13, 2014 at 8:19 am

blaz
Thank you for your tutorial. It saved my a lot of problems and discovery. We just bought 4 disc drive in
RAID10 that we will use for sharing les and this does the trick.

Best regards,
Blaz

Jul 22, 2014 at 8:58 am

Comments are closed.

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 18/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

Learn something new today!


Check out Make Tech Easier Premium

Triple Booting 101: With Ubuntu, Fedora and Windows

The Complete Beginners Guide to Ubuntu 16.04

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 19/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

The Complete Video Editing Course For Beginner

Windows Networking Basics

About Contact Advertise Write For Us Terms of Use Privacy Policy RSS Feed Terms

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 20/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

2007 - 2017 Uqnic Network Pte Ltd. All rights reserved.


Make Tech Easier is a member of the Uqnic Network.

close

LOADING...

https://www.maketecheasier.com/move-home-folder-ubuntu/ 21/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

https://www.maketecheasier.com/move-home-folder-ubuntu/ 22/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

https://www.maketecheasier.com/move-home-folder-ubuntu/ 23/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

https://www.maketecheasier.com/move-home-folder-ubuntu/ 24/25
3/21/2017 How to Move Your Home Folder to Another Partition in Ubuntu

https://www.maketecheasier.com/move-home-folder-ubuntu/ 25/25

You might also like