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
18 # Default-Start: 2 3 4 5
20 # Short-Description: Mount/umount the zfs filesystems
21 # Description: ZFS is an advanced filesystem designed to simplify managing
22 # and protecting your data. This service mounts the ZFS
23 # filesystems and starts all related zfs services.
26 # Source function library.
27 . /etc/rc.d/init.d/functions
29 # Source zfs configuration.
30 [ -f /etc/sysconfig/zfs ] && . /etc/sysconfig/zfs
34 LOCKFILE=/var/lock/subsys/zfs
35 CACHEFILE=/etc/zfs/zpool.cache
39 [ -x $ZPOOL ] || exit 1
44 [ -f $LOCKFILE ] && return 3
46 # Requires selinux policy which has not been written.
47 if [ -r "/selinux/enforce" ] &&
48 [ "$(cat /selinux/enforce)" = "1" ]; then
49 action "SELinux ZFS policy required: " /bin/false
53 # Load the zfs module stack
56 # Ensure / exists in /etc/mtab, if not update mtab accordingly.
57 # This should be handled by rc.sysinit but lets be paranoid.
58 awk '$2 == "/" { exit 1 }' /etc/mtab
60 if [ $RETVAL -eq 0 ]; then
64 # Import all pools described by the cache file, and then mount
65 # all filesystem based on their properties.
66 if [ -f $CACHEFILE ] ; then
67 action $"Importing ZFS pools: " \
68 $ZPOOL import -c $CACHEFILE -aN 2>/dev/null
69 action $"Mounting ZFS filesystems: " \
78 [ ! -f $LOCKFILE ] && return 3
80 action $"Unmounting ZFS filesystems: " $ZFS umount -a
87 [ ! -f $LOCKFILE ] && return 3
89 $ZPOOL status && echo && $ZPOOL list
110 if [ -f $LOCKFILE ]; then
116 echo $"Usage: $0 {start|stop|status|restart|condrestart}"