Move /home to another HD?

Brian Pitts brian at polibyte.com
Fri Mar 14 21:06:50 GMT 2008


Eric Weir wrote:
> I have a very slow system. One problem is that the the HD is small -- 10 
> GB -- and nearly full.
> 
> I have an extra HD on my Windows machine that I use only for backups. If 
> I moved the extra HD to my Ubuntu/Kubuntu machine could I move just my 
> /home folder to the second HD and use the first HD just for the 
> operating system and applications, e.g., so that data files are 
> routinely opened from and saved to the second HD, without my having to 
> constantly be navigating to and from it?
> 
> This is a stop-gap while I decide whether to go to the trouble of 
> upgrading my hardware -- new graphics/video processor, more RAM, larger 
> HD [which would be rendered unnecessary if the above is possible] -- or 
> buy a new machine with Ubuntu/Kubuntu already installed, and until I 
> make sure that my ducks are lined up financially.

Hi Eric,

There are different ways of doing this; I'll try to list all the steps I 
would take to accomplish it. I use double-quotes to mark the things you 
should type; you would not type the quotes themselves. Whenever I 
arbitrarily pick the output of a command, you should replace it with 
your own result when it's used later.

* Make sure you have the program parted installed by opening a terminal 
and running "which parted". If there is no output, run "sudo aptitude 
install parted"

* Turn off the computer

* Connect the new hard drive

* Turn on the computer. When you see the GRUB menu, select the entry 
that says recovery mode. If you don't normally see the GRUB menu, you 
may need to hit the escape key to see it

* Identify the new drive. To do this, run "for i in $(ls /dev/sd?); do 
fdisk -l $i; done" and look for the drive which has a partition of type 
HPFS/NTFS. For the rest of these instruction I'll call it /dev/sdz

* Partition the new drive by running "parted mklabel msdos /dev/sdz && 
parted mkpart logical ext2 0% 100% /dev/sdz"

* Format the new partition by running "mkfs.ext3 -c /dev/sdz1"

* Find the UUID of your new filesystem by running "vol_id --uuid 
/dev/sdz1". For the rest of these instructions I'll call it a-b-c-d-e

* Rename your current home directory by running "mv /home /oldhome"

* Make a mountpoint for your new home filesystem by running "mkdir /home"

* Tell Ubuntu to automatically mount your new home filesystem each time 
you boot by running "echo UUID=a-b-c-d-e /home ext3 defaults 0 2 >> 
/etc/fstab"

* Mount your new home filesystem now by running "mount -a"

* Verify that the mount was successful by running "mount | grep home". 
You should see "/dev/sdz1 on /home type ext3 (rw)"

* Copy the data from your old home to your new one by running "rsync -av 
/oldhome/ /home"

* Reboot by running "reboot"

* Once you're satisfied that you like the new arrangement, you can open 
a terminal and run "sudo rm -r /oldhome" to free the space taken by the 
old copy of home on your original drive.

I hope the above is helpful.

-Brian



More information about the Ubuntu-us-ga mailing list