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'd like to install Ubuntu on two drives, one with / and the other with /opt and /home. But I do not want /opt and /home to reside on separate partitions but on the same one. Is it possible to do during the installation?

share|improve this question

This is what I would do. Make a home partition, tell the installer to mount it to /home. After install and on first boot create a directory called /home/opt. Then mount bind it to /opt.

Make sure /opt is empty before you do this. I would think so if it's just after a fresh install.

mount -o bind /home/opt /opt

for a manual mount.

For mounting on boot, edit /etc/fstab it would look something like this. Make sure you add below your home mount, which the installer should have added.

/home/opt /opt none bind 0 0
share|improve this answer
thanks for the edits – strings Jan 7 '13 at 21:46

The LVM way

If you don't mind it being two different volumes, on one partition.

Create an Physical Volume on the drive you want to put the /home and /opt on. Create a Volume Group with just this partition as the single member of it. Give it a name, e.g. myvg. Then create two Logical Volumes, e.g. homes and opt, both will have a filesystem and the obvious mount points.


  • You can do snapshotting.
  • Resizing Logical Volumes is a piece of cake compared to resizing partitions.
  • Create more volumes without even touching the partition table on a running system.

In order to profit from this, you'll have to keep some free space in the Volume Group.


The installer will allow you to do this quite easily in the GUI. For 12.04 you'll need the alternative image, for 12.10 and onwards, this is included in the regular images.

share|improve this answer

It's pretty easy with bind mounts. That way, you can mount a subdirectory from one location on another location.

Just make "opt" a subdirectory in your "home" partition, then mount the partition to /home and bind mount /home/opt to /opt:

sudo mount /dev/sda4 /home
sudo mount --bind /home/opt /opt

Or it can be made permanent by adding them to /etc/fstab like this:

/dev/sda4   /home   ext4   defaults   0 2
/home/opt   /opt    none   bind       0 0

And if you prefer using UUIDs, replace /dev/sda4 with UUID=<your UUID>

share|improve this answer
What makes your answer different from the one of @strings? And I fail to see how this relates to the installation. – gertvdijk Jan 11 '13 at 2:40
Not much, from the looks of it. I'm afraid I wrote that before looking at the other answers very thoroughly. At any rate, maybe explaining the same thing 2 different ways isn't such a bad thing on – thomasrutter Jan 15 '13 at 2:07

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.