DRACUT.ZFS(7) | Miscellaneous Information Manual | DRACUT.ZFS(7) |
dracut.zfs
—
overview of ZFS dracut hooks
parse-zfs.sh → dracut-cmdline.service | ↓ | … | ↓ \————————→ dracut-initqueue.service | zfs-import-opts.sh zfs-load-module.service ↓ | | | | sysinit.target ↓ | ↓ | | zfs-import-scan.service ↓ zfs-import-scan.service ↓ ↓ | zfs-import-cache.service | zfs-import-cache.service basic.target | | \__________________| | ↓ ↓ ↓ | zfs-load-key.sh zfs-env-bootfs.service | | ↓ ↓ ↓ zfs-import.target → dracut-pre-mount.service | ↑ | | dracut-zfs-generator | | _____________________/| |/ ↓ | sysroot.mount ←——— dracut-zfs-generator | | | ↓ | initrd-root-fs.target ←— zfs-nonroot-necessities.service | | | | ↓ | ↓ dracut-mount.service | zfs-snapshot-bootfs.service | | | ↓ | ↓ … | zfs-rollback-bootfs.service | | | ↓ | | /sysroot/{usr,etc,lib,&c.} ←———————————————————/ | | | ↓ | initrd-fs.target \______________________ | \| ↓ export-zfs.sh initrd.target | | ↓ ↓ dracut-shutdown.service … | ↓ zfs-needshutdown.sh → initrd-cleanup.service
Compare dracut.bootup(7) for the full flowchart.
Under dracut, booting with
ZFS-on-/ is facilitated by a
number of hooks in the 90zfs
module.
Booting into a ZFS dataset requires mountpoint=/ to be set on the dataset containing the root filesystem (henceforth "the boot dataset") and at the very least either the bootfs property to be set to that dataset, or the root= kernel cmdline (or dracut drop-in) argument to specify it.
All children of the boot dataset with canmount=on with mountpoints matching /etc, /bin, /lib, /lib??, /libx32, and /usr globs are deemed essential and will be mounted as well.
zfs-mount-generator(8) is recommended for proper functioning of the system afterward (correct mount properties, remounting, &c.).
-o
flags; cf.
Temporary Mount
Point Properties in zfsprops(7). These properties
will not last, since all filesystems will be re-mounted from the real
root.dracut-zfs-generator
logs to the
journal.Be careful about setting neither rootfstype=zfs
nor root=zfs:dataset — other
automatic boot selection methods, like
systemd-gpt-auto-generator
and
systemd-fstab-generator
might take precedent.
zfs
snapshot
boot-dataset@snapshot-name
before pivoting to the real root. snapshot-name
defaults to the current kernel release.zfs
snapshot
-Rf
boot-dataset@snapshot-name
before pivoting to the real root. snapshot-name
defaults to the current kernel release.-f
to all zpool
import
invocations; primarily useful in
conjunction with spl_hostid=, or if no host ID was
inherited.systemd
environment
generator)ZPOOL_IMPORT_OPTS
=-f
for
zfs-import-scan.service or
zfs-import-cache.service.systemd-ask-password
thrice.udevadm
is
settle
d. If it still doesn't, it's waited for
for up to
10s.systemd
service)BOOTFS
= in the systemd
environment to the first non-null bootfs value in
iteration order.systemd
generator)BOOTFS
=.systemd
services)BOOTFS
= if no explicit boot dataset was
specified.systemd
systems (if
dracut-zfs-generator
succeeded). Otherwise, loads encryption key for
the boot dataset from the console or via plymouth. It may not work at
all!dracut.bootup(7), zfsprops(7), zpoolprops(7), dracut-shutdown.service(8), systemd-fstab-generator(8), systemd-gpt-auto-generator(8), zfs-mount-generator(8), zgenhostid(8)
March 28, 2023 | OpenZFS |