Move system directory to other drive

For this example, i'm moving /home directory to another drive:

# enter in rescue mode
systemctl isolate rescue.target
# Mount the other drive
mount -t ext4 -o sync /dev/sdb1 /mnt
# move all data from /home/ folder to the other drive
# and ensure that all data are written to the disk
mv /home/* /mnt/ && sync
# fetch the uuid of the other drive
lsblk -o UUID,LABEL,MOUNTPOINT,SIZE /dev/sdb1

then in /etc/fstab, add a line to auto mount the other drive as /home directory

# /etc/fstab
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /home      ext4   auto,nouser,defaults,nodev,relatime     0    0

then reboot and voilĂ !

Last-Updated:

Content also available on gemini://kelgors.me/wiki/move-system-folder.gmi

More info about Gemini protocol