Similar questions have been asked before. The closest appears to be How to mount multiple directories on the same partition? where this currently accepted answer suggests that it can be in two ways:
Using four _symbolic links: in the root filesystem, pointing to four individual subtrees on the second disk, which itself is mounted once to a mount point independent of the four directories.
Using bind mounts (available since Linux 2.4) to mount four individual subtrees on the second disk to the four directories, after the second disk is first mounted to a mount point independent of the four directories.
The same answer has an interesting comment which points to this Q&A discussing pros and cons of symbolic links vs bind mounts. From this, one would conclude that symbolic links should be preferred, because they're easier to see and maintain and will cause no trouble with any existing software.
However, systemd
has an explicit dependency configuration feature called RequiresMountsFor
. E.g. the standard Debian 8 (Jessie) uses it to make some services wait for potential mounts of /var
, which needs to be available for the services in question.
systemd
's RequiresMountsFor
will only work with bind mounts; not with symbolic links.
At least the Debian 8 systemd
service configuration files in question are located in /lib/systemd
so they are not meant to be modified. This suggests that bind mounts should be preferred if you use a Linux distribution which introduces such systemd
dependencies. Modifying the systemd
configuration of the Linux distribution may turn system maintenance into a nightmare.
The presence of systemd
itself, on the other hand, does not constitute a pro or con point for the choice between symbolic links and bind mounts.
/var
to be available is made insystemd
config files located in/lib/systemd
, not in/etc/systemd
. I guess changing these Debian distro files will turn system updates into a nightmare. So although I had a slight preference in favour of symbolic links, this changed since I don't want to be at the maintainer's mercy. – Run CMD Nov 09 '15 at 13:02/etc/fstab
is nice. another way to do it without specifying explicit size is with btrfs subvolumes. – mikeserv Nov 09 '15 at 13:40--bind
mounts is incorrect.mount --bind dir1 dir2
is only one way tomount --bind
. a linux kernel maintains an entire mount propagation tree, and mounts can be specified per process, per path, per user, or many combinations thereof. its whysystemd
wants--bind
mounts in the first place (besides the mount being more secure, that is). – mikeserv Nov 09 '15 at 13:50systemd
is, in itself, a point on favour of bind mounts? – Run CMD Nov 09 '15 at 13:55