Re: ZFS sharenfs and NFS options

From: Scot Hetzel <swhetzel_at_gmail.com>
Date: Wed, 5 Mar 2008 11:27:19 -0600
On 3/5/08, Michael Jung <mikej_at_paymentallianceintl.com> wrote:
> When does /etc/zfs/exports get written?
>
It gets updated when you change the sharenfs property of a zfs filesystem.

>  Should you have to HUP mountd after adding the nfs share via "zfs set
>  sharenfs=....."? it doesn't make any difference for me.
>
>  Should showmount -e show the zfs exported NFS share?
>

showmount will show the zfs exported NFS share that is added to
/etc/zfs/exports:

hp010# zfs set sharenfs=on myzpool/test
hp010# showmount -e
Exports list on localhost:
/myzpool/test                      Everyone
hp010# zfs inherit sharenfs myzpool/test
hp010# showmount -e
Exports list on localhost:


>  (root_at_zega) /etc/zfs# zfs get sharenfs tank/export1
>  NAME          PROPERTY  VALUE
>  SOURCE
>  tank/export1  sharenfs  -maproot=root -alldir -network 10.0.0.3 -mask
>  255.255.255.255  local
>  (root_at_zega) /etc/zfs#
>
>  (root_at_zega) /etc/zfs# cat /etc/zfs/exports
>
> # !!! DO NOT EDIT THIS FILE MANUALLY !!!
>
>
> (root_at_zega) /etc/zfs#
>
>  (root_at_zega) /etc/zfs# showmount -e
>  Exports list on localhost:
>  /export0                           10.0.0.3
>  (root_at_zega) /etc/zfs#
>
>  (root_at_zega) /etc/zfs# uname -a
>  FreeBSD zega.mikej.com 7.0-STABLE FreeBSD 7.0-STABLE #2: Sun Mar  2
>  20:39:38 UTC 2008     mikej_at_zega.mikej.com:/usr/obj/usr/src/sys/ZEGA
>  i386
>  (root_at_zega) /etc/zfs#
>
>  NOTE****** /export0 is exported via /etc/exports
>
>  Needless to say, I'm not able to mount export1 on 10.0.0.3 when I share
>  it via the "zfs set sharenfs" command.
>
>  exporting the ZFS mount point via /etc/exports works fine.
>
Make sure that zfs_enable="YES" is in rc.conf, restart
/etc/rc.d/mountd, then the mountd command will use both /etc/exports
and /etc/zfs/exports.

So to do nfs with ZFS, all you need to do is:

1. add zfs_enable="YES" to /etc/rc.conf
2. restart mountd (i.e. /etc/rc.d/mountd restart)
3. add your zfs shares:
  zfs sharenfs=on myzpool/test1
  zfs sharenfs="-maproot=root -alldir -network 10.0.0.3 -mask
255.255.255.255" myzpool/test2

NOTE: sharenfs=on creates a nfs share that is available to everyone.

You should now be able to mount the zfs nfs filesystems on other
systems or locally.

mount -t nfs myserver:/myzpool/test1 /mnt

Unlike /etc/exports, zfs nfs shares are available immediately, no need
to restart mountd.

Scot
Received on Wed Mar 05 2008 - 16:27:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:28 UTC