From 9c52dadbddd4db5cb47a2dea9152e840b4bdc8ae Mon Sep 17 00:00:00 2001 From: theQuestionmark <17354322+theQuestionmark@users.noreply.github.com> Date: Thu, 9 Jun 2022 16:59:04 +0200 Subject: [PATCH] initramfs: fix import of additional zpools on boot Currently all zpools defined in ZFS_INITRD_ADDITIONAL_DATASETS aren't imported correctly if they are on an other zpool than the root-pool. The mount fails hence the zpool is not known. Initramfs asks know for the second decryption-key on boot for second zpool. Signed-off-by: theQuestionmark <17354322+theQuestionmark@users.noreply.github.com> --- contrib/initramfs/scripts/zfs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs index 1c8c496a7f..1ea5abe90b 100644 --- a/contrib/initramfs/scripts/zfs +++ b/contrib/initramfs/scripts/zfs @@ -897,6 +897,15 @@ mountroot() ZFS_RPOOL="${pool}" fi + # We need to import additional zpools which aren't under root zpool, before mount_fs() + for add_zpool in $ZFS_INITRD_ADDITIONAL_DATASETS; do + add_zpool_base="${add_zpool%%/*}" + + if [ "$add_zpool_base" != "$ZFS_RPOOL" ] + then + import_pool "${add_zpool_base}" + fi + done # ---------------------------------------------------------------- # P R E P A R E R O O T F I L E S Y S T E M