I have a number of ZFS file systems intended to be exported:
$ sudo zfs get sharenfs NAME PROPERTY VALUE SOURCE zpool0 sharenfs off local zpool0/books sharenfs [email protected]/24 local zpool0/music sharenfs [email protected]/24 local zpool0/photo sharenfs [email protected]/24 local zpool0/video sharenfs [email protected]/24 local [...]
These are the only file systems intended to be exported via NFS, so they are not listed in
$ grep -v '^#' < /etc/exports | wc -c 0
Unfortunately this seems to mean that the nfs kernel service won't register the various RPC services needed for the ZFS system to export the relevant file systems:
$ sudo systemctl status nfs-kernel-server.service ● nfs-kernel-server.service - LSB: Kernel NFS server support Loaded: loaded (/etc/init.d/nfs-kernel-server) Active: active (exited) since Sun 2017-06-25 13:18:48 IST; 10h ago Process: 3867 ExecStart=/etc/init.d/nfs-kernel-server start (code=exited, status=0/SUCCESS) Jun 25 13:18:48 jupiter nfs-kernel-server: \\ Not starting NFS kernel daemon: no exports. ... (warning). Jun 25 13:18:48 jupiter systemd: Started LSB: Kernel NFS server support.
(I added a line break at the point marked with
\\ so that the relevant message would be clearly shown).
As a result the needed RPC services are not registered:
$ /usr/sbin/rpcinfo -p localhost program vers proto port service 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 60457 status 100024 1 tcp 55306 status
Notice that for example the mount and stat services are not registered. Hence ZFS cannot export its own file systems.
I'm seeing this problem on Debian version 8.8:
$ dpkg -l nfs-kernel-server zfsutils-linux [...] ii nfs-kernel-server 1:1.2.8-9 amd64 support for NFS kernel server ii zfsutils-linux 0.6.5.9-2~bpo8+1 amd64 command-line tools to manage OpenZFS filesystems
This did used to work, but since I reboot the NFS server very rarely it's possible that when I last booted it there was some entry in
/etc/exports which would have prevented this problem.
I believe I have correctly set ZFS up to export the filesystems:
$ grep -B2 ZFS_SHARE /etc/default/zfs # Run `zfs share -a` during system start? # nb: The shareiscsi, sharenfs, and sharesmb dataset properties. ZFS_SHARE='yes'
Any ideas how I can solve this? I could hand-hack this conditional in
if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' $export_files then do_modprobe nfsd
... but that seems inelegant and likely to be reversed by future updates.