initial commit master
authorgit <redacted>
Thu, 11 Jun 2026 19:11:43 +0000 (15:11 -0400)
committergit <redacted>
Thu, 11 Jun 2026 19:11:43 +0000 (15:11 -0400)
README.md [new file with mode: 0644]
dracut-zfs-mount.patch [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..df99089
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+A patch to make dracut mount all ZFS datasets from the imported pools before switching to the new root, helpful if crucial system binaries/libraries are on a separate dataset.
+
+Note that the mountpoints will technically change from `$PATH` to `/sysroot/$PATH`. This is mostly harmless, but remounting a dataset will mount it at the actual `/sysroot/$PATH`, so be careful.
diff --git a/dracut-zfs-mount.patch b/dracut-zfs-mount.patch
new file mode 100644 (file)
index 0000000..c762606
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/contrib/dracut/90zfs/mount-zfs.sh.in     2026-06-11 21:00:38.614793958 -0400
++++ b/contrib/dracut/90zfs/mount-zfs.sh.in     2026-06-11 21:02:55.365106238 -0400
+@@ -85,7 +85,7 @@
+ if ! zpool get -Ho value name "${ZFS_POOL}" > /dev/null 2>&1; then
+     info "ZFS: Importing pool ${ZFS_POOL}..."
+     # shellcheck disable=SC2086
+-    if ! zpool import -N ${ZPOOL_IMPORT_OPTS} "${ZFS_POOL}"; then
++    if ! zpool import -NR /sysroot ${ZPOOL_IMPORT_OPTS} "${ZFS_POOL}"; then
+         warn "ZFS: Unable to import pool ${ZFS_POOL}"
+         rootok=0
+         return 1
+@@ -118,3 +118,9 @@
+   rootok=0
+   return 1
+ fi
++
++info "ZFS: Mounting all datasets..."
++if ! zfs mount -a; then
++  rootok=0
++  return 1
++fi