23.7 Move Home from Root
20190325 The use case here is a common scenario where a
system has been set up with the users
/home folders on the
same partition as root which is
/. As users store more data
the partition can fill up, causing issues for the system.
Before continue with this procedure it is a good idea to backup your home folder, perhaps to a handy USB drive or to your cloud storage account.
Suppose we have the disk device
/dev/sda1 mounted as
/etc/fstab). Another partition on that same disk
/dev/sda2) is available with plenty of free space. The goal
is to migrate
We begin by synchronising the current
/home across to
/dev/sda2 after mounting the latter onto
$ sudo mount /dev/sda2 /mnt $ sudo rsync -avzh /home/ /mnt/ $ sudo umount /mnt
Obtain the new disk partition’s universally unique identifier (UUID). This will be used in the
file to mount the partition by default onto
$ sudo -i blkid | grep sda2 /dev/sda2: LABEL="mondo" UUID="c6aa7b6a-54a2-504e-8532-bd4f2d654896" TYPE="ext4" ...
/etc/fstab to add the following line to the end of the
file, save the file, mount and check that it is correctly mounted:
$ sudo gedit /etc/fstab UUID=c6aa7b6a-54a2-504e-8532-bd4f2d654896 /home ext4 defaults,errors=remount-ro,noatime 0 0 $ sudo mount /home $ cd $ df -h . Filesystem Size Used Avail Use% Mounted on /dev/sda2 482G 1.5G 456G 1% /home
Determine all is okay, perhaps by logging out and back in, or by
rebooting the machine and loging in and checking various files. Once
everything is fine remove the old
$ cd / $ sudo umount /home $ df -h home/ Confirm it is the old disk device and not the new one. $ sudo rm -rf home $ sudo mount /home $ df -h home/ Confirm it is the new disk device.
Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.