11

I have a second large storage hdd mounted in Ubuntu in /media/storage. I would like my home directories for me and all future users of the system to be located on this storage drive as well.

I was thinking that the easiest way to accomplish this was to move /home to /media/storage/home and then create a symlink so that /home points to /media/storage/home. Would this work okay?

The only reason I ask, is because I know that a users home directory has a lot of special configuration information stored in it, so I didn't know if this would screw up anything on the system.

Are there any better alternative methods to relocating the home directory?

1

2 Answers 2

9

What you describe is one strategy that will work.

Another would be mounting the drive at /home directly, instead of at /media/storage. If you did this you'd probably want to move any existing data into other folders so you don't end up with extra /home/foo subdirectories.

The main potential problem with both strategies is that no home directories will be available if mounting the storage drive fails for some reason. If that happens, the symlink strategy will probably fail harder; the direct-mount strategy will leave an actual directory, so programs that attempt to access /home/foo will fail, but simply accessing /home will still succeed.

7
  • 1
    And if you have the /home/foo directories hidden by the mount, if the disk ever fails, people will still be able to login. Especially for graphical logins, inability to write to a users home directory means that they can't login.
    – KeithB
    Commented Feb 10, 2010 at 19:23
  • 2
    @KeithB: yes. you could leave skeletal home directories to be hidden by the mount, although that might not be the optimal choice. it becomes a question of whether you'd want the user to login with a restricted, basic configuration, or whether you'd want the logins to fail so you know to fix the problem. (i thought about making that point in the answer, but it opens up other cans of worms that are a little tangential to the issue at hand.) Commented Feb 10, 2010 at 19:29
  • Okay so I guess my biggest concern is that if my storage drive fails, that /home will not be accessible. The main reason that I want my /home directories on a different drive that the primary OS drive/partition is that my primary drive that the OS is installed on is only like 100 gigs and between multiple users filling up their home directories, that will fill up fast. So having /home on the much larger storage drive would be much better. Is there anyway to have some sort of cascading setup where if /home is on a separate drive that fails to mount, it looks for it elsewhere? Commented Feb 10, 2010 at 19:36
  • @Jakobud: it sounds possible but i don't know of an existing solution for that; might need custom scripting to implement. i wouldn't worry about it; you've got good reasons to make this change, and in the event of a mount failure, i'd probably want the system to idle (with logins disallowed or basically useless) until i could handle it manually. Commented Feb 10, 2010 at 19:58
  • you could also look into a solution like LVM that would allow you to have the /home directories to take up space on both drives, but applying LVM to a non-LVM system basically means reinstalling, so it would be some work. if this is for home use, don't worry about it; if for a commercial server, an LVM strategy might be worth considering. Commented Feb 10, 2010 at 20:01
4

Instead of symlinking the whole /home dir to someplace else (say /media/storage/home), create symlinks for every user separately and leave your admin account unlinked so admin can always login

/home/admin is /home/admin

/home/billy is linked to /media/storage/home/billy

2
  • 1
    are there actually any distributions using /home/admin istead of /root as the homefolder for root? either way i think it would still be easier to simply move the admins ~/ somewhere else than creating a symlink for each user.
    – Baarn
    Commented Jan 31, 2012 at 0:51
  • admin is likely an account with admin priviliges and the ability to login remotely (while direct root login is likely blocked and thus insufficient for recovery purposes). Commented Dec 15, 2016 at 19:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .