Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem with binding two directories. The problem comes that storage on hard disk is almost run out and I install another disk moving files in ~/Documents/ into one folder of the new disk. I still want mount --bind folder_on_new_disk ~/Documents, thus I will not change my favor.

The problem is that could I add an item in /etc/fstab to achieve this automatically when system startup?

share|improve this question
up vote 13 down vote accepted

You can add this to fstab as follows:

/mnt/new_disk/folder /home/[username]/Documents    none    bind    0 0

Replace the correct folder name, and the username where the documents folder is. It also presumes the /home directory is where your user folders are, so adjust accordingly if not.

share|improve this answer

@Paul's fstab example is, basically, the way to go if you want an answer to the question as asked. However, I would suggest that unless you have specific reasons for only moving your documents, it might not be a bad idea to move the whole /home directory to the new disk, and use the same technique to bind /home to its new location (or even just move /home/* to the root of a partition on the new drive and mount that partition at /home). This will provide two major benefits:

  1. You are likely to get more space for your home directory.
  2. You completely separate the operating system, system-wide configuration files and application binaries from your own files.

The point on separation to me is the bigger issue: it means that if you need to reinstall the OS for some reason, you won't have to worry anywhere near as much about your personal files (e-mails, documents, music, etc etc).

Unix mount points are a very flexible construct - do take advantage of that.

share|improve this answer
Thanks, very constructive.:) – Summer_More_More_Tea May 29 '12 at 8:18

You must log in to answer this question.

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