The goal of the post is to achieve moving the home directory into a newly added disk that has a dedicated Partition.
1. Add the new disk and create the necessary partition(for example sdb1).
2. Move the home folder into one of the partitions. To use a filesystem, it has to be mounted to the root filesystem at a mount point, the target directory such as /home.
3. First list the filesystem usage using the df command on the system.
# df -hl
4. Start by creating a new directory /srv/home where we can mount /dev/sdb1 for the time being.
# mkdir -p /srv/home # mount /dev/sdb1 /srv/home
5. Move the content of /home into /srv/home (so they will be practically stored in /dev/sdb1) using rsync command or cp command.
# rsync -av /home/* /srv/home/
OR
# cp -aR /home/* /srv/home/
6. After that, we will find the difference between the two directories using the diff tool, if all is well, continue to the next step.
# diff -r /home /srv/home
7. Now delete all the old content in the /home as follows.
# rm -rf /home/*
8. Next unmount /srv/home.
# umount /srv/home
9. Finally, we have to mount the filesystem /dev/sdb1 to /home for the mean time.
# mount /dev/sdb1 /home # ls -l /home
10. The above changes will last only for the current boot, add the line below in the /etc/fstab to make the changes permanent.
11. Use following command to get the partition UUID.
# blkid /dev/sdb1 /dev/sdb1: UUID="[ID]" TYPE="ext4" PARTLABEL="primary"
12. Once you know the partition UUID, open /etc/fstab file add the following line.
UUID=[ID] /home ext4 defaults 0 2
13. Run the following command to see that /home directory has been successfully moved into a dedicated partition.
# df -hl