Updated init scripts to enable automatic sharing of ZFS datasets.

The relevant init scripts were updated so as to automatically share
ZFS datasets using "zfs share -a" at boot time.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Gunnar Beutner 2011-07-03 02:43:25 +02:00 committed by Brian Behlendorf
parent 3c9609b322
commit 8b0cf399ff
5 changed files with 25 additions and 0 deletions

View File

@ -158,6 +158,8 @@ start()
action $"Mounting ZFS filesystems not yet mounted: " $ZFS mount -a || return 152 action $"Mounting ZFS filesystems not yet mounted: " $ZFS mount -a || return 152
action $"Exporting ZFS filesystems: " $ZFS share -a || return 153
read_mtab "^/dev/zd" read_mtab "^/dev/zd"
read_fstab "^/dev/zd" read_fstab "^/dev/zd"

View File

@ -77,6 +77,15 @@ start() {
return $rv return $rv
fi fi
einfo "Exporting ZFS filesystems"
$ZFS share -a
rv=$?
if [ $rv -ne 0 ]; then
eerror "Failed to export ZFS filesystems."
eend $rv
return $rv
fi
eend 0 eend 0
return 0 return 0
} }

View File

@ -74,6 +74,10 @@ start()
log_begin_msg "Mounting ZFS filesystems" log_begin_msg "Mounting ZFS filesystems"
$ZFS mount -a $ZFS mount -a
log_end_msg $? log_end_msg $?
log_begin_msg "Exporting ZFS filesystems"
$ZFS share -a
log_end_msg $?
fi fi
touch $LOCKFILE touch $LOCKFILE

View File

@ -42,6 +42,14 @@ case $1 in
fi fi
done < <(zfs list -H); done < <(zfs list -H);
# export the filesystems
echo -n "exporting ZFS filesystems..."
if zfs share -a; then
echo -e "done";
else
echo -e "failed";
fi
;; ;;

View File

@ -87,6 +87,8 @@ start()
action $"Mounting automounted ZFS filesystems: " $ZFS mount -a || return 152 action $"Mounting automounted ZFS filesystems: " $ZFS mount -a || return 152
action $"Exporting ZFS filesystems: " $ZFS share -a || return 153
# Read fstab, try to mount zvols ignoring error # Read fstab, try to mount zvols ignoring error
read_fstab "^/dev/(zd|zvol)" read_fstab "^/dev/(zd|zvol)"
template=$"Mounting volume %s registered in fstab: " template=$"Mounting volume %s registered in fstab: "