From fc220e9ea536ea7a5bcdd231c8ae36e8fef18cfa Mon Sep 17 00:00:00 2001 From: Turbo Fredriksson Date: Thu, 5 Dec 2013 11:36:58 +0000 Subject: Update init script to allow /dev/disk/by-id import Many people prefer to use by-id at import time instead of using the cache file. This can be a much better solution than the cache file in some environments so we're adding some infrastructure to allow it. This functionality is disabled by default. Signed-off-by: Brian Behlendorf Closes #1929 --- etc/init.d/zfs.lsb.in | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/init.d/zfs.lsb.in b/etc/init.d/zfs.lsb.in index 24641485d..5941d56c2 100644 --- a/etc/init.d/zfs.lsb.in +++ b/etc/init.d/zfs.lsb.in @@ -29,6 +29,7 @@ LOCKFILE=/var/lock/zfs ZFS="@sbindir@/zfs" ZPOOL="@sbindir@/zpool" ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" +USE_DISK_BY_ID=0 # Source zfs configuration. [ -r '/etc/default/zfs' ] && . /etc/default/zfs @@ -69,11 +70,21 @@ start() # Import all pools described by the cache file, and then mount # all filesystem based on their properties. - if [ -f "$ZPOOL_CACHE" ] ; then + if [ "$USE_DISK_BY_ID" -eq 1 ]; then + log_begin_msg "Importing ZFS pools" + "$ZPOOL" import -d /dev/disk/by-id -aN 2>/dev/null + ret=$? + log_end_msg $ret + [ "$ret" -eq 0 ] && POOL_IMPORTED=1 + elif [ -f "$ZPOOL_CACHE" ] ; then log_begin_msg "Importing ZFS pools" "$ZPOOL" import -c "$ZPOOL_CACHE" -aN 2>/dev/null - log_end_msg $? + ret=$? + log_end_msg $ret + [ "$ret" -eq 0 ] && POOL_IMPORTED=1 + fi + if [ -n "$POOL_IMPORTED" ]; then log_begin_msg "Mounting ZFS filesystems" "$ZFS" mount -a log_end_msg $? -- cgit v1.2.3