--- /usr/share/initramfs-tools/scripts/zfs.orig 2016-04-13 12:43:25.000000000 +0200 +++ /usr/share/initramfs-tools/scripts/zfs 2017-05-06 20:25:50.200005995 +0200 @@ -1,8 +1,24 @@ # ZFS boot stub for initramfs-tools. +# pseudo-kernel parameter 'zdirs': a comma separated list of device +# directories to scan on zpool import. +check_zfs_dev_dirs() { + ZDEV_DIRS= + for x in $(cat /proc/cmdline); do + case $x in + zdirs=*) ZDEV_DIRS=",${x#zdirs=}" ;; + esac + done + if [ -n "${ZDEV_DIRS}" ]; then + ZDEV_DIRS=$( echo "${ZDEV_DIRS}" | sed -e 's/,/ -d /g' ) + else + ZDEV_DIRS= + fi +} + zfs_test_import() { - ZFS_STDERR=$(zpool import -o readonly=on -N "$ZFS_RPOOL" 2>&1) + ZFS_STDERR=$(zpool import ${ZDEV_DIRS} -o readonly=on -N "$ZFS_RPOOL" 2>&1) ZFS_ERROR=$? if [ "$ZFS_ERROR" -eq 0 ] then @@ -13,6 +29,7 @@ mountroot() { + check_zfs_dev_dirs [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg @@ -54,17 +71,17 @@ # At this point, the pool either imported cleanly, or we ran out of the # allowed time (rootdelay). Perform the read-write import. - ZFS_STDERR=$(zpool import -N "$ZFS_RPOOL" 2>&1) + ZFS_STDERR=$(zpool import ${ZDEV_DIRS} -N "$ZFS_RPOOL" 2>&1) ZFS_ERROR=$? if [ "$ZFS_ERROR" -ne 0 ] then - panic "Command: zpool import -N $ZFS_RPOOL + panic "Command: zpool import ${ZDEV_DIRS} -N $ZFS_RPOOL Message: $ZFS_STDERR Error: $ZFS_ERROR Manually import the root pool at the command prompt and then exit. -Hint: Try: zpool import -f -R / -N $ZFS_RPOOL" +Hint: Try: zpool import -f -R / ${ZDEV_DIRS} -N $ZFS_RPOOL" fi # Set elevator=noop on the root pool's vdevs' disks. ZFS already