This HOWTO describes how to move your current /home partition to a new hard drive if you already have /home as its own partition.
I will use my situation as an example but you should be able to adapt this HOWTO to your own situation.
I had a 20GB hard drive with three partitions, /, SWAP and /home.
I had a 150GB hard drive with one partition on it from another computer. I had two folders of data on this drive one called Music and another called Videos.
I physically installed the drive and then restarted the computer.
************************************************** *************************
You may have a new drive without any partitions or data on it. If this is the case then after you have physically installed the drive boot up using the Live CD and open a terminal. Use gparted to create a new partition on your new drive. You start gparted by typing this in a terminal sudo gparted
You will have to select your new drive from the top right hand side of the screen. gparted is pretty straight forward. If you have any trouble with creating a partition in gparted I am sure a quick search of the internet will give you a wealth of information.
************************************************** *************************
So continuing with this HOWTO I opened a terminal and created a mount point:
Code:
$sudo mkdir /media/newhome
I then edited /etc/fstab to include the line:
Code:
/dev/hdb1 /media/newhome ext3 defaults 0 0
You will need to replace hdb1 with whatever drive label and partition you have.
Reboot and you should see newdrive on your desktop. Now is the most important step, we need to copy ALL of the contents of /home onto the new drive. Type this exactly:
Code:
$cd /home/
$find . -depth -print0 | cpio --null --sparse -pvd /media/newhome/
These commands are important to copy all of the hidden files, hard links and sym links. This command may take a while to run.
We are almost there.
Now edit /etc/fstab again, this time uncomment out your old /home by putting a # at the start of the line.
Now edit the line for your new drive to mount it to /home, here is mine:
Code:
/dev/hdb1 /home ext3 defaults 0 2
Save this and restart.
Your /home is now on your new drive. I then moved my Music and Video folders into the /home/username folder.
The last thing I did was to resize my / partition to use the rest of my 20GB drive. To do this I booted up using the Live CD and ran gparted again. I deleted the old /home partition and then moved my SWAP to one end of the drive. I then resized / to fill the rest of the 20GB.
Thats it.
I hope this HOWTO was useful. If you have any questions please ask and I will do my best to help.
Bookmarks