3 # zfs This script will mount/umount the zfs filesystems.
5 # chkconfig: 2345 01 99
6 # description: This script will mount/umount the zfs filesystems during
7 # system boot/shutdown. Configuration of which filesystems
8 # should be mounted is handled by the zfs 'mountpoint' and
9 # 'canmount' properties. See the zfs(8) man page for details.
10 # It is also responsible for all userspace zfs services.
14 # Required-Start: $local_fs
15 # Required-Stop: $local_fs
17 # Short-Description: Mount/umount the zfs filesystems
18 # Description: ZFS is an advanced filesystem designed to simplify managing
19 # and protecting your data. This service mounts the ZFS
20 # filesystems and starts all related zfs services.
23 # Source function library.
24 . /lib/lsb/init-functions
26 # Source zfs configuration.
27 [ -f /etc/defaults/zfs ] && . /etc/defaults/zfs
31 LOCKFILE=/var/lock/zfs
32 CACHEFILE=/etc/zfs/zpool.cache
36 [ -x $ZPOOL ] || exit 1
41 [ -f $LOCKFILE ] && return 3
43 # Requires selinux policy which has not been written.
44 if [ -r "/selinux/enforce" ] &&
45 [ "$(cat /selinux/enforce)" = "1" ]; then
47 log_failure_msg "SELinux ZFS policy required"
51 # Load the zfs module stack
54 # Ensure / exists in /etc/mtab, if not update mtab accordingly.
55 # This should be handled by rc.sysinit but lets be paranoid.
56 awk '$2 == "/" { exit 1 }' /etc/mtab
58 if [ $RETVAL -eq 0 ]; then
62 # Import all pools described by the cache file, and then mount
63 # all filesystem based on their properties.
64 if [ -f $CACHEFILE ] ; then
65 log_begin_msg "Importing ZFS pools"
66 $ZPOOL import -c $CACHEFILE -aN 2>/dev/null
69 log_begin_msg "Mounting ZFS filesystems"
79 [ ! -f $LOCKFILE ] && return 3
81 log_begin_msg "Unmounting ZFS filesystems"
90 [ ! -f $LOCKFILE ] && return 3
92 $ZPOOL status && echo && $ZPOOL list
113 if [ -f $LOCKFILE ]; then
119 echo $"Usage: $0 {start|stop|status|restart|condrestart}"