1eda14cbcSMatt Macy.\" 2eda14cbcSMatt Macy.\" Copyright 2018 Antonio Russo <antonio.e.russo@gmail.com> 3eda14cbcSMatt Macy.\" Copyright 2019 Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl> 4eda14cbcSMatt Macy.\" Copyright 2020 InsanePrawn <insane.prawny@gmail.com> 5eda14cbcSMatt Macy.\" 6eda14cbcSMatt Macy.\" Permission is hereby granted, free of charge, to any person obtaining 7eda14cbcSMatt Macy.\" a copy of this software and associated documentation files (the 8eda14cbcSMatt Macy.\" "Software"), to deal in the Software without restriction, including 9eda14cbcSMatt Macy.\" without limitation the rights to use, copy, modify, merge, publish, 10eda14cbcSMatt Macy.\" distribute, sublicense, and/or sell copies of the Software, and to 11eda14cbcSMatt Macy.\" permit persons to whom the Software is furnished to do so, subject to 12eda14cbcSMatt Macy.\" the following conditions: 13eda14cbcSMatt Macy.\" 14eda14cbcSMatt Macy.\" The above copyright notice and this permission notice shall be 15eda14cbcSMatt Macy.\" included in all copies or substantial portions of the Software. 16eda14cbcSMatt Macy.\" 17eda14cbcSMatt Macy.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18eda14cbcSMatt Macy.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19eda14cbcSMatt Macy.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20eda14cbcSMatt Macy.\" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21eda14cbcSMatt Macy.\" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22eda14cbcSMatt Macy.\" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23eda14cbcSMatt Macy.\" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2416038816SMartin Matuska.\" 2516038816SMartin Matuska.Dd May 31, 2021 2616038816SMartin Matuska.Dt ZFS-MOUNT-GENERATOR 8 2716038816SMartin Matuska.Os 28eda14cbcSMatt Macy. 2916038816SMartin Matuska.Sh NAME 3016038816SMartin Matuska.Nm zfs-mount-generator 3116038816SMartin Matuska.Nd generate systemd mount units for ZFS filesystems 3216038816SMartin Matuska.Sh SYNOPSIS 3316038816SMartin Matuska.Pa @systemdgeneratordir@/zfs-mount-generator 3416038816SMartin Matuska. 3516038816SMartin Matuska.Sh DESCRIPTION 3616038816SMartin Matuska.Nm 3716038816SMartin Matuskais a 3816038816SMartin Matuska.Xr systemd.generator 7 3916038816SMartin Matuskathat generates native 4016038816SMartin Matuska.Xr systemd.mount 5 4116038816SMartin Matuskaunits for configured ZFS datasets. 4216038816SMartin Matuska. 4316038816SMartin Matuska.Ss Properties 4416038816SMartin Matuska.Bl -tag -compact -width "org.openzfs.systemd:required-by=unit[ unit]…" 4516038816SMartin Matuska.It Sy mountpoint Ns = 4616038816SMartin Matuska.No Skipped if Sy legacy No or Sy none . 4716038816SMartin Matuska. 4816038816SMartin Matuska.It Sy canmount Ns = 4916038816SMartin Matuska.No Skipped if Sy off . 5016038816SMartin Matuska.No Skipped if only Sy noauto 5116038816SMartin Matuskadatasets exist for a given mountpoint and there's more than one. 5216038816SMartin Matuska.No Datasets with Sy yes No take precedence over ones with Sy noauto No for the same mountpoint . 5316038816SMartin Matuska.No Sets logical Em noauto No flag if Sy noauto . 5416038816SMartin MatuskaEncryption roots always generate 5516038816SMartin Matuska.Sy zfs-load-key@ Ns Ar root Ns Sy .service , 5616038816SMartin Matuskaeven if 5716038816SMartin Matuska.Sy off . 5816038816SMartin Matuska. 5916038816SMartin Matuska.It Sy atime Ns = , Sy relatime Ns = , Sy devices Ns = , Sy exec Ns = , Sy readonly Ns = , Sy setuid Ns = , Sy nbmand Ns = 6016038816SMartin MatuskaUsed to generate mount options equivalent to 6116038816SMartin Matuska.Nm zfs Cm mount . 6216038816SMartin Matuska. 6316038816SMartin Matuska.It Sy encroot Ns = , Sy keylocation Ns = 6416038816SMartin MatuskaIf the dataset is an encryption root, its mount unit will bind to 6516038816SMartin Matuska.Sy zfs-load-key@ Ns Ar root Ns Sy .service , 6616038816SMartin Matuskawith additional dependencies as follows: 6716038816SMartin Matuska.Bl -tag -compact -offset Ds -width "keylocation=https://URL (et al.)" 6816038816SMartin Matuska.It Sy keylocation Ns = Ns Sy prompt 6916038816SMartin MatuskaNone, uses 7016038816SMartin Matuska.Xr systemd-ask-password 1 7116038816SMartin Matuska.It Sy keylocation Ns = Ns Sy https:// Ns Ar URL Pq et al.\& 7216038816SMartin Matuska.Sy Wants Ns = , Sy After Ns = : Pa network-online.target 7316038816SMartin Matuska.It Sy keylocation Ns = Ns Sy file:// Ns < Ns Ar path Ns > 7416038816SMartin Matuska.Sy RequiresMountsFor Ns = Ns Ar path 7516038816SMartin Matuska.El 7616038816SMartin Matuska. 7716038816SMartin MatuskaThe service also uses the same 7816038816SMartin Matuska.Sy Wants Ns = , 7916038816SMartin Matuska.Sy After Ns = , 8016038816SMartin Matuska.Sy Requires Ns = , No and 8116038816SMartin Matuska.Sy RequiresMountsFor Ns = , 8216038816SMartin Matuskaas the mount unit. 8316038816SMartin Matuska. 8416038816SMartin Matuska.It Sy org.openzfs.systemd:requires Ns = Ns Pa path Ns Oo " " Ns Pa path Oc Ns … 8516038816SMartin Matuska.No Sets Sy Requires Ns = for the mount- and key-loading unit. 8616038816SMartin Matuska. 8716038816SMartin Matuska.It Sy org.openzfs.systemd:requires-mounts-for Ns = Ns Pa path Ns Oo " " Ns Pa path Oc Ns … 8816038816SMartin Matuska.No Sets Sy RequiresMountsFor Ns = for the mount- and key-loading unit. 8916038816SMartin Matuska. 9016038816SMartin Matuska.It Sy org.openzfs.systemd:before Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns … 9116038816SMartin Matuska.No Sets Sy Before Ns = for the mount unit. 9216038816SMartin Matuska. 9316038816SMartin Matuska.It Sy org.openzfs.systemd:after Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns … 9416038816SMartin Matuska.No Sets Sy After Ns = for the mount unit. 9516038816SMartin Matuska. 9616038816SMartin Matuska.It Sy org.openzfs.systemd:wanted-by Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns … 9716038816SMartin Matuska.No Sets logical Em noauto No flag (see below) . 9816038816SMartin Matuska.No If not Sy none , No sets Sy WantedBy Ns = for the mount unit. 9916038816SMartin Matuska.It Sy org.openzfs.systemd:required-by Ns = Ns Pa unit Ns Oo " " Ns Pa unit Oc Ns … 10016038816SMartin Matuska.No Sets logical Em noauto No flag (see below) . 10116038816SMartin Matuska.No If not Sy none , No sets Sy RequiredBy Ns = for the mount unit. 10216038816SMartin Matuska. 10316038816SMartin Matuska.It Sy org.openzfs.systemd:nofail Ns = Ns (unset) Ns | Ns Sy on Ns | Ns Sy off 104*bb2d13b6SMartin MatuskaWaxes or wanes strength of default reverse dependencies of the mount unit, see 105*bb2d13b6SMartin Matuskabelow. 10616038816SMartin Matuska. 10716038816SMartin Matuska.It Sy org.openzfs.systemd:ignore Ns = Ns Sy on Ns | Ns Sy off 10816038816SMartin Matuska.No Skip if Sy on . 10916038816SMartin Matuska.No Defaults to Sy off . 11016038816SMartin Matuska.El 11116038816SMartin Matuska. 11216038816SMartin Matuska.Ss Unit Ordering And Dependencies 11316038816SMartin MatuskaAdditionally, unless the pool the dataset resides on 11416038816SMartin Matuskais imported at generation time, both units gain 11516038816SMartin Matuska.Sy Wants Ns = Ns Pa zfs-import.target 116eda14cbcSMatt Macyand 11716038816SMartin Matuska.Sy After Ns = Ns Pa zfs-import.target . 11816038816SMartin Matuska.Pp 11916038816SMartin MatuskaAdditionally, unless the logical 12016038816SMartin Matuska.Em noauto 12116038816SMartin Matuskaflag is set, the mount unit gains a reverse-dependency for 12216038816SMartin Matuska.Pa local-fs.target 12316038816SMartin Matuskaof strength 12416038816SMartin Matuska.Bl -tag -compact -offset Ds -width "(unset)" 12516038816SMartin Matuska.It (unset) 12616038816SMartin Matuska.Sy WantedBy Ns = No + Sy Before Ns = 12716038816SMartin Matuska.It Sy on 12816038816SMartin Matuska.Sy WantedBy Ns = 12916038816SMartin Matuska.It Sy off 13016038816SMartin Matuska.Sy RequiredBy Ns = No + Sy Before Ns = 13116038816SMartin Matuska.El 13216038816SMartin Matuska. 13316038816SMartin Matuska.Ss Cache File 13416038816SMartin MatuskaBecause ZFS pools may not be available very early in the boot process, 13516038816SMartin Matuskainformation on ZFS mountpoints must be stored separately. 13616038816SMartin MatuskaThe output of 13716038816SMartin Matuska.Dl Nm zfs Cm list Fl Ho Ar name , Ns Aq every property above in order 13816038816SMartin Matuskafor datasets that should be mounted by systemd should be kept at 13916038816SMartin Matuska.Pa @sysconfdir@/zfs/zfs-list.cache/ Ns Ar poolname , 14016038816SMartin Matuskaand, if writeable, will be kept synchronized for the entire pool by the 14116038816SMartin Matuska.Pa history_event-zfs-list-cacher.sh 14216038816SMartin MatuskaZEDLET, if enabled 14316038816SMartin Matuska.Pq see Xr zed 8 . 14416038816SMartin Matuska. 14516038816SMartin Matuska.Sh ENVIRONMENT 146681ce946SMartin MatuskaIf the 14716038816SMartin Matuska.Sy ZFS_DEBUG 148681ce946SMartin Matuskaenvironment variable is nonzero 149681ce946SMartin Matuska.Pq or unset and Pa /proc/cmdline No contains Qq Sy debug , 150681ce946SMartin Matuskaprint summary accounting information at the end. 15116038816SMartin Matuska. 15216038816SMartin Matuska.Sh EXAMPLES 153eda14cbcSMatt MacyTo begin, enable tracking for the pool: 15416038816SMartin Matuska.Dl # Nm touch Pa @sysconfdir@/zfs/zfs-list.cache/ Ns Ar poolname 15516038816SMartin MatuskaThen enable the tracking ZEDLET: 15616038816SMartin Matuska.Dl # Nm ln Fl s Pa @zfsexecdir@/zed.d/history_event-zfs-list-cacher.sh @sysconfdir@/zfs/zed.d 15716038816SMartin Matuska.Dl # Nm systemctl Cm enable Pa zfs-zed.service 15816038816SMartin Matuska.Dl # Nm systemctl Cm restart Pa zfs-zed.service 15916038816SMartin Matuska.Pp 16016038816SMartin MatuskaIf no history event is in the queue, 16116038816SMartin Matuskainject one to ensure the ZEDLET runs to refresh the cache file 16216038816SMartin Matuskaby setting a monitored property somewhere on the pool: 16316038816SMartin Matuska.Dl # Nm zfs Cm set Sy relatime Ns = Ns Sy off Ar poolname/dset 16416038816SMartin Matuska.Dl # Nm zfs Cm inherit Sy relatime Ar poolname/dset 16516038816SMartin Matuska.Pp 16616038816SMartin MatuskaTo test the generator output: 16716038816SMartin Matuska.Dl $ Nm mkdir Pa /tmp/zfs-mount-generator 16816038816SMartin Matuska.Dl $ Nm @systemdgeneratordir@/zfs-mount-generator Pa /tmp/zfs-mount-generator 16916038816SMartin Matuska. 17016038816SMartin MatuskaIf the generated units are satisfactory, instruct 17116038816SMartin Matuska.Nm systemd 17216038816SMartin Matuskato re-run all generators: 17316038816SMartin Matuska.Dl # Nm systemctl daemon-reload 17416038816SMartin Matuska. 17516038816SMartin Matuska.Sh SEE ALSO 17616038816SMartin Matuska.Xr systemd.mount 5 , 17716038816SMartin Matuska.Xr systemd.target 5 , 17816038816SMartin Matuska.Xr zfs 5 , 17916038816SMartin Matuska.Xr systemd.generator 7 , 18016038816SMartin Matuska.Xr systemd.special 7 , 1813ff01b23SMartin Matuska.Xr zed 8 , 1823ff01b23SMartin Matuska.Xr zpool-events 8 183