1 .\" SPDX-License-Identifier: 0BSD
9 .Nd overview of ZFS dracut hooks
13 parse-zfs.sh \(-> dracut-cmdline.service
17 \e\(em\(em\(em\(em\(em\(em\(em\(em\(-> dracut-initqueue.service
19 zfs-load-module.service \(da | |
20 | | sysinit.target \(da |
21 \(da | | zfs-import-scan.service \(da
22 zfs-import-scan.service \(da \(da | zfs-import-cache.service
23 | zfs-import-cache.service basic.target | |
24 \e__________________| | \(da \(da
25 \(da | zfs-load-key.sh
26 zfs-env-bootfs.service | |
28 zfs-import.target \(-> dracut-pre-mount.service
30 | dracut-zfs-generator |
31 | _____________________/|
33 | sysroot.mount \(<-\(em\(em\(em dracut-zfs-generator
36 | initrd-root-fs.target \(<-\(em zfs-nonroot-necessities.service
39 \(da dracut-mount.service |
40 zfs-snapshot-bootfs.service | |
43 zfs-rollback-bootfs.service | |
45 | /sysroot/{usr,etc,lib,&c.} \(<-\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em\(em/
49 \e______________________ |
52 export-zfs.sh initrd.target
55 dracut-shutdown.service …
58 zfs-needshutdown.sh \(-> initrd-cleanup.service
63 for the full flowchart.
66 Under dracut, booting with
68 is facilitated by a number of hooks in the
72 Booting into a ZFS dataset requires
73 .Sy mountpoint Ns = Ns Pa /
74 to be set on the dataset containing the root filesystem (henceforth "the boot
75 dataset") and at the very least either the
77 property to be set to that dataset, or the
79 kernel cmdline (or dracut drop-in) argument to specify it.
81 All children of the boot dataset with
82 .Sy canmount Ns = Ns Sy on
86 .Pa /etc , /bin , /lib , /lib?? , /libx32 , No and Pa /usr
87 globs are deemed essential and will be mounted as well.
89 .Xr zfs-mount-generator 8
90 is recommended for proper functioning of the system afterward (correct mount
91 properties, remounting, &c.).
95 .Bl -tag -compact -width ".Sy root=zfs:AUTO , root=zfs: , root=zfs , Op Sy root="
96 .It Sy root=zfs:\& Ns Ar dataset , Sy root=ZFS= Ns Ar dataset
102 are replaced with spaces
105 .It Sy root=zfs:AUTO , root=zfs:\& , root=zfs , Op Sy root=
106 After import, search for the first pool with the
108 property set, use its value as-if specified as the
112 .It Sy rootfstype=zfs root= Ns Ar dataset
114 .Sy root=zfs:\& Ns Ar dataset .
116 .It Sy rootfstype=zfs Op Sy root=
120 .It Sy rootflags= Ns Ar flags
121 Mount the boot dataset with
124 .Sx Temporary Mount Point Properties
127 These properties will not last, since all filesystems will be re-mounted from
132 .Nm dracut-zfs-generator
136 Be careful about setting neither
139 .Sy root=zfs:\& Ns Ar dataset
140 \(em other automatic boot selection methods, like
141 .Nm systemd-gpt-auto-generator
143 .Nm systemd-fstab-generator
144 might take precedent.
147 .Bl -tag -compact -width ".Sy bootfs.snapshot Ns Op Sy = Ns Ar snapshot-name"
148 .It Sy bootfs.snapshot Ns Op Sy = Ns Ar snapshot-name
150 .Nm zfs Cm snapshot Ar boot-dataset Ns Sy @ Ns Ar snapshot-name
151 before pivoting to the real root.
153 defaults to the current kernel release.
155 .It Sy bootfs.rollback Ns Op Sy = Ns Ar snapshot-name
157 .Nm zfs Cm rollback Fl Rf Ar boot-dataset Ns Sy @ Ns Ar snapshot-name
158 before pivoting to the real root.
160 defaults to the current kernel release.
162 .It Sy spl_hostid= Ns Ar host-id
165 to set the host ID to
169 inherited from the real root is used.
171 .It Sy zfs_force , zfs.force , zfsforce
176 invocations; primarily useful in conjunction with
178 or if no host ID was inherited.
183 .It Pa parse-zfs.sh Pq Sy cmdline
188 matches a known pattern, above, provides
190 and delays the initqueue until
194 .It Pa zfs-import-opts.sh Pq Nm systemd No environment generator
196 .Sy zfs_force , zfs.force , No or Sy zfsforce
198 .Ev ZPOOL_IMPORT_OPTS Ns = Ns Fl f
200 .Pa zfs-import-scan.service
202 .Pa zfs-import-cache.service .
204 .It Pa zfs-load-key.sh Pq Sy pre-mount
205 Loads encryption keys for the boot dataset and its essential descendants.
206 .Bl -tag -compact -offset 4n -width ".Sy keylocation Ns = Ns Sy https:// Ns Ar URL , Sy keylocation Ns = Ns Sy http:// Ns Ar URL"
207 .It Sy keylocation Ns = Ns Sy prompt
209 .Nm systemd-ask-password
212 .It Sy keylocation Ns = Ns Sy https:// Ns Ar URL , Sy keylocation Ns = Ns Sy http:// Ns Ar URL
213 .Pa network-online.target
214 is started before loading.
216 .It Sy keylocation Ns = Ns Sy file:// Ns Ar path
220 .Nm udevadm No is Cm settle Ns d .
221 If it still doesn't, it's waited for for up to
225 .It Pa zfs-env-bootfs.service Pq Nm systemd No service
226 After pool import, sets
228 in the systemd environment to the first non-null
230 value in iteration order.
232 .It Pa dracut-zfs-generator Pq Nm systemd No generator
234 .Pa sysroot.mount Pq using Sy rootflags= , No if any .
235 If an explicit boot dataset was specified, also generates essential mountpoints
236 .Pq Pa sysroot-etc.mount , sysroot-bin.mount , No &c.\& ,
238 .Pa zfs-nonroot-necessities.service
239 which mounts them explicitly after
244 .It Pa zfs-snapshot-bootfs.service , zfs-rollback-bootfs.service Pq Nm systemd No services
253 if no explicit boot dataset was specified.
255 .It Pa zfs-needshutdown.sh Pq Sy cleanup
256 If any pools were imported, signals that shutdown hooks are required.
258 .It Pa export-zfs.sh Pq Sy shutdown
259 Forcibly exports all pools.
261 .It Pa /etc/hostid , /etc/zfs/zpool.cache , /etc/zfs/vdev_id.conf Pq regular files
262 Included verbatim, hostonly.
264 .It Pa mount-zfs.sh Pq Sy mount
268 .Pq if Pa dracut-zfs-generator No succeeded .
269 Otherwise, loads encryption key for the boot dataset from the console or via
271 It may not work at all!
275 .Xr dracut.bootup 7 ,
278 .Xr dracut-shutdown.service 8 ,
279 .Xr systemd-fstab-generator 8 ,
280 .Xr systemd-gpt-auto-generator 8 ,
281 .Xr zfs-mount-generator 8 ,