Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Mar 2008 11:27:19 -0600
From:      "Scot Hetzel" <swhetzel@gmail.com>
To:        "Michael Jung" <mikej@paymentallianceintl.com>
Cc:        Pawel Jakub Dawidek <pjd@freebsd.org>, marck@rinet.ru, current@freebsd.org
Subject:   Re: ZFS sharenfs and NFS options
Message-ID:  <790a9fff0803050927p2ea00523sd259adff06e98cde@mail.gmail.com>
In-Reply-To: <ADC733B130BF1D4A82795B6B3A2654E2A49123@exchange.paymentallianceintl.com>
References:  <20080304233327.B19039@woozle.rinet.ru> <ADC733B130BF1D4A82795B6B3A2654E2A49091@exchange.paymentallianceintl.com> <790a9fff0803041838m2e9e124fnfc2560fde62f0e08@mail.gmail.com> <20080305094125.G19039@woozle.rinet.ru> <ADC733B130BF1D4A82795B6B3A2654E2A49123@exchange.paymentallianceintl.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/5/08, Michael Jung <mikej@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@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@zega) /etc/zfs#
>
>  (root@zega) /etc/zfs# cat /etc/zfs/exports
>
> # !!! DO NOT EDIT THIS FILE MANUALLY !!!
>
>
> (root@zega) /etc/zfs#
>
>  (root@zega) /etc/zfs# showmount -e
>  Exports list on localhost:
>  /export0                           10.0.0.3
>  (root@zega) /etc/zfs#
>
>  (root@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@zega.mikej.com:/usr/obj/usr/src/sys/ZEGA
>  i386
>  (root@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



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