]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - etc/init.d/zfs.redhat.in
30b9f0bf62b97a63936243e80043a51185e85782
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 .
/etc
/rc.d
/init.d
/functions
28 LOCKFILE
=/var
/lock
/zfs
30 ZED_PIDFILE
="@runstatedir@/zed.pid"
32 ZPOOL
="@sbindir@/zpool"
33 ZPOOL_CACHE
="/etc/zfs/zpool.cache"
37 MOUNT_EXTRA_OPTIONS
=""
39 # Source zfs configuration.
40 [ -r '/etc/sysconfig/zfs' ] && .
/etc
/sysconfig
/zfs
42 [ -x "$ZPOOL" ] ||
exit 1
43 [ -x "$ZFS" ] ||
exit 2
45 if [ -z "$init" ]; then
47 grep -qE '(^|[^\\](\\\\)* )zfs=(off|no)( |$)' /proc
/cmdline
&& exit 3
52 [ -f "$LOCKFILE" ] && return 3
54 # Delay until all required block devices are present.
57 # Load the zfs module stack
60 # Start the ZED for event handling
61 action $
"Starting ZFS Event Daemon" daemon
--pidfile="$ZED_PIDFILE" "$ZED"
63 # Ensure / exists in /etc/mtab, if not update mtab accordingly.
64 # This should be handled by rc.sysinit but lets be paranoid.
65 awk '$2 == "/" { exit 1 }' /etc
/mtab
67 if [ "$RETVAL" -eq 0 ]; then
71 # Import all pools described by the cache file, and then mount
72 # all filesystem based on their properties.
73 if [ "$USE_DISK_BY_ID" -eq 1 ]; then
74 action $
"Importing ZFS pools" \
75 "$ZPOOL" import
-d /dev
/disk
/by-id
-aN 2>/dev
/null
77 [ "$ret" -eq 0 ] && POOL_IMPORTED
=1
78 elif [ -f "$ZPOOL_CACHE" ] ; then
79 action $
"Importing ZFS pools" \
80 "$ZPOOL" import
-c "$ZPOOL_CACHE" -aN 2>/dev
/null
82 [ "$ret" -eq 0 ] && POOL_IMPORTED
=1
85 if [ -n "$POOL_IMPORTED" ]; then
86 if [ "$VERBOSE_MOUNT" -eq 1 ]; then
90 if [ "$DO_OVERLAY_MOUNTS" -eq 1 ]; then
94 action $
"Mounting ZFS filesystems" \
95 "$ZFS" mount
-a$verbose$overlay$MOUNT_EXTRA_OPTIONS
97 action $
"Sharing ZFS filesystems" \
106 [ ! -f "$LOCKFILE" ] && return 3
108 action $
"Unsharing ZFS filesystems" "$ZFS" unshare
-a
109 action $
"Unmounting ZFS filesystems" "$ZFS" umount
-a
110 action $
"Shutting down ZFS Event Daemon" killproc
-p "$ZED_PIDFILE" "$ZED"
117 [ ! -f "$LOCKFILE" ] && return 3
119 "$ZPOOL" status
&& echo "" && "$ZPOOL" list
140 if [ -f "$LOCKFILE" ]; then
146 echo $
"Usage: $0 {start|stop|status|restart|condrestart}"