summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTurbo Fredriksson <[email protected]>2013-12-05 11:36:58 +0000
committerBrian Behlendorf <[email protected]>2013-12-06 10:59:09 -0800
commitfc220e9ea536ea7a5bcdd231c8ae36e8fef18cfa (patch)
treeb66fb6b13836c41864d71eabceae10e23c727e42
parent90ee9ed32faa31174c673165c876b92272a93c72 (diff)
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 <[email protected]> Closes #1929
-rw-r--r--etc/init.d/zfs.lsb.in15
1 files changed, 13 insertions, 2 deletions
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 $?