Enter your email address:

Delivered by FeedBurner

Move your home directory to its own partition


StumbleUpon Toolbar

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.

Trackback URL for this post:

http://www.go2linux.org/trackback/245
StumbleUpon Toolbar

 If you like this article, subscribe to our full rss

If this article was somehow useful for you, you can leave something in the tip's jar

Please post your question in our forum and use comments only to leave your comments about the article, thanks.

What is the missing command

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

Sorry, for that, please read now, It was a mistake on a html tag not closed. :( so sorry.

Guillermo Garron

This is not the way to do

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

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.

Changing the cp command to

Changing the cp command to
cp -a /home.bak/* /home
preserves 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.

> cp -a /home.bak/* /home

> cp -a /home.bak/* /home -R

From 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 ext3 nor /dev/sda3 will suit every user in the mount command.

I think better to use

I think better to use dd.
opensourcedevelopment.net

just migrated my home to its

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.

hese partitions are normally

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.

Ok, I get all those steps

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

Hi,

are you using Ubuntu?

Guillermo Garron

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Captcha
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

This site is proudly hosted at Bluefur Hosting