More specifically, I want to have the user folder for my home account another disk that has more space, but keep my other smaller accounts on my ssd. I was able to copy my user folder to another disk, but now I need to link it to the home folder on my ssd, I want it accessible from a normal boot, and please don't tell me that what I did was not the best thing, I just want an answer. How do I get it to create a link that goes from /home/username to /extra-home/username and is recognised by the system when loading the user folders?

up vote 16 down vote accepted

Remember that your permissions will need to be the same. In addition to symlink, on more recent distros and filesystems, as root you can also use bind-mount:

mkdir /home/username mount --bind --verbose /extra-home/username /home/username

This is useful for allowing access "through" the /home directory to subdirs via daemons that are otherwise configured to avoid pathing through symlinks (apache, ftpd, etc.).

You have to remember (or init script) to bind upon restarts, of course.

  • I wasn't aware that symlinks could create such issues. How do such daemons treat /var/run/? – Paul May 16 '14 at 16:27
  • 1
    The servers are designed to restrict access to the local filesystem, to avoid compromising the system. You can think of this as "things allowed to remote users". They need not restrict themselves from accessing /var/run (typically at startup/shutdown) as "things allowed to this process". See Apache's FollowSymLinks directive for an example of how to allow the served filesystem to traverse symlinks, if desired. – Joe Atzberger Jun 3 '14 at 17:51
  • can we also expand /bin and /lib in the same way (can be useful in small filesystem) ? – ransh Jan 29 at 12:25
  • Does your system need /bin and /lib at initialization (i.e. before you can run the mount command)? If so, then you cannot employ this strategy. – Joe Atzberger Jan 31 at 21:43
  • 1
    Adding info here, as I had to search for it, once that is done to add init in /etc/fstab here is the form. When using the method Joe described mount --bind --verbose /extra-home/username /home/username, the line in /etc/fstab would be /extra-home/username /home/username none defaults,bind 0 0 – Wilken May 20 at 17:20

According to this question on Super User this is possible.

You can create a symbolic link using:

ln -s /extra-home/username /home/username

If it doesn't work for some reason you can just delete the symbolic link, move the directory back and reboot your computer.

  • If it's a simple folder you have to start with /media/{hardrive_name}/{your folder} I have just tried this on a debian server and it works. – answerSeeker Jan 13 '17 at 1:24

I would try this:

While logged in as a different user, in a root shell (e.g. sudo -i), copy over the contents of /home/username to /extra-home/username and make sure the new location is owned by username:

# cp -p /home/username /extra-home/
# chown username:username /extra-home/username

Move the original /home/username/ directory to a safe place:

# mv /home/username /root/

Create the symlink:

# ln -s /extra-home/username /home/username

Verify it's working as expected by opening another terminal window and running su:

$ sudo su username

If everything looks good, at least from the terminal (contents of /home/username/ appear as expected), then log out and log back in (I'm assuming you're on Ubuntu desktop) and it should be working normally. However, if it isn't, just delete the symlink and move the archived home folder back to its original location.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.