DRACUT.ZFS(7)
π DRACUT.ZFS π
okay bestie, this is dracut.zfs(7) from the Miscellaneous Information Manual β it's the whole tea on ZFS dracut hooks. grab a snack, this one's a bop π«Ά
β¨ NAME β¨
dracut.zfs β the ~overview~ of ZFS dracut hooks π
β¨ SYNOPSIS β¨
here's the flowchart, and no I'm not paraphrasing it, it's art:
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
also go compare dracut.bootup(7) for the full flowchart, iykyk π
β¨ DESCRIPTION β¨
so under dracut, booting with ZFS-on-/ is handled by a bunch of hooks living in the 90zfs module. π
to boot into a ZFS dataset you need mountpoint=/ set on the dataset that holds the root filesystem (we're calling that "the boot dataset" from here on, bestie) β and at the absolute bare minimum you also need either the bootfs property pointing at that dataset, or the root= kernel cmdline (or a dracut drop-in) to name it. no cap. π«Ά
every child of the boot dataset with canmount=on whose mountpoints match the /etc, /bin, /lib, /lib??, /libx32, and /usr globs is deemed essential and gets mounted too. periodt. π
and fr fr, zfs-mount-generator(8) is recommended if you want the system to actually behave afterward (correct mount properties, remounting, &c.). the vibes depend on it. β¨
β¨ CMDLINE β¨
π Standard
root=zfs:dataset,root=ZFS=datasetβ use dataset as the boot dataset. every single plus sign (+) gets swapped for a space (). π¦root=zfs:AUTO,root=zfs:,root=zfs,[root=]β after import, go hunt down the first pool that has thebootfsproperty set, and use its value exactly as-if you'd specified it as the dataset above. β¨rootfstype=zfs root=datasetβ equivalent toroot=zfs:dataset.rootfstype=zfs [root=]β equivalent toroot=zfs:AUTO.rootflags=flagsβ mount the boot dataset with-o flags; cf. "Temporary Mount Point Properties" inzfsprops(7). heads up though β these properties will not last, because all filesystems get re-mounted from the real root. it's giving temporary. πdebugβ if you specify it,dracut-zfs-generatorlogs to the journal. π
β οΈ bestie be careful β if you set neitherrootfstype=zfsnorroot=zfs:dataset, other automatic boot selection methods likesystemd-gpt-auto-generatorandsystemd-fstab-generatormight take precedent. don't get sniped. π
π ZFS-specific
bootfs.snapshot[=snapshot-name]β runszfs snapshot boot-dataset@snapshot-namebefore pivoting to the real root. snapshot-name defaults to the current kernel release. πΈbootfs.rollback[=snapshot-name]β runszfs rollback -Rf boot-dataset@snapshot-namebefore pivoting to the real root. snapshot-name defaults to the current kernel release. βͺspl_hostid=host-idβ useszgenhostid(8)to set the host ID to host-id; otherwise,/etc/hostidinherited from the real root is used. πͺͺzfs_force,zfs.force,zfsforceβ appends-fto allzpool importinvocations; primarily useful together withspl_hostid=, or if no host ID was inherited at all. πͺ
β¨ FILES β¨
parse-zfs.sh(cmdline) β processesspl_hostid=. ifroot=matches a known pattern from above, it provides/dev/rootand delays the initqueue untilzfs(4)is loaded. β³zfs-import-opts.sh(systemd environment generator) β turnszfs_force,zfs.force, orzfsforceintoZPOOL_IMPORT_OPTS=-fforzfs-import-scan.serviceorzfs-import-cache.service. π§zfs-load-key.sh(pre-mount) β loads encryption keys for the boot dataset and its essential descendants:keylocation=promptβ is prompted for viasystemd-ask-passwordthrice. πkeylocation=https://URL,keylocation=http://URLβnetwork-online.targetis started before loading. πkeylocation=file://pathβ if path doesn't exist,udevadmis settled. if it still doesn't exist, it's waited for for up to 10s. β±οΈ
zfs-env-bootfs.service(systemd service) β after pool import, setsBOOTFS=in the systemd environment to the first non-nullbootfsvalue in iteration order. π―dracut-zfs-generator(systemd generator) β generatessysroot.mount(usingrootflags=, if any). if an explicit boot dataset was specified, it also generates the essential mountpoints (sysroot-etc.mount,sysroot-bin.mount, &c.); otherwise it generateszfs-nonroot-necessities.service, which mounts them explicitly after/sysrootusingBOOTFS=. π οΈzfs-snapshot-bootfs.service,zfs-rollback-bootfs.service(systemd services) β consumebootfs.snapshotandbootfs.rollbackas described in "CMDLINE". they useBOOTFS=if no explicit boot dataset was specified. πzfs-needshutdown.sh(cleanup) β if any pools were imported, it signals that shutdown hooks are required. π¨export-zfs.sh(shutdown) β forcibly exports all pools. bye bestie π/etc/hostid,/etc/zfs/zpool.cache,/etc/zfs/vdev_id.conf(regular files) β included verbatim, hostonly. πmount-zfs.sh(mount) β does nothing on systemd systems (ifdracut-zfs-generatorsucceeded). otherwise, it loads the encryption key for the boot dataset from the console or via plymouth. and honestly? it may not work at all! π
β¨ SEE ALSO β¨
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)
okay that's the whole thing, you ate that π this was OpenZFS, dated July 13, 2024 β go forth and boot, main character. ππΈπ¦
π¦ where this page comes from
- alpine 3.23: zfs-doc 2.4.4-r0 Β· CDDL-1.0
- alpine 3.24: zfs-doc 2.4.4-r0 Β· CDDL-1.0
- nixos 26.05: zfs-user 2.4.4
- nixpkgs unstable: zfs-user 2.4.4
- ubuntu resolute: zfs-dracut 2.4.1-1ubuntu5 Β· CDDL-1.0
- ubuntu resolute: zfs-dracut 2.4.1-1ubuntu5.1 Β· CDDL-1.0
- ubuntu stonking: zfs-dracut 2.4.4-1ubuntu4 Β· CDDL-1.0
- π the page's license: CDDL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms