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?
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?
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.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.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:
Or it can be made permanent by adding them to
/etc/fstab
like this:And if you prefer using UUIDs, replace
/dev/sda4
withUUID=<your UUID>
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
andopt
, both will have a filesystem and the obvious mount points.Advantages:
In order to profit from this, you'll have to keep some free space in the Volume Group.
How?
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.