There are some reasons why you may need to move your home directory to its own partition, it could be because you run out of space, or because you may want to share it with another distro in a dual Linux boot installation, well lets start.
Preparing the new partition
This may be different in your environment, in my case I will do in the same disk, just in another partition, but you can use a complete new and different disk for you /home directory.
Gparted
If you do not have gparted, install it with
sudo apt-get install gparted
the call it with:
gksudo gparted
then use gparted to create and format your new partition
Once created and formated, it is time to move your /home
You may need to resize your / "root" partition to make enough room for your /home partition, or use another disk for it.
Moving your home directory
First logout from GNome or KDE, press Alt+F1 and login as root.
Follow this steps
mv /home /home.bak
mkdir /home
mount -t ext3 /dev/sda3 /home
cp -a /home.bak/* /home
Remember to change /dev/sda3 and ext3with your own data
We need one final step,
Open your /etc/fstab file, and add this line, in my case it is /dev/sda3 but could be different for you.
/dev/sda3 /home ext3 defaults,errors=remount-ro 0 1
It there were a line for /home in you /etc/fstab file replace it with the new data.
with this finished, just reboot your system and enter as usually.
Important note
Remember to back up before using gparted if you are resizing your disk to make room for the new partition
Updated: Thanks to my Friend for some advices about how to improve this article.







just tried, no problem whatsoever, thanks! :)
A small note though:
I selected recovery mode in grub an chose to "drop to root shell" for the "login as root" part ;)
I haven't tried this yet, but how about replacing cp by rsync? This will also copy all hidden files from /home.bak to /home, while preserving timestamps, ownership, permissions, etc. The *new* home will be an exact replica of the *old*:
# rsync -a /home.bak/ /home
Of course, you may have to install rsync, which is straightforward in most GNU/Linux distributions. In debian-based distros, just
apt-get install rsync
or
aptitude install rsync
Please tell me what you think.
Thanks, I just moved home to a new partition. All is well and I am a happy camper.
Thanks for this!
It worked perfectly. I used it to move my home directory to the 16GB SSD on my eee 901.
Cheers
Hi,
Thanks. Your guide is perfect, i successfully did it and now my linux OS partition has 5.5 gb free space and home directory has 28 gb free space.
Hi, I am happy to hear that!
Guillermo Garron
The advice workes, I use EEEBUNTU on a eeepc 900, and can now use the 16 GB solids state as an home drive.
thanks for this poosting
I thought the point of having home on a separate partition was so data was left alone when reinstalling and the home partition didn't need reformatting. I reinstalled Kubuntu and my data was still on the home partition but a new home directory of 10 GB was formed with nothing in it(not sure where this 10GB comes from as there was no spare left on the disk). So even though the installation was the same and the home partition unformatted the home directory is renewed and the old data needs remounting. You may as well just back the data up and do a complete reformat when reinstalling ?
Also, does anyone know why my alt-F controls would not work on the keyboard ? I am using standard English keyboard layout.
regarding to "login as root" just do like this example
hannah@pysen:~$ sudo passwd root
Enter new UNIX password: [passwd of your choice]
Retype new UNIX password:
passwd: password updated successfully
then su as root
hannah@pysen:~$ su -
Password:
root@pysen:~#
done!
Matti
Ok, I get all those steps except the "login as root" part. How do you actually do that? I'm told that "root cannot login" even though I set a separate password for it than my user account.
Hi,
are you using Ubuntu?
Guillermo Garron
hese partitions are normally not re-sizable (making one larger and the adjacent one smaller) The purpose of GParted is to allow the individual to take a hard disk and change the partition organization therein, while preserving the partition contents.
just migrated my home to its own partition and this guide helped to encourage my first steps. good guide, perhapse u can add rm -rf /home.bak so people would free their root space.
I think better to use dd.
opensourcedevelopment.net
>
cp -a /home.bak/* /home -RFrom the fine manpage:
| -a, --archive
| same as -dpR
Therefore, -R is superfluous. Also, it is better to write down the options *first*.
And please note that neither
ext3nor/dev/sda3will suit every user in themountcommand.Changing the cp command to
cp -a /home.bak/* /homepreserves ownership, permissions and timestamps during the copy. IOW the corrective chown action becomes obsolete!
And after verifying that everything worked out as expected, that no data got lost, etc, you can remove /home.bak altogheter and reclaim some free space on your root partition.
It is also wise to do such administrative operations in single user mode for exactly the same reasons you tell to logoff from your X session.
This is not the way to do this. The copy step should
be
cp -a /home.bak/* /home
This will preserve permissions and symbolic links,
and recurse through sub-directories.
Agreed! cp -a is the way to go on this one to make sure you preserve your permissions for your files, etc. And I know in my home directory I have some files which are not my user owned so if you do a chown -R after copying this will wreck your previous differences in permissions that you may currently have. I also like to use verbosity so that way I can assure myself things are progressing, especially if you have a large home folder - it is more reassuring than just watching for a prompt return.
What is the missing command after "Now we need to assign the new permissions to the recently created /home directory." ?
Sorry, for that, please read now, It was a mistake on a html tag not closed. :( so sorry.
Guillermo Garron