paapereira.xyz

Moving /home to another disk

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

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

More information about this subject, look up Ubuntu Documentation.

#Linux #Ubuntu