Moving /home to second hdd


i’ve been trying to relocate my /home to a separate hard drive. i’ve followed a handful of walkthrus from various sources and so far i’ve managed to break the os 3 times. i’m not sure if what i’m looking at is outdated or what the problem is exactly, but it’s clear i need advice. i assumed there would be something on this subject already but i also failed to locate it within this forum.

can anyone steer me in the correct direction?

Welcome to the forum! :slight_smile:

First things first… Did you already create a new partition for /home on the other drive? If not, do so, and after you’ve created and formatted it, use lsblk to get the UUID of the partition. Alternatively, you can also set a LABEL in the filesystem upon creation, and use the LABEL in /etc/fstab, instead of the UUID. So long as the identifier for the partition is unique and persistent, which unfortunately the /dev/sd[alphabetic_char] designations are not if you have more than one hard drive. Either way, write down the UUID, as you’re going to need it.

Now, as for the move itself… Normally, you would do this from within single-user maintenance mode, which means that you must be completely logged out as an unprivileged user, and that no processes may be using the system beyond what is needed to have a root shell running.

sudo telinit 1

Edit: Better is to use… :arrow_down:

sudo systemctl isolate

… instead of telinit.

The system will now switch to a different, character-mode-only environment. Depending on the security settings, you may need to enter the root password, or you may be presented with a root prompt immediately after issuing the above command.

Now the move process begins… < insert scary music > :stuck_out_tongue:

First, you need to mount the new partition that is to become your home. Mount it at /mnt ─ that’s exactly the sort of thing /mnt exists for. Replace /dev/sdb1 in the example below by the actual drive and partition, and replace the filesystem ─ ext4 in the example below ─ by the one you’ve formatted the partition with ─ note: it must be a Linux-native filesystem (like e.g. ext4, xfs or btrfs) and not ntfs or something similar. :arrow_down:

mount -t ext4 -o sync /dev/sdb1 /mnt

Now, we’ll move over the contents of your current /home to the new partition… :arrow_down:

mv /home/* /mnt/ && sync

Depending on the bus speed and drive speed, the above process may take some time. When the moving has ended, the command prompt will return.

Now, we will edit /etc/fstab. This is what you needed that UUID for. :arrow_down:

nano /etc/fstab

If you already had /home on a separate partition before this move, then comment out the entry for that partition by putting a # in front of the line.

Add the following line to the file, substituting the fake UUID below by the one that you wrote down, and ext4 by the filesystem of your choice… :arrow_down:

UUID=some-really-long-string    /home      ext4   auto,nouser,defaults,nodev,relatime     0    0

Save the file with Ctrl+O ─ confirm the overwrite ─ and exit the editor with Ctrl+X.

Now, all you need to do is reboot, and the new partition will be mounted at /home:arrow_down:

systemctl reboot

Good luck! :slight_smile:


If you insist. :stuck_out_tongue_winking_eye: :hocho: :hocho: :hocho: :scream:

1 Like

@Aragorn, as much as i agree with your steps i just can’t help my self to suggest you to adapt to the systemd way of doing all those things because we’re using systemd in this millenium :rofl:


I moved chosen home folders to separate HDD and then symlinked them to my home folder. However, the home folder stayed in the same place, along with cache and configs.

You can move a whole /home to another location but you can’t do it when being logged in. You need to do it from live system and properly set your fstab file, or do what @Aragorn told you.

Which of the two do you think is easier/faster to type? :stuck_out_tongue:

Both same when using copy&paste :stuck_out_tongue:
(You didn’t expect to get same kind of answer didn’t you hahaha)

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.