Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2013 04:22:27 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Fbsd8 <fbsd8@a1poweruser.com>
Cc:        FreeBSD questions <questions@freebsd.org>
Subject:   Re: How to add zfs support to FreeBSD?
Message-ID:  <20130219042227.7bcc3477.freebsd@edvax.de>
In-Reply-To: <5122D83F.6090107@a1poweruser.com>
References:  <51229B47.4070605@a1poweruser.com> <5122A3BA.2000907@a1poweruser.com> <20130219015600.68050fb2.freebsd@edvax.de> <5122D83F.6090107@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 18 Feb 2013 20:41:19 -0500, Fbsd8 wrote:
> So the next question is there any sh script code I can use to
> check if zfs has been enabled by the rc.conf zfs_enable statement.
> 
> I need to determine if zfs is enabled on the host.

Even though the statement zfs_enable="YES" may be part of
/etc/rc.conf, it's still possible that the ZFS subsystem
is _currently_ not running. So in my opinion you should
check with something that relies on ZFS actually running.
So there could be a difference between "is enabled" and
"is running".

Regarding "is enabled", you can easily check if the
corresponding line in /etc/rc.conf is present. This could
result in a false-positive answer regarding "is running".

For example, if I add zfs_enable="YES" to /etc/rc.conf
and check its presence (e. g. using grep), but I don't
do anything else; I'll get this:

	% zfs
	internal error: failed to initialize ZFS library

Here's an example from a system not running ZFS:

	/sbin/zfs > /dev/null 2>&1
	if [ $? -eq 0 ]; then
		echo "ZFS is currently running."
	else
		echo "ZFS is currently _not_ running."
	fi

Check on a system running ZFS. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130219042227.7bcc3477.freebsd>