ZFS-MOUNT-GENERATOR(8) System Manager's Manual ZFS-MOUNT-GENERATOR(8)

# [NAME](#NAME)

`zfs-mount-generator` — generate systemd mount units for ZFS filesystems

# [SYNOPSIS](#SYNOPSIS)

/usr/lib/systemd/system-generators/zfs-mount-generator

# [DESCRIPTION](#DESCRIPTION)

`zfs-mount-generator` is a [systemd.generator(7)](/man/os/zfs/systemd.generator.7) that generates native [systemd.mount(5)](/man/os/zfs/systemd.mount.5) units for configured ZFS datasets.

## [Properties](#Properties)

[**mountpoint**](#mountpoint)=

[Skipped if](#Skipped) [**legacy**](#legacy) or **none**.

[**canmount**](#canmount)=

[Skipped if](#Skipped~2) **off**. Skipped if only **noauto** datasets exist for a given mountpoint and there's more than one. Datasets with [**yes**](#yes) take precedence over ones with **noauto** for the same mountpoint. Sets logical *noauto* flag if **noauto**. Encryption roots always generate **zfs-load-key@**`root`**.service**, even if **off**.

[**atime**](#atime)=, **relatime**=, [**devices**](#devices)=, [**exec**](#exec)=, [**readonly**](#readonly)=, [**setuid**](#setuid)=, [**nbmand**](#nbmand)=

Used to generate mount options equivalent to `zfs` `mount`.

[**encroot**](#encroot)=, **keylocation**=

If the dataset is an encryption root, its mount unit will bind to **zfs-load-key@**`root`**.service**, with additional dependencies as follows:

[**keylocation**](#keylocation)=[**prompt**](#prompt)

None, uses [systemd-ask-password(1)](/man/os/zfs/systemd-ask-password.1)

[**keylocation**](#keylocation~2)=[**https://**](#https://)`URL` (et al.)

[**Wants**](#Wants)=, **After**=: network-online.target

[**keylocation**](#keylocation~3)=[**file://**](#file://)&lt;`path`&gt;

[**RequiresMountsFor**](#RequiresMountsFor)=`path`

The service also uses the same **Wants**=, **After**=, **Requires**=, and **RequiresMountsFor**=, as the mount unit.

[**org.openzfs.systemd:requires**](#org.openzfs.systemd:requires)=path\[ path]…

[Sets](#Sets) **Requires**= for the mount- and key-loading unit.

[**org.openzfs.systemd:requires-mounts-for**](#org.openzfs.systemd:requires-mounts-for)=path\[ path]…

[Sets](#Sets~2) **RequiresMountsFor**= for the mount- and key-loading unit.

[**org.openzfs.systemd:before**](#org.openzfs.systemd:before)=unit\[ unit]…

[Sets](#Sets~3) **Before**= for the mount unit.

[**org.openzfs.systemd:after**](#org.openzfs.systemd:after)=unit\[ unit]…

[Sets](#Sets~4) **After**= for the mount unit.

[**org.openzfs.systemd:wanted-by**](#org.openzfs.systemd:wanted-by)=unit\[ unit]…

Sets logical *noauto* flag (see below). If not **none**, sets **WantedBy**= for the mount unit.

[**org.openzfs.systemd:required-by**](#org.openzfs.systemd:required-by)=unit\[ unit]…

Sets logical *noauto* flag (see below). If not **none**, sets **RequiredBy**= for the mount unit.

[**org.openzfs.systemd:nofail**](#org.openzfs.systemd:nofail)=(unset)|**on**|**off**

Waxes or wanes strength of default reverse dependencies of the mount unit, see below.

[**org.openzfs.systemd:ignore**](#org.openzfs.systemd:ignore)=**on**|**off**

[Skip if](#Skip) **on**. Defaults to **off**.

## [Unit Ordering And Dependencies](#Unit_Ordering_And_Dependencies)

Additionally, unless the pool the dataset resides on is imported at generation time, both units gain **Wants**=zfs-import.target and **After**=zfs-import.target.

Additionally, unless the logical *noauto* flag is set, the mount unit gains a reverse-dependency for local-fs.target of strength

(unset)

[**WantedBy**](#WantedBy)= + **Before**=

[**on**](#on)

[**WantedBy**](#WantedBy~2)=

[**off**](#off)

[**RequiredBy**](#RequiredBy)= + **Before**=

## [Cache File](#Cache_File)

Because ZFS pools may not be available very early in the boot process, information on ZFS mountpoints must be stored separately. The output of

`zfs list -Ho name,⟨every property above in order⟩`

for datasets that should be mounted by systemd should be kept at /etc/zfs/zfs-list.cache/`poolname`, and, if writeable, will be kept synchronized for the entire pool by the history\_event-zfs-list-cacher.sh ZEDLET, if enabled (see [zed(8)](/man/os/zfs/zed.8)).

# [ENVIRONMENT](#ENVIRONMENT)

If the [**ZFS\_DEBUG**](#ZFS_DEBUG) environment variable is nonzero (or unset and /proc/cmdline contains "[**debug**](#debug)"), print summary accounting information at the end.

# [EXAMPLES](#EXAMPLES)

To begin, enable tracking for the pool:

`# touch /etc/zfs/zfs-list.cache/poolname`

Then enable the tracking ZEDLET:

`# ln -s /usr/lib/zfs/zed.d/history_event-zfs-list-cacher.sh /etc/zfs/zed.d`

`# systemctl enable zfs-zed.service`

`# systemctl restart zfs-zed.service`

If no history event is in the queue, inject one to ensure the ZEDLET runs to refresh the cache file by setting a monitored property somewhere on the pool:

`# zfs set relatime=off poolname/dset`

`# zfs inherit relatime poolname/dset`

To test the generator output:

`$ mkdir /tmp/zfs-mount-generator`

`$ /usr/lib/systemd/system-generators/zfs-mount-generator /tmp/zfs-mount-generator`

If the generated units are satisfactory, instruct `systemd` to re-run all generators:

`# systemctl daemon-reload`

# [SEE ALSO](#SEE_ALSO)

[systemd.mount(5)](/man/os/zfs/systemd.mount.5), [systemd.target(5)](/man/os/zfs/systemd.target.5), [zfs(5)](/man/os/zfs/zfs.5), [systemd.generator(7)](/man/os/zfs/systemd.generator.7), [systemd.special(7)](/man/os/zfs/systemd.special.7), [zed(8)](/man/os/zfs/zed.8), [zpool-events(8)](/man/os/zfs/zpool-events.8)

November 30, 2021 OpenZFS

---

Document: zfs-mount-generator(8) from zfs 2.4.4-r4 (Chainguard OS)
Source: https://github.com/openzfs/zfs
