This will be my first posting about Ubuntu Linux, the OS that I use on three of my four PCs at home.

I have been an Ubuntu user for just over a year now.  I started with Feisty Fawn, and after upgrading once Gutsy Gibbon came out, I decided I never wanted to go through that pain again.  That was, until I discovered that you could move your /home folder and all of its contents to another hard drive.  I was thrilled.  This in of it self is actually the easy part.  Let’s assume it is going on to its very own hard drive.  We’ll call this drive sdb1.  First mount the drive (I’ll skip all those steps and assume you already know how to do that.  If you don’t, try here or google it.

sudo cp -r /home /mount/newdrive

Next, go and check to make sure all your files and directories have copied to the new drive.  DON’T Assume everything worked no problem.  If there’s one thing I’ve learned from Ubuntu, its that you can’t assume ANYTHING.

Next, we’re going to move the current /home directory to a backup folder just in case.

sudo mkdir /old_home
sudo cp -r /home /old_home

Once your satisfied that you’re ready you can delete the old /home folder and recreate it.

rm -rf /home
mkdir /home

Next we want to map the /home onto the new drive we do this in the fstab file.  We will want to add something onto the end.

First

sudo pico /etc/fstab                  (Yes, I use pico, because I think it sounds cute… you can use whatever editor you want)

Then add this:

/dev/sdb1          /home               ext3        relatime          0             2

Save and exit.  We can then test to make sure this has worked by typing:

sudo mount /home

Then go to your home directory and see if you can list your files.    If you can, give it a try and reboot.

That should work.  I hope I didn’t leave out anything.

Next, how do we re-install linux, (or whatever) and then remap to that /home folder upon a new installation??

This step, wasn’t so easy for me.  And I’ve done it three times now, and finally decided to write it down.  Thanks to the official IRC Support channel on irc.freenode.org in the #ubuntu chat room, I once again, have a working computer.

First – I have tested this with Hardy Heron, I have no reason to believe it shouldn’t work on Gutsy Gibbon, or Feisty Fawn, but I haven’t tested it, so if anyone knows this works on this, please let me know, and I’ll mention it in this little guide.

During the installation phase it will ask you to partition your drives.  Choose MANUAL.

Then, choose the hard drive you want to have your OS and programs installed to.  I chose SDA1 (cause that was the first hard drive) and I chose the mount point of / and the file system of ext3

Then, I went to the second hard drive, and chose the mount point of /home and file system of ext3.

Then, I made sure I had enough swap space, and proceeded to install ubuntu.

After I was done however, I discovered that I could not login.  This was because something went wonky with the ownerships.  My friends in the #ubuntu room (especially unop) helped to get me going again.

Obviously we’re going to use ME as the case study.

First type ALT F2 to get to the console, login… then

Is malocite your username?

echo $user

Yes, it was.  Am I part of the right groups?

groups; id

Yes I was.  Next Is this actually the right home directory?

grep -i $USER /etc/passwd

It was.  Now, we’re going to set the ownership of the directory.

chown malocite:malocite /home/malocite; chomod -Rv 750 /home/malocite

And that should do her!  After that, I rebooted and was able to login to ubuntu no problem, and all of my home files were exactly as they were before.  The other great thing, was all my bookmarks, email, background prefs, settings, etc were also all exactly as they were before.

I hope this was helpful, please let me know, and PLEASE, if you see anything thats wrong, let me know so I can fix it.  This was my first attempt at such a guide, and I am sure it needs work :)

–malocite

NEW

One Comment

  1. On a fresh install you code just make your home dir on a separate partition and never worry about it again! Just mount during install.


Post a Comment

*
*