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
16 # Default-Start: 2 3 4 5
19 # Short-Description: Mount/umount the zfs filesystems
20 # Description: ZFS is an advanced filesystem designed to simplify managing
21 # and protecting your data. This service mounts the ZFS
22 # filesystems and starts all related zfs services.
25 # Source function library.
26 . /lib/lsb/init-functions
28 # Source zfs configuration.
29 [ -f /etc/defaults/zfs ] && . /etc/defaults/zfs
33 LOCKFILE=/var/lock/zfs
35 ZPOOL="@sbindir@/zpool"
36 ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
38 [ -x $ZPOOL ] || exit 1
43 [ -f $LOCKFILE ] && return 3
45 # Requires selinux policy which has not been written.
46 if [ -r "/selinux/enforce" ] &&
47 [ "$(cat /selinux/enforce)" = "1" ]; then
49 log_failure_msg "SELinux ZFS policy required"
53 # Delay until all required block devices are present.
56 # Load the zfs module stack
59 # Ensure / exists in /etc/mtab, if not update mtab accordingly.
60 # This should be handled by rc.sysinit but lets be paranoid.
61 awk '$2 == "/" { exit 1 }' /etc/mtab
63 if [ $RETVAL -eq 0 ]; then
67 # Import all pools described by the cache file, and then mount
68 # all filesystem based on their properties.
69 if [ -f $ZPOOL_CACHE ] ; then
70 log_begin_msg "Importing ZFS pools"
71 $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null
74 log_begin_msg "Mounting ZFS filesystems"
78 log_begin_msg "Exporting ZFS filesystems"
88 [ ! -f $LOCKFILE ] && return 3
90 log_begin_msg "Unmounting ZFS filesystems"
99 [ ! -f $LOCKFILE ] && return 3
101 $ZPOOL status && echo && $ZPOOL list
122 if [ -f $LOCKFILE ]; then
128 echo $"Usage: $0 {start|stop|status|restart|condrestart}"