5

I am setting up ZFS and NFS on Ubuntu Server 16.04LTS and have a weird issue that is causing me to go crazy. I have set up ZFS and NFS using ZFS shares as described in https://pthree.org/2012/12/31/zfs-administration-part-xv-iscsi-nfs-and-samba/. As you can see in my log below, although I have set zfs-share to run zfs share -a during boot, the shares are still not exported. Even weirder, is that zfs share -a still doesn't when I manually run it. I can only get zfs shares to work if I reset the sharenfs property of one of the shares and then re-run zfs share -a. See below

$ showmount -e
Export list for apu:
/mnt localhost
$ sudo zfs share -a
$ showmount -e
Export list for apu:
/mnt localhost
$ sudo zfs share pool1
cannot share 'pool1': filesystem already shared
$ sudo zfs get sharenfs pool1
NAME   PROPERTY  VALUE     SOURCE
pool1  sharenfs  on        local
$ sudo zfs set sharenfs=on pool1
$ showmount -e
Export list for apu:
/s/apu/a/homes *
/s/apu/a       *
/s/apu/a/sys   *
/mnt           localhost
$ sudo zfs share -a
$ showmount -e
Export list for apu:
/s/apu/b       *
/s/apu/a/homes *
/s/apu/a       *
/s/apu/a/sys   *
/s/apu/b/cwc   *
/mnt           localhost
Jaime R.
  • 51
  • 1
  • 2
  • I don't have an answer but want to direct others with this question to places that may be useful. This question was asked and [answered on StackOverflow](https://stackoverflow.com/a/42533017/9598638). This behavior appears to be a bug in ZFS on Linux and has a currently open [issue on GitHub](https://github.com/zfsonlinux/zfs/issues/7692) (apparently submitted by the author--thank you). If you have this issue as well, commenting on the GitHub issue with additional information about your OS, ZFS, and NFS configurations may be the best way to help the ZFS On Linux developers investigate this. – shappenny Feb 15 '19 at 21:38

2 Answers2

3

My Ubuntu 16.04.05 LTS has a similar problem.

First question: are you using systemd or the older-style init system? 16.04 uses systemd by default and the ZFS components are not really well debugged.

Next time you reboot and your shares are not there, try:

# systemctl restart zfs-share.service 

and then see if the shares are there with showmount. BTW on my system I have a problem with the RPC registration service coming up so you might have to do:

# systemctl start rpcbind.service

if rpcbind isn't running first.

If this mitigates your problem you might consider adding those commands to your system rc file but I just do it manually each time I reboot.

AlanObject
  • 662
  • 2
  • 9
  • 20
1

I also faced this problem under Ubuntu 16.04, but that probably applies to newer versions as well. There is a bug that systemd unit zfs-share.service does not perform sharenfs -a on startup https://github.com/zfsonlinux/zfs/issues/1375

As a workaround, you can add that to /etc/rc.local

sudo zfs unshare -a
sudo zfs share -a

See this discussion for details: https://github.com/zfsonlinux/zfs/issues/2107#issuecomment-47182970

Dmitriusan
  • 367
  • 3
  • 15