From owner-freebsd-fs@FreeBSD.ORG Tue Feb 24 15:37:44 2015 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28DBE46F for ; Tue, 24 Feb 2015 15:37:44 +0000 (UTC) Received: from hydra.pix.net (hydra.pix.net [IPv6:2001:470:e254::4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.pix.net", Issuer "Pix.Com Technologies, LLC CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EDB35ADF for ; Tue, 24 Feb 2015 15:37:43 +0000 (UTC) Received: from torb.pix.net (verizon.pix.net [71.178.232.3]) (authenticated bits=0) by hydra.pix.net (8.15.1/8.15.1) with ESMTPA id t1OFbg3w084139; Tue, 24 Feb 2015 10:37:42 -0500 (EST) (envelope-from lidl@pix.net) X-Authentication-Warning: hydra.pix.net: Host verizon.pix.net [71.178.232.3] claimed to be torb.pix.net Message-ID: <54EC9AC6.5000109@pix.net> Date: Tue, 24 Feb 2015 10:37:42 -0500 From: Kurt Lidl User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: freebsd-fs@freebsd.org Subject: Re: The magic of ZFS and NFS (2nd try) References: <12103095.viZFqgegqA@falbala.rz1.convenimus.net> In-Reply-To: <12103095.viZFqgegqA@falbala.rz1.convenimus.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2015 15:37:44 -0000 > Rainer Duffner wrote: > >> You must use the syntax of exports(5) also with zfs set sharenfs= >> AFAIK, you shouldn’t use /etc/exports to do zfs exports but the above >> command > > But why shouldn't I use /etc/exports? I have read people writing this (don't > use /etc/exports) in forums when searching for answers, however the current > manpage for zfs says this: > > sharenfs=on | off | opts > Controls whether the file system is shared via NFS, and what options > are used. A file system with a sharenfs property of off is managed > the traditional way via exports(5). Otherwise, the file system is > automatically shared and unshared with the "zfs share" and "zfs > unshare" commands. If the property is set to on no NFS export options > are used. Otherwise, NFS export options are equivalent to the con- > tents of this property. The export options may be comma-separated. > See exports(5) for a list of valid options. > > To me this looks like I can choose whether I want to use the exports file > or if I wish to set the sharenfs flag. I don't really *that* much, although > I don't really think this is something that a file system should decide, but > should be set from the NFS server. Well, I would argue (putting aside Jordan's semi-rant), that the correct thing to do is use the sharenfs flag for ZFS filesystems, as already recommended. The mechanics of using it are straightforward: zfs set sharenfs="things you would put in /etc/exports" path/to/zfs In a more concrete example, on one of my machines, I have: root@hostname-134: zfs get all |grep sharenfs|grep zroot/fbsd zroot/fbsd sharenfs off default zroot/fbsd/10.0-amd64 sharenfs -maproot=root local zroot/fbsd/9.1-amd64 sharenfs -maproot=root -alldirs local zroot/fbsd/9.1-sparc64 sharenfs -maproot=root -alldirs local Those were created via: zfs set sharenfs="-maproot=root" zroot/fbsd/10.0-amd64 After doing that, the file /etc/zfs/exports was automatically created for me (look, no need to manually edit /etc/exports): root@hostname-135: cat /etc/zfs/exports # !!! DO NOT EDIT THIS FILE MANUALLY !!! /fbsd/10.0-amd64 -maproot=root /fbsd/9.1-amd64 -maproot=root -alldirs /fbsd/9.1-sparc64 -maproot=root -alldirs All I had to do after this was restart my mountd daemon: root@hostname-136: service mountd restart Stopping mountd. Starting mountd. root@hostname-137: ps -auxww | grep mountd root 58779 0.0 0.1 10232 2312 ?? Ss 10:30AM 0:00.01 /usr/sbin/mountd -r /etc/exports /etc/zfs/exports Make sure that you have the appropriate NFS daemons started in your server's /etc/rc.conf: # NFS server things # (inetd is needed for tftpd) inetd_enable="YES" mountd_enable="YES" mountd_flags="-r" nfs_server_enable="YES" nfs_server_flags="-u -t -n 4" rarpd_enable="YES" rpcbind_enable="YES" rpc_lockd_enable="YES" rpc_statd_enable="YES" I enable inetd because I need to have tftpd running for diskless booting of my sparcs when I play with them, along with some other, older machines. The examples above work fine for me on FreeBSD 9.1, and I've done the same thing on FreeBSD 10.1 too - this has worked fine for pretty long time. -Kurt