# Mounts order: ZFS, /etc/fstab...



## Bobi B. (Jul 2, 2016)

I'm running a small home server with /, /usr, /var, etc. on UFS (on a SSD) and a ZFS pool on a pair of HDDs. Since I also have an existing external NAS and run few jails, I'm searching for a documentation regarding FreeBSD mount order during boot time and I cannot find one. It seems /etc/fstab is processed first, ZFS mounts are next, but what to do if I want to mount a NFS export or do a nullfs-mount in a location in the ZFS pool in boot-time?

For example / is UFS (from /etc/fstab), /usr/jails is from ZFS and would like to mount NFS export at /usr/jails/pms/mnt/media during boot time?


----------



## Remington (Jul 2, 2016)

You will need to create or edit /etc/fstab.pms and it will be mounted when Jail starts.  It's much safer this way rather than editing /etc/fstab incorrectly could make your FreeBSD hang at boot.


----------



## Murph (Jul 2, 2016)

Try adding the late option to any filesystems that you need deferred until after normal mount order.  See mount(8).


----------



## Bobi B. (Jul 2, 2016)

Remington said:


> You will need to create or edit /etc/fstab.pms and it will be mounted when Jail starts.  It's much safer this way rather than editing /etc/fstab incorrectly could make your FreeBSD hang at boot.



Thank you, this is a good idea.



Murph said:


> Try adding the `late` option to any filesystems that you need deferred until after normal mount order.  See mount(8).



I saw `late` option, but it is not clear _at what time during boot process_ `mount` is executed with `-a` and when with `-l`; can you point me to the related documentation?


----------



## Murph (Jul 2, 2016)

Bobi B. said:


> I saw `late` option, but it is not clear _at what time during boot process_ `mount` is executed with `-a` and when with `-l`; can you point me to the related documentation?



Use `rcorder /etc/rc.d/*` to see the ordering.  /etc/rc.d/mountlate does the `mount -a -L` to mount them.


----------



## Snurg (Aug 29, 2016)

Remington said:


> .../etc/fstab.pms...


Great thing, probably better than the "late" mount option which solved my problem of the jail nullfs mounts happening before the ZFS mounts they depend on finished.
However, searching for fstab.pms yields me only one link, this forum page.
Is there any documentation available on this except of reading the source code?


----------



## Bobi B. (Aug 29, 2016)

Snurg, I believe this is more like /etc/fstab.<jail-name>.


----------



## Snurg (Aug 29, 2016)

Bobi B. said:


> Snurg, I believe this is more like /etc/fstab.<jail-name>.


I think you are right.
Sadly this does not work on my computer.
At least it works with the `late` option in the "main" fstab, so I can proceed learning how jails work.


----------

