Moving /home to another disk

2011/10/05 by Paulo Pereira

~/categories/Linux #Linux #Ubuntu

I have two hard drives in my computer: one with the / partition and the swap partition, and another with the /home partition.

The hard drive with the /home partition was getting full, so I bought another one.

Here’s what I did to move the /home partition to the new hard drive:

B3 Server

sudo blkid
/dev/sdb5: UUID="**aa111aaa-1122-aaaa-9999-cccc44447777**" TYPE="ext4"
sudo cp /etc/fstab/etc/fstab.$(date +%Y-%m-%d)
sudo mkdir /media/home
gksu gedit /etc/fstab
UUID=**aa111aaa-1122-aaaa-9999-cccc44447777** /media/home    ext4          nodev,nosuid       0       2
sudo mount -a
sudo rsync -axS --exclude='/*/.gvfs' /home/. /media/home/.
sudo diff -r /home /media/home > ~/diff.txt
gedit ~/diff.txt
UUID=**aa111aaa-1122-aaaa-9999-cccc44447777** /home ext4 nodev,nosuid 0 2
cd / && sudo mv /home /old_home && cd / && sudo mkdir -p /home
cd /
sudo rm -r /old_home

More information about this subject, look up Ubuntu Documentation.