Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2013 09:09:07 +0000
From:      "Teske, Devin" <Devin.Teske@fisglobal.com>
To:        Jeremy Chadwick <jdc@koitsu.org>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Cc:        "fbsd8@a1poweruser.com" <fbsd8@a1poweruser.com>, "freebsd@edvax.de" <freebsd@edvax.de>, "Teske, Devin" <Devin.Teske@fisglobal.com>
Subject:   RE: How to add zfs support to FreeBSD
Message-ID:  <13CA24D6AB415D428143D44749F57D7201EAAEA2@ltcfiswmsgmb21>
In-Reply-To: <20130219081643.GA27867@icarus.home.lan>
References:  <20130219081643.GA27867@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
4. lsvfs output?
--=20
Devin

________________________________________
From: owner-freebsd-questions@freebsd.org [owner-freebsd-questions@freebsd.=
org] on behalf of Jeremy Chadwick [jdc@koitsu.org]
Sent: Tuesday, February 19, 2013 12:16 AM
To: freebsd-questions@freebsd.org
Cc: fbsd8@a1poweruser.com; freebsd@edvax.de
Subject: Re: How to add zfs support to FreeBSD

Regarding all the recommendations on "how to determine if ZFS is
available on the system":

Do not run commands like /sbin/zfs or /sbin/zpool right off the bat.
This will result in the underlying kld bits dynamically loading zfs.ko
and opensolaris.ko on the fly -- even if there aren't any ZFS
filesystems used -- which takes up kernel memory.  This also generates
crap on the console, and I can assure you an SA running some script is
not expecting this.  (An example is a system I admin which does not use
ZFS, but I often forget that fact and type "zpool status" as root by
accident, which loads ZFS, etc. -- I ended up using WITHOUT_CDDL on that
system just to keep that from happening ;-) ).

The OP needs to define what he means by "enabled on the host".  This
could mean:

a) The host actually has ZFS compiled or not (e.g. WITHOUT_ZFS and/or
WITHOUT_CDDL and/or WITHOUT_CTF are not defined in src.conf),

b) The host is capable of using ZFS (e.g. kernel modules are built and
installed but are not loaded),

c) The host has the kernel modules loaded but are not actually in use
(e.g. zfs_enable=3D"yes" in rc.conf but no ZFS filesystems defined),

d) The host has the kernel modules loaded and actively has ZFS
filesystems in use.


Recommendations (meaning you get to use a combination of these to create
proper logic depending on what you want -- please keep in mind what I
just said about using /sbin/zpool and so on however):

1) Check for the existence of /sbin/zfs (e.g. if [ -x ... ]).  If it
exists, the system was built without WITHOUT_{ZFS,CDDL,CTF} set.  (Sorry
for the double negative).

2) Use "sysctl -n vfs.zfs.version.zpl" and check exit code.  If 1, the
kernel modules are not loaded, else they are.

3) Run "/sbin/zpool list -H" and see if there's any output.  If there
is, there are pools defined, which means in some way or another ZFS is
being used by the system.  (Note that I recommend using /sbin/zpool not
/sbin/zfs, because zpool (for me anyway) takes less time and if there's
a pool there is going to be a filesystem (even if -omountpoint=3Dnone)
that shows up /sbin/zfs).

Note that this WILL result in the kernel modules being loaded.
Depending on what the OP wants, you could use "/sbin/mount | grep zfs"
instead, but that won't catch one situation: where all ZFS filesystems
are mountpoint=3Dnone.

Footnote: do not do silly things like grep /etc/src.conf for WITHOUT_xxx
features, or /etc/rc.conf for whatever; an admin may have set these in
advance for the next {build,install}{world,kernel} which have yet to be
run.  Parsing/checking config files is not going to suffice.

--
| Jeremy Chadwick                                   jdc@koitsu.org |
| UNIX Systems Administrator                http://jdc.koitsu.org/ |
| Mountain View, CA, US                                            |
| Making life hard for others since 1977.             PGP 4BD6C0CB |

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.



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