From owner-freebsd-questions@FreeBSD.ORG Tue Feb 19 17:37:23 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C8A45F5A for ; Tue, 19 Feb 2013 17:37:23 +0000 (UTC) (envelope-from jdc@koitsu.org) Received: from qmta01.emeryville.ca.mail.comcast.net (qmta01.emeryville.ca.mail.comcast.net [IPv6:2001:558:fe2d:43:76:96:30:16]) by mx1.freebsd.org (Postfix) with ESMTP id ACA9388E for ; Tue, 19 Feb 2013 17:37:23 +0000 (UTC) Received: from omta07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by qmta01.emeryville.ca.mail.comcast.net with comcast id 2HUF1l00f1GXsucA1HdPHy; Tue, 19 Feb 2013 17:37:23 +0000 Received: from koitsu.strangled.net ([67.180.84.87]) by omta07.emeryville.ca.mail.comcast.net with comcast id 2HdM1l00S1t3BNj8UHdNUH; Tue, 19 Feb 2013 17:37:22 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id AAB6A73A1C; Tue, 19 Feb 2013 09:37:21 -0800 (PST) Date: Tue, 19 Feb 2013 09:37:21 -0800 From: Jeremy Chadwick To: "Teske, Devin" Subject: Re: How to add zfs support to FreeBSD Message-ID: <20130219173721.GA37110@icarus.home.lan> References: <20130219081643.GA27867@icarus.home.lan> <13CA24D6AB415D428143D44749F57D7201EAAEA2@ltcfiswmsgmb21> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13CA24D6AB415D428143D44749F57D7201EAAEA2@ltcfiswmsgmb21> User-Agent: Mutt/1.5.21 (2010-09-15) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1361295443; bh=OORk+VojEyUbzzhDXC72SHdYP68cgWOhNuJDAPtYSD8=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=SNB2SRBAz8y67RSIT7+A4WiejgifeCwr8eQYvq+9bGpHcfnGu2bNHxA53xrQSsBTJ dOQhXnFMUvjZWkTUeeeOSIwgV92K8ApoFbqYkVAZiJA+/FZrQg6QLxjxT5cvm/186S JgwDCou4c1tVLScDWqqHbiKBMyRFJiFWs0maQkUBys/77BMqIf2BSLF4VmQrSWXnwh i9U+o2SW1zR7SFKdzYTlpDMKN8IX23ZWQISf1GZD6nMF3Wpe1iAt2JMh0gYcr6XJRB 4jV6vsvWg8NiWvdH0hqmB9WuBekTRcweOJjaAKwCNsKoiBqpQMlRhgE5S39l5/2zY7 WElaCrptxBHEw== Cc: "fbsd8@a1poweruser.com" , "freebsd@edvax.de" , "freebsd-questions@freebsd.org" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 17:37:23 -0000 On Tue, Feb 19, 2013 at 09:09:07AM +0000, Teske, Devin wrote: > 4. lsvfs output? > -- > 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="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=none) > 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=none. > > 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. That's a pretty awesome command, one which I've never heard of -- probably because it's only mentioned in these, and only these: df(1) find(1) mount(2) nmount(2) umount(2) jail(8) Not even in mount(8), VFS(9), extattr(9), or any other man page one might think be relevant. Strange, considering it's existed since FreeBSD 2.0 (!). -- | 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 |