ZFS-MOUNT-GENERATOR(8)

NAME
zfs-mount-generator - generates systemd mount units for ZFS

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

DESCRIPTION
zfs-mount-generator implements the Generators Specification of systemd(1), and is called during early boot to generate systemd.mount(5) units for automatically mounted datasets. Mount ordering and dependencies are created for all tracked pools (see below). If a dataset has canmount=on and mountpoint set, the auto mount option will be set, and a dependency for local-fs.target on the mount will be created. Because zfs pools may not be available very early in the boot process, information on ZFS mountpoints must be stored separately. The output of the command

    zfs list -H -o name,mountpoint,canmount,atime,relatime,devices,exec,readonly,setuid,nbmand,encroot,keylocation

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 .

EXAMPLE
To begin, enable tracking for the pool:

    touch /etc/zfs/zfs-list.cache/POOLNAME

Then, enable the tracking ZEDLET:

    ln -s "/usr/libexec/zfs/zed.d/history_event-zfs-list-cacher.sh" "/etc/zfs/zed.d" systemctl enable zed.service systemctl restart zed.service

Force the running of the ZEDLET by setting canmount=on for at least one dataset in the pool:

    zfs set canmount=on DATASET

This forces an update to the stale cache file.

SEE ALSO
zfs(5) zfs-events(5) zed(8) zpool(5) systemd(1) systemd.target(5) systemd.special(7) systemd.mount(7)