Linux, can a home directory be symlinked

linuxsymbolic-linkUbuntu

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?

Best Answer

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.

Related Question