Nfs – Why ZFS file system is not shared after boot

network-sharenfszfs

I turn on sharenfs for ZFS file system, but after reboot it is not shared. And I need to turn file system share again.

Here how it looks:

user@ht ~ $ sudo zfs get sharenfs
NAME          PROPERTY  VALUE     SOURCE
family        sharenfs  off       local
family/album  sharenfs  on        local

As you can see sharenfs is on. But file system is not shared:

user@ht ~ $ showmount -e 
Export list for ht:
user@ht ~ $

When I set sharenfs again. File system is shared and I can mount it:

user@ht ~ $ sudo zfs set sharenfs=on family/album
user@ht ~ $ showmount -e 
Export list for ht:
/media/user/family/album *

UPD

My system is Linux Mint 18.0

$ uname -a
Linux kes-desktop 4.8.0-30-generic #32~16.04.1-Ubuntu SMP Fri Dec 2 03:43:51 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

UPD2

I expect it is shared automatically according to doc

ZFS can automatically share file systems by setting the sharenfs property.

UPD3

$ cat /etc/default/zfs
ht default # cat zfs
ZFS_AUTOIMPORT_TIMEOUT='30'
ZFS_SHARE='no'
ZFS_UNSHARE='no'
ZFS_DKMS_ENABLE_DEBUG='no'
ZFS_DKMS_ENABLE_DEBUG_DMU_TX='no'
ZFS_DKMS_DISABLE_STRIP='no'

Best Answer

You have to set the following options in /etc/default/zfs.

ZFS_SHARE='yes'
ZFS_UNSHARE='yes'

This will start the NFS exports of zfs pools which additionally have the sharenfs set to on or valid NFS export options.

I also would recommend to read this documention.

Related Topic