Help with moving /home to different partition

Hello, everyone!

I’m really new to Linux and Majaro, so I’ve been having a few issues with setting up my OS. I’ve partitioned my SSD for dualbooting previously, but I’ve formatted the Windows portion and converted it to an ext4 format. Since that partition is much larger than the one I’m currently using (900 gb vs 200gb) I wanted to migrate /home to it. I’d appreciate a bit of step by step instruction since I’m worried about messing up and losing my files (although I did back most of them up beforehand).

I’ve been using Aragorn’s tutorial, although I have a few questions about the process since I’m not used to modifying my system via terminal.

The first step is to go to terminal and use the lsblk command to check my hard drives. The disk I want to use is called sda and nvme0n1 contains the /home.

loop0         7:0    0     4K  1 loop /var/lib/snapd/snap/bare/5
loop1         7:1    0 164.8M  1 loop /var/lib/snapd/snap/gnome-3-28-1804/161
loop2         7:2    0  82.9M  1 loop /var/lib/snapd/snap/discord/130
loop3         7:3    0  65.2M  1 loop /var/lib/snapd/snap/gtk-common-themes/1519
loop4         7:4    0 249.6M  1 loop /var/lib/snapd/snap/brave/133
loop5         7:5    0  55.4M  1 loop /var/lib/snapd/snap/core18/2128
loop6         7:6    0 251.3M  1 loop /var/lib/snapd/snap/brave/134
loop7         7:7    0  32.4M  1 loop /var/lib/snapd/snap/snapd/13270
sda           8:0    0 931.5G  0 disk 
├─sda1        8:1    0   529M  0 part 
├─sda2        8:2    0    99M  0 part 
├─sda3        8:3    0    16M  0 part 
└─sda4        8:4    0 930.9G  0 part /run/media/symberzite/c8f38c00-5edd-4e61-864f-0bcc385d3211
nvme0n1     259:0    0 238.5G  0 disk 
└─nvme0n1p1 259:1    0 238.5G  0 part /

From here I can tell that the UUID of the target hard drive is c8f38c00-5edd-4e61-864f-0bcc385d3211. Obviously I wrote it down on a piece of paper. Afterwards I enter the mode that cancels all process beyond the root shell and some other basic programs via the following command:

sudo systemctl isolate

I’m a bit confused here because I wonder if I’ll still be able to look at the tutorial in this mode? Will I be able to copy-paste text in the last stage or should I write down all of the code from this point by hand? Anyway, then I type my administrator password and continue. The next stage is to mount the drive.

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

This part says to take the mount -t ext4 -o sync /dev/sdb1 /mnt command and replace /dev/sdb1 / with the actual name of the hard drive. I presume it will be /dev/sda4/ although I’d appreciate if someone would correct me on that.

After that I just use the mv /home/* /mnt/ && sync command to just move all of my files to the other partition. If all is done correctly, that’s the moment when I go and brew some coffee since the process may take a few minutes depending on my hard drive.

After that’s done I start to add stitches by going to the fstab file through the command

nano /etc/fstab

Here I have a few questions. First, to quote the tutorial.

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.

Is my current /home drive on a separate partition? If so, how do I check. Does my former dualboot system count as being on a separate partition? I don’t want to accidentally comment out the wrong line of code.

Then I go to the bottom of the file and just paste the following:

UUID=c8f38c00-5edd-4e61-864f-0bcc385d3211    /home      ext4   auto,nouser,defaults,nodev,relatime     0    0

The UUID being of the target drive from earlier. Afterwards I press Ctrl+O, then Ctrl+X to save then exit. After that’s done I go back to the terminal and systemctl reboot to restart my computer. If all is done correctly, the /home should be placed in a different partition, all files intact.

Apologies if I’m repeating the obvious, I’m just trying to idiot-proof myself. Some clarification would be appreciated. Also, if someone wants to tell the the specific commands I need to type to pull this off, that would be appreciated. Thanks in advance.

First logical error. :wink: /dev/sda is a drive. The partition on that drive that you wish to move /home to is /dev/sda4. :wink:

Negative. Single-user maintenance mode is text-mode-only and has no network connection.

That is wrong again. There is no such thing as /dev/sda4/mnt, because /dev/sda4 is a block device file, not a directory.

/dev/sda4 ─ without a trailing slash, because it’s a file, not a directory.

No, probably not.

mount | grep home

If it comes up empty, then your /home is still on the root filesystem.

Well, yes, of course; Windows was on a partition separate from the GNU/Linux system.

No, you first need to delete the contents of /home on the root filesystem, because you have already copied them over to /mnt, but now you have them in two different places.

/mnt is where the new partition which is to become the separate /home is temporarily mounted. So you need to empty the /home directory on the root partition before you reboot, in order to regain that space.

The commands are all in the tutorial. :wink: :arrow_down:

mount -t ext4 -o sync /dev/sda4 /mnt && ls -lA /mnt
cp -RPpv /home/* /mnt/ && sync
du -sh /mnt/ && du -sh /home/
nano /etc/fstab
rm -rf /home/*
systemctl reboot

Thanks a lot! I’ll try to clarify one last time just to fully idiot-proof myself.

/dev/sda is the drive with all partitions
/dev/sda4 is the partition where I want to move /home to
c8f38c00-5edd-yada-yada is the UUID of the partition, which later will be used in the fstab file

The first thing I should do is grab a piece of paper and write down all the commands and the UUID since the OS will switch to a text-only mode, so I won’t be able to boot it up during the process. Write everything in clear and understandable handwriting. Screenshot some of the information just to be safe.

When this is done I go to terminal and type

sudo systemctl isolate

This will terminate most processes and switch the system into a text-only mode. Afterwards I type

mount -t ext4 -o sync /dev/sda4 /mnt && ls -lA /mnt
cp -RPpv /home/* /mnt/ && sync
du -sh /mnt/ && du -sh /home/

This will mount /home to a different drive and copy the files to that location. The process should take some time depending on my hardware. After it’s finished I go to the fstab file.

nano /etc/fstab

I scroll down to the bottom of the file and write the following

UUID=c8f38c00-5edd-4e61-864f-0bcc385d3211    /home      ext4   auto,nouser,defaults,nodev,relatime     0    0

I presume the commands will snap to be in line with the rest of the data in the document. That is, I don’t need to press spacebar multiple times so it matches the length of the negative space. Write in the data, then I press Ctrl+O to save, then I press Ctrl+X to exit.

Back to the terminal screen

rm -rf /home/*
systemctl reboot

Then, hopefully, /home has been moved to the correct partition. Thanks a lot for the help, I just never did this before, so I’m taking every possible precaution.

1 Like


Screenshots won’t be of any use, because you don’t have a GUI in single-user mode ─ nor any network connection, for that matter.

But, if you own a smartphone, then you can use its browser to log into the forum and return to the tutorial ─ or for that matter, to this thread here. :wink:


Well, it doesn’t mount /home anywhere. It temporarily mounts the newly formatted partition to /mnt, so that you can copy over the contents of /home to the new partition.

Mind you, the directory /home will itself always remain on the root filesystem after the procedure, but its contents will then reside on the new partition, which ─ if you’ve entered the information in /etc/fstab correctly ─ will then be mounted to /home upon the next boot.

No, the fields in /etc/fstab must be whitespace-delimited, but this may be either spaces or tabs ─ or a combination of both.

The alignment doesn’t really matter other than for aesthetics, so long as the six fields are separated by whitespace.

Yes! :wink:

I understand it’s quite daunting for a newbie, but it also goes to show what the penguin can do, and after you’ve completed this maneuver, you’ll be able to pat yourself on the back for having learned something new. :wink:

1 Like

I started the process and after booting rescue mode it gave me the screen that said

You are in rescue mode. After logging in, type “journalctl -xb” to view system logs, “systemctl reboot” to reboot, “systemctl default” or “exit” to boot into default mode.

Cannot open access to console, root account is locked. See sulogin(8) man page for more details.

Press “Enter” to continue.

The issue is that my keyboard wasn’t responsive. Maybe it’s because I don’t have root access rights. How do I get root access? I have administrator privileges, but it doesn’t seem to be sufficient.

When you installed the system, you were asked to enter two passwords: one for your own account ─ which is also the password you use with sudo ─ and one for the root account. However, if I recall correctly, if you opt to use the same password for both, then the root account is disabled ─ in the same way as they also do that in Ubuntu and Mint ─ and then you won’t be able to get into single-user maintenance mode.

This is however easily remedied. Open up a terminal window and issue the following command… :arrow_down:

sudo su -

Now you are in a root shell, and so now you can set a proper password for the root account. :arrow_down:


You will be prompted for a password, and then normally once again, so as to make sure you didn’t make any typos.

It is this root password that you need to use for entering single-user maintenance mode when entering… :arrow_down:

sudo systemctl isolate

The sudo command here-above requires your own password, but when you see the text appear… :arrow_down:

Enter the root password or press Ctrl-D to continue.

… then this is where you need the root password.

Alright, so I managed to set the root password, but the rescue screen doesn’t seem to be working. Not that I can’t access the root functions, in the sense that it doesn’t seem to be registering my responses. I tried typing exit or reboot but no text would show up in the space below. Even Ctrl+D does nothing. I think the root terminal isn’t a fan of my keyboard.

Okay, then we’re going to have to change the strategy. I cannot help you with your keyboard problems, but it is possible to do the whole operation without going into single-user mode.

Just completely log out of your GUI environment as before ─ remember: you have to be looking at the login screen ─ and switch to a character-mode tty with Ctrl+Alt+F3, as before. Only now, instead of logging in as yourself and issuing the command to go to single-user mode, you must enter “root” at the login prompt, and enter the password you just set.

Then from there on, you can follow all the other steps ─ i.e. mounting the partition to /mnt, copying over the contents of /home, editing /etc/fstab, and so on ─ all with the same commands I gave you earlier. There won’t be any risk of any files being held open under /home, because you’re logged out of your GUI and you’re logged in as the root user.

1 Like

It worked! The only issue is that the process of moving files took an excessively long time. Around ~30 hours, although I’m not sure how much it’s to do with hardware since I have an SSD. That being said, I followed the instructions and now I’m on the larger partition.

Thanks a lot, you’re a real life saver!

1 Like

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