Relocate /home directory

For a mail server I am considering having the /home directory on its own (virtual) drive for the purposes of virtual machine backups. (If I need to rollback the OS drive for some reason, I would like newer-than-the-last-backup mail still to be there.)

For reasons that will jump out at the types of folks who look at this forum but may be obscure to me, is it better to do something like:

mv /home/* to a /mnt/home/
ln -s /mnt/home /home

Or to mess with files like these (if they do what they look like):

/etc/webmin/useradmin/config:home_base=/home
/etc/webmin/virtual-server/config:home_base=/home

(Or something in the web-interface maybe?)

Thanks.

SYSTEM INFORMATION
OS type and version Ubuntu 24.04.2
Virtualmin version 7.30.8

The Virtualmin Configuration has a setting

Thank you. I did look under the “Home directory…” pulldown, for the record.

1 Like

or you could mount your other file system/drive on /home – no LN or MV would be needed then (well, for future user creations, current user home directories would need to be copied over somehow)

one of my RedHat servers has this in /etc/fstab to mount a LVM volume

/dev/mapper/vghome-lvhome /home ext4 grpquota,usrquota,rw 0 1

1 Like

You should not do that (change the path for user homes). You also should not link, symbolic or otherwise.

You should copy the files, and remount the new home on /home. Always. There is never a good reason to do the other thing.

1 Like

I would never do it myself (op was asking for a setting in ui), never had the need.
Maybe that a dangerous setting then?

So adding:

UUID=80fff7c1-184e-5d49-bb4d-28963bg7f4e /mnt/home ext4 defaults,usrquota,grpquota 0 2

to fstab and then changing System Settings -> Virtuamin Configuration -> Defaults for new domains -> Home directory base to /mnt/home

is bad.

But something like:

rsync -av /home/ /mnt/home/

and then changing the fstab to:

UUID=80fff7c1-184e-5d49-bb4d-28963bg7f4e /home ext4 defaults,usrquota,grpquota 0 2

(and leaving “Home directory base” as /home)

is good.

Right?

Yes. Put homes in /home, and don’t go trying to convince the system that homes live somewhere else. Most things are smart enough to check for where the user home actually is and changing it won’t be a problem, but “most” is not “all”. Also, you’re going to forget, at some point, that you did something weird on this system and you’ll mess up a backup path or something in a script. So don’t do anything weird.

Put things where they usually go and you don’t have to think about all the special cases. Some day, you’re going to be tired/stressed and in a hurry and thinking about all the special cases will bite you in the ass. It’s like the advice, “if you always tell the truth, you don’t have to keep up with all the lies”. If your systems all look alike, you don’t need to keep up with all the weird stuff.

It takes less than half a dozen commands and a few minutes to do it the right way. No reason to make your system an invitation to a bad day.

1 Like

Preach.

I know first-hand trauma wisdom when I hear it. Thanks.

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