]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - etc/init.d/zfs.lunar.in
3 # zfs This shell script takes care of starting (mount) and
4 # stopping (umount) zfs shares.
7 # description: ZFS is a filesystem developed by Sun, ZFS is a
8 # combined file system and logical volume manager
9 # designed by Sun Microsystems. Made available to Linux
10 # using SPL (Solaris Porting Layer) by zfsonlinux.org.
14 ZPOOL
="@sbindir@/zpool"
15 ZPOOL_CACHE
="@sysconfdir@/zfs/zpool.cache"
17 if [ -z "$init" ]; then
19 grep -qE '(^|[^\\](\\\\)* )zfs=(off|no)( |$)' /proc
/cmdline
&& exit 3
23 start
) echo "$1ing ZFS filesystems"
25 # Delay until all required block devices are present.
28 if ! grep "zfs" /proc
/modules
> /dev
/null
; then
29 echo "ZFS kernel module not loaded yet; loading...";
30 if ! modprobe zfs
; then
31 echo "Failed to load ZFS kernel module...";
36 if ! [ `uname -m` == "x86_64" ]; then
37 echo "Warning: You're not running 64bit. Currently native zfs in";
38 echo " linux is only supported and tested on 64bit.";
39 # should we break here? People doing this should know what they
40 # do, thus i'm not breaking here.
43 # mount the filesystems
44 while IFS
= read -r -d $
'\n' dev
; do
45 mdev
=$
(echo "$dev" |
awk '{ print $1; }')
46 echo -n "mounting $mdev..."
47 if $ZFS mount
$mdev; then
52 done < <($ZFS list
-H);
54 # export the filesystems
55 echo -n "exporting ZFS filesystems..."
56 if $ZFS share
-a; then
65 stop
) echo "$1ping ZFS filesystems"
67 if grep "zfs" /proc
/modules
> /dev
/null
; then
68 # module is loaded, so we can try to umount filesystems
69 while IFS
= read -r -d $
'\n' dev
; do
70 mdev
=$
(echo "$dev" |
awk '{ print $1 }');
71 echo -n "umounting $mdev...";
72 if $ZFS umount
$mdev; then
77 # the next line is, because i have to reverse the
78 # output, otherwise it wouldn't work as it should
79 done < <($ZFS list
-H |
tac);
81 # and finally let's rmmod the module
86 # module not loaded, no need to umount anything
92 restart
) echo "$1ing ZFS filesystems"
97 *) echo "Usage: $0 {start|stop|restart}"