How to add zfs support to FreeBSD?

Polytropon freebsd at
Tue Feb 19 03:22:26 UTC 2013

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."
		echo "ZFS is currently _not_ running."

Check on a system running ZFS. :-)

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

More information about the freebsd-questions mailing list