Server Fault is a question and answer site for system and network administrators. 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 automounting separate pools, that have nested mountpoints. I am using ZfsOnLinux 0.6.2.

The siuation currently is as follows:

zpool1      ---> /var
zpool1/log  ---> /var/log
zpool1/mail ---> /var/mail

Now I need to add a separate zpool for db. To keep directory hierarchy consistent, I thought about this:

zpool2      ---> /var/db

Now, the problem is that when zpool2 is mounted first, zpool1 fails to mount (this is logical).

Is there a way I can force the mount order of pools to allow mounting of zpool2 inside zpool1, besides using the legacy mount option? Something like zpools dependency? Or should I avoid such nested mounts at all costs?

share|improve this question
Good question. I'm not sure... – ewwhite Mar 31 '14 at 23:38
Maybe set the mount point to 'legacy' and add it to /etc/fstab, which mounts in the order given? Is this Ubuntu? – Mark Wagner Apr 1 '14 at 0:32
@MarkWagner, it's Gentoo. But I'd prefer not to use legacy mount options and benefit from zfs automounting... – Paweł Rumian Apr 1 '14 at 6:28
I fail at reading. Sorry. – Mark Wagner Apr 1 '14 at 17:04
up vote 4 down vote accepted

Instead of mounting zpool2 as /var/db, mount it as /zpool2 or /db or whatever makes sense for you.

Then make /var/db a symlink to /db.

share|improve this answer
Alternatively, do a bindmount instead of symlink; some software want some directories to be honest-to-goodness actual directories instead of symlinks. – pepoluan Apr 1 '14 at 3:29
A bind mount nets you the same problem - namely that /var has to be mounted before the bind mount can be created. – MikeyB Apr 1 '14 at 3:53
I was afraid this would be the only solution... I just thought about another workaround: creating datasets for all directories in /var, setting mountpoints for zpool1 and zpool2 to none and mounting only the datasets. Should this work? Of course the drawback is that I would need separate datasets for all directories in /var/... – Paweł Rumian Apr 1 '14 at 12:05
Why do you think symlinks are SO BAD? They're not. Stop obsessing over trying to get things perfect. – MikeyB Apr 1 '14 at 12:21
Yeah, I always tried to make things perfectly polished, and symlinks seemed to increase entropy ;) I guess you are right, though... – Paweł Rumian Apr 1 '14 at 13:22

You can set the file system mountpoint properties to legacy and use /etc/fstab to define them.

That way, you'll be able to define the order in which they will be mounted.

Edit: I just noticed you already considered the legacy approach. It might be the only one though.

share|improve this answer

Maybe using Root on ZFS could help.

I use ZFS on FreeBSD with two pools and nested mountpoints. The first pool (ssd) is the pool where root filesystem is located as are most of the other file systems. The second pool (hdd) is used for file systems with large data mounted to specific locations.

I believe because of the root filesystem all the file sytems from the ssd pool are mounted first and the filesystems from the hdd pool are mounted second.

I have never had problems with this setup. However this is a production server and I am not restarting it too often.

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.