Move /home/my-user to another partition question

So I want to free up some space to install a virtual machine on my SSD, but the only real good way to do that is to move my entire home folder to another partition off my SSD. What is the best way to do that? I can use rsync to copy all the files, and then I can go to an emergency TTY, but after that do I try to edit my fstab to directly mount /home/my-user or the entire /home directory in the new location, or do I simply make a symlink to the new location? Which is the better option? I intend to use timeshift to make periodic backups of my system so I wonder how it's going to cope with a symlinked /home.
P.S. I am the only user on this system.

EDIT: Also, would there be any problems if I tried to delete my current home partition before moving it to the new location? I don't know what would happen if I moved it before deleting the original.

mv /folder/on/ssd1 /folder/on/ssd2
ln -s /folder/on/ssd2 /folder/on/ssd1

Symbolic links are the quickest and easiest.

1 Like

I would not go for a symlink but move it for good and mount it via fstab.

You should use the root account from a console to do the move. Or boot into single user mode.

Proposal how to do it:

mv /home /oldhome 
rsync -aAhHxXv /oldhome /path/to/newhome 
mkdir /home
umount /path/to/newhome
mount drive-with-newhome /home

Of course you need to change fstab accordingly. To make the change persistent.

1 Like

Would it be safe to copy the same settings as my root partition in fstab? So that the added line becomes something like

UUID=939da3ad-ccf1-403a-96bf-b3bb7f0311c0    /run/media/kiko/Linux\040General/home    ext4    defaults,noatime,discard 0 1

My plan is to boot into text mode with this tutorial

Then delete my current /home folder, then make a new home dir with mkdir and add the above line into fstab. Does that sound good?

This wiki page tells you how to add /home to fstab

Don’t delete your old home before you have successfully rebooted.

Wait so does this mean the entire home folder should be on its own partition? Because I was planning on moving home to another partition where I also have a bunch of other folders around home.

If that is the case you can only use a symlink as @xircon suggested.

So I guess in that case I should first delete my original home folder before linking it to the new location? Or rather I suppose I could just rename it...

Using @mbod'd method? No need. Keep it for a while until you are sure eerything is OK, then get rid.

Even better to boot to a live cd and then do the moving/rsync; that way you can be sure that there is no possibility of something changing during the operations.

You should delete the discard option on all your entries and enable fstrim.timer.. For your new /home entry, change your <pass> number from 1 to 2.

I did not want to put home into its own partition where there's nothing else, so I went with the symlink option. I added the "3" to the linux line in grub before booting, then in TTY mode I renamed my old home and created a link to the new home which I had rsynced previously, I don't care if something small changes during the opration, it won't matter. So far it works, but unfortunately I'll have to make backups of my home folder myself now since timeshift does not copy the targets of symlinks.

But honestly it's performing slower than I'd hoped so I might end up going back on my decision and just install the virtual machine on my HDD again, even if it would be slower.

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