Move Home to 2nd drive

Nils Kassube kassube at gmx.net
Wed Dec 12 07:09:06 UTC 2007


NoOp wrote:
> Working on upgrading an very old system with a small hard drives. I did
> an upgrade from Feisty to Gusty. Prior to the upgrade the 1st (6Gb)
> drive had 2.2Gb free space on it. Afterwards it only has 1GB left (and
> that includes after removing fonts that I don't use, apt-get autoclean,
> apt-get autoremove, etc., etc.), so I added a second hard 7Gb hard
> drive.
>
> Second drive is in and working fine (ext3), now I'd like to move the
> Home directory to the 2nd hard drive so that I can free up space on the
> first drive. Any quick/easy command line suggestions on how to do this?

Mount your second drive to the /mnt directory. Then use the command

sudo cp -a /home/* /mnt

Now you have a copy of everything in your /home directory on the second 
drive's root directory. Then edit (as root) /etc/fstab and add a line

somedrivespec /home ext3 defaults 0 2

with somedrivespec replaced with the device name or UUID of the drive. Now 
logout and start a text console (Ctrl-Alt-F1). Login and enter these 
commands:

sudo umount /mnt
sudo mv /home /home.bak
sudo mount /home

Now you can logout and switch back to the graphical login screen with 
Ctrl-F7.

Please note: This is untested - if there is something wrong, you can undo 
the changes if you boot into recovery mode. Then delete the fstab line 
and replace the home directory with the command

mv /home.bak /home


Nils




More information about the ubuntu-users mailing list