]>
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"
18 start
) echo "$1ing ZFS filesystems"
20 # Delay until all required block devices are present.
23 if ! grep "zfs" /proc
/modules
> /dev
/null
; then
24 echo "ZFS kernel module not loaded yet; loading...";
25 if ! modprobe zfs
; then
26 echo "Failed to load ZFS kernel module...";
31 if ! [ `uname -m` == "x86_64" ]; then
32 echo "Warning: You're not running 64bit. Currently native zfs in";
33 echo " linux is only supported and tested on 64bit.";
34 # should we break here? People doing this should know what they
35 # do, thus i'm not breaking here.
38 # mount the filesystems
39 while IFS
= read -r -d $
'\n' dev
; do
40 mdev
=$
(echo "$dev" |
awk '{ print $1; }')
41 echo -n "mounting $mdev..."
42 if $ZFS mount
$mdev; then
47 done < <($ZFS list
-H);
49 # export the filesystems
50 echo -n "exporting ZFS filesystems..."
51 if $ZFS share
-a; then
60 stop
) echo "$1ping ZFS filesystems"
62 if grep "zfs" /proc
/modules
> /dev
/null
; then
63 # module is loaded, so we can try to umount filesystems
64 while IFS
= read -r -d $
'\n' dev
; do
65 mdev
=$
(echo "$dev" |
awk '{ print $1 }');
66 echo -n "umounting $mdev...";
67 if $ZFS umount
$mdev; then
72 # the next line is, because i have to reverse the
73 # output, otherwise it wouldn't work as it should
74 done < <($ZFS list
-H |
tac);
76 # and finally let's rmmod the module
81 # module not loaded, no need to umount anything
87 restart
) echo "$1ing ZFS filesystems"
92 *) echo "Usage: $0 {start|stop|restart}"