From b5b535f5aa6fa776dadc2e324b94211224cdb7f9 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Tue, 1 May 2012 22:28:10 -0400 Subject: [PATCH] Do not import a pool that the kernel automatically imported This works around the following upstream issue: https://github.com/zfsonlinux/zfs/issues/714 Signed-off-by: Richard Yao --- defaults/initrd.scripts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index a7d88e4..c468ad4 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -654,7 +654,7 @@ startVolumes() { if [ "${USE_ZFS}" = '1' ] then - if [ -z "${ZFS_POOL}" ]; + if [ -z "${ZFS_POOL}" ] then good_msg "Importing ZFS pools" @@ -667,15 +667,21 @@ startVolumes() { bad_msg "Imported ZFS pools failed" fi else - good_msg "Importing ZFS pool ${ZFS_POOL}" - /sbin/zpool import -N "${ZPOOL_FORCE}" "${ZFS_POOL}" - - if [ "$?" = '0' ] + if [ "$(zpool list -H -o name ${ZFS_POOL} 2>&1)" = "$ZFS_POOL" ] then - good_msg "Importing ${ZFS_POOL} succeeded" + good_msg "ZFS pool ${ZFS_POOL} already imported" else - bad_msg "Importing ${ZFS_POOL} failed" + good_msg "Importing ZFS pool ${ZFS_POOL}" + + /sbin/zpool import -N "${ZPOOL_FORCE}" "${ZFS_POOL}" + + if [ "$?" = '0' ] + then + good_msg "Importing ${ZFS_POOL} succeeded" + else + bad_msg "Importing ${ZFS_POOL} failed" + fi fi fi fi -- 2.26.2