Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 am planning to install Ubuntu on a new laptop soon. I want to put /opt and /usr/local directories separately from the root and home partitions, but I don't need two partitions for them, just one.

Is it possible to put these two directories on a single separate partition, preferably without using soft-links? Following a soft-link requires path resolution, so I don't think it's a good idea to soft-link commonly-accessed top-level directories.

share|improve this question
up vote 2 down vote accepted

I wouldn't say that symlink is a problem. It's already very bad if a symlink lookup affects the performance too much :) Also you may expect that it's cached, in a way that it won't be read from the disk each time, if it's really a "commonly-accessed" directory. But I think, /opt and /usr/local is not so much used on a standard Ubuntu install, /usr/local is used more for your own stuffs you compile from source (this is not the correct definition but usually this is the case), while /opt is used for "optional" softwares. But not so much softwares are installed there normally on Ubuntu, maybe some Google softwares for example, if I want to find an example. Anyway, even if these directories are heavily used, I wouldn't say that a symlink would mean lots of differencies, I would not worry if I were you.

You have another choice as well. Let's say you have a separated filesystem for /opt and /usr/local, for example /dev/sda6. Mount it as /opt. Create a directory inside /opt, let's say it's usrlocal. Then you can use VFS bind to "mount a directory" (not so correct notion technically but never mind ...) this way:

mount --bind /opt/usrlocal /usr/local

Of course you can put this into your /etc/fstab too, so you don't need to do this manually with a line like this in your /etc/fstab:

/opt/usrlocal /usr/local none bind 0 0

share|improve this answer
I find that dynamically linked software following linux standards tend to use /usr/local, while statically linked and self-contained packages tend to use /opt. – djeikyb Feb 17 '11 at 11:01
Well, it's sometime a bit confusing, there are opinions in the "UNIX world in general" (I am administrator of Solaris servers too) and on Linux too, also it's not always working this way (even not only on Linux), like google chrome is in /opt, but still it's not statically linked. What I meant with that description in my answer: sometimes people just make a symlink that /opt and /usr/local is the same. Maybe it's not the wisest thing to do, that's why then I talked about the bind solution instead. – LGB Feb 17 '11 at 12:25

There's "mount-binding" where you mount one directory on another. E.g. if your second partition is mounted on /mnt/other, and you've created directories home, opt and local in it, then you can use mount like this

mount -obind /mnt/other/home /home

The corresponding fstab entry would be

/mnt/other/home /home none bind 0 0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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