2 # Copyright 1999-2011 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/files/zfs,v 0.9 2011/04/30 10:13:43 devsk Exp $
10 keyword -lxc -openvz -prefix -vserver
13 CACHEFILE=/etc/zfs/zpool.cache
19 if [ -c /dev/zfs ]; then
20 einfo "ZFS modules already loaded"
23 einfo "Checking if ZFS modules present"
24 if [ "x$(modprobe -l $ZFS_MODULE | grep $ZFS_MODULE)" == "x" ]; then
25 eerror "$ZFS_MODULE not found. Is the ZFS package installed?"
29 einfo "Checking if zfs userspace tools present"
30 if [ ! -x $ZPOOL ]; then
31 eerror "$ZPOOL binary not found."
34 if [ ! -x $ZFS ]; then
35 eerror "$ZFS binary not found."
43 checksystem || return 1
44 if [ ! -c /dev/zfs ]; then
47 if [ $rv -ne 0 ]; then
48 eerror "Failed to load the $ZFS_MODULE module, check 'dmesg|tail'."
54 # Import all pools described by the cache file, and then mount
55 # all filesystem based on their properties.
56 if [ -f $CACHEFILE ]; then
57 einfo "Importing ZFS pools"
58 # as per fedora script, import can fail if all pools are already imported
59 # The check for $rv makes no sense...but someday, it will work right.
60 $ZPOOL import -c $CACHEFILE -aN 2>/dev/null || true
62 if [ $rv -ne 0 ]; then
63 eerror "Failed to import not-yet imported pools."
69 einfo "Mounting ZFS filesystems"
72 if [ $rv -ne 0 ]; then
73 eerror "Failed to mount ZFS filesystems."
84 ebegin "Unmounting ZFS filesystems"
87 if [ $rv -ne 0 ]; then
88 eerror "Failed to umount ZFS filesystems."
96 # show pool status and list
97 $ZPOOL status && echo && $ZPOOL list