Migrate /home in Ubuntu

Sadly Ubuntu does not have LVM enabled in the default install, as this whole issue would be solved with a simple pvmigrate and lvresize...

My /home (which is on a separate /dev/sda5 partition) is filling up.
The availability of Steam on Linux gave it the final blow: it's time to bring in another partition.
As I don't want to commit a whole partition to /home, I've mounted /dev/sdc2 as /space and I'm going to create a symlink to an home subdirectory.

First, boot Ubuntu in rescue mode and select root shell.

Mount all filesystems

#mount -a

note that mounted filesystem won't be visible with a df, but you should cat /proc/mounts to see them
Set proper permission to the new partition

#chown root:root /space
#chmod 755 /space

Then create the new home and copy the old one

#mkdir /space/home
#cp -a /home/* /space/home/

Mount / read/write as we'll need to modify the fstab

#mount / -o rw,remount
#vi /etc/fstab

Comment the old /home
Remove the old home mount point and create the new symlink

#umount /home
#rmdir /home
#ls -s /space/home /home


No comments:

Post a Comment