ZFS-MOUNT-GENERATOR(8)
β¨ NAME β¨
zfs-mount-generator β she generates systemd mount units for ZFS π
(also hiii, this one lives in section 8 of the System Manager's Manual, aka the admin-commands girlies π«Ά)
πΈ SYNOPSIS πΈ
/usr/lib/systemd/system-generators/zfs-mount-generator
π¦ DESCRIPTION π¦
okay so zfs-mount-generator implements the Generators Specification of systemd(1), and she gets called during early boot to generate systemd.mount(5) units for datasets that get automatically mounted. Mount ordering and dependencies get created for all tracked pools (see below, bestie, keep scrolling π).
π ENCRYPTION KEYS π
- If the dataset is an encryption root, a service that loads the associated key gets created β either from a file, or through a
systemd-ask-password(1)prompt. ποΈ - That service
RequiresMountsForthe path of the key (if it's file-based). - It also copies the mount unit's
After,Beforeand β¦ and ngl, the original text literally stops mid-sentence right there π
fr fr, the raw manpage says: "This service RequiresMountsFor the path of the key (if file-based) and also copies the mount unit's After, Before and Additionally, unless the logical flag is set, the mount unit gains a reverse-dependency for of strength" β I am not inventing anything to fill that gap, so there it is in all its unhinged glory π
Because ZFS pools may not be available very early in the boot process, information on ZFS mountpoints has to be stored separately. The output of the command
zfs list -H -o name,mountpoint,canmount,atime,relatime,devices,exec,readonly,setuid,nbmand,encroot,keylocation,org.openzfs.systemd:requires,org.openzfs.systemd:requires-mounts-for,org.openzfs.systemd:before,org.openzfs.systemd:after,org.openzfs.systemd:wanted-by,org.openzfs.systemd:required-by,org.openzfs.systemd:nofail,org.openzfs.systemd:ignore
for datasets that should be mounted by systemd, should be kept separate from the pool, at
/etc/zfs/zfs-list.cache/POOLNAME
The cache file, if writeable, will be kept synchronized with the pool state by the ZEDLET
history_event-zfs-list-cacher.sh .
π PROPERTIES π
The behavior of the generator script can be influenced by the following dataset properties, bestie:
canmount=on|off|noautoβ if a dataset hasmountpointset andcanmountis notoff, a mount unit gets generated. And additionally, ifcanmountison, thenlocal-fs.targetgains a dependency on that mount unit.
This behavior is equal to the auto and noauto legacy mount options, see systemd.mount(5).
Encryption roots always generate a key-load service, even for canmount=off. periodt.
org.openzfs.systemd:requires-mounts-for=path...β space-separated list of mountpoints that have to be mounted for this mount unit.org.openzfs.systemd:before=unit...β the mount unit and its associated key-load service will be ordered before this space-separated list of units.org.openzfs.systemd:after=unit...β the mount unit and its associated key-load service will be ordered after this space-separated list of units.org.openzfs.systemd:wanted-by=unit...β space-separated list of units that gain aWantsdependency on this mount unit. Setting this property impliesnoauto.org.openzfs.systemd:required-by=unit...β space-separated list of units that gain aRequiresdependency on this mount unit. Setting this property impliesnoauto.org.openzfs.systemd:nofail=unset|on|offβ toggles between aWantsandRequirestype of dependency between the mount unit andlocal-fs.target, ifnoautoisn't set or implied.on: mount will beWantedBy local-fs.targetoff: mount will beBeforeandRequiredBy local-fs.targetunset: mount will beBeforeandWantedBy local-fs.target
org.openzfs.systemd:ignore=on|offβ if set toon, do not generate a mount unit for this dataset. π«
See also systemd.mount(5).
π EXAMPLE π
To begin, enable tracking for the pool:
touch /etc/zfs/zfs-list.cache/POOLNAME
Then, enable the tracking ZEDLET:
ln -s "/usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh" "/etc/zfs/zed.d"
systemctl enable zfs-zed.service
systemctl restart zfs-zed.service
Force the running of the ZEDLET by setting a monitored property, e.g. canmount, for at least one dataset in the pool:
zfs set canmount=on DATASET
This forces an update to the stale cache file. slay. β¨
To test the generator output, run
/usr/lib/systemd/system-generators/zfs-mount-generator /tmp/zfs-mount-generator . .
This will generate units and dependencies in /tmp/zfs-mount-generator for you to inspect them. The second and third argument are ignored.
If you're satisfied with the generated units, instruct systemd to re-run all generators:
systemctl daemon-reload
π SEE ALSO π
zfs(5) zfs-events(5) zed(8) zpool(5) systemd(1) systemd.target(5) systemd.special(7) systemd.mount(7)
and that's the whole page, bestie π«Ά this icon was brought to you by OpenZFS, dated Aug 24, 2020 β go forth and mount responsibly πβ¨ππ¦
π¦ where this page comes from
- ubuntu questing: zfsutils-linux 2.3.4-1ubuntu2
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5 Β· CDDL-1.0
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5.1 Β· CDDL-1.0
- ubuntu stonking: zfsutils-linux 2.4.4-1ubuntu4 Β· CDDL-1.0
- π the page's license: MIT
- Copyright 2018 Antonio Russo <antonio.e.russo@gmail.com>
- Copyright 2019 Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
- Copyright 2020 InsanePrawn <insane.prawny@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms