Hello,
I'm in trouble with NFS and ZFS. I have the strongly impression that the NFS implementation with export dir and binds are not working correctly (probably with ZFS) or there is somewhere a strange bug. So before I report something I would like opinions
Scenario OMV 3.0.48, opendmediavault-zfs 3.0.4
Clean system. zfs mounts on /mnt/tank0, no nfs enabled on gui, no /export, /etc/export empty, sharedir TVSeries
Steps:
1) systemctl status zfs-mount.service
● zfs-mount.service - Mount ZFS filesystems
Loaded: loaded (/lib/systemd/system/zfs-mount.service; enabled)
Active: active (exited) since Wed 2016-10-26 19:52:41 CEST; 40s ago
Process: 3385 ExecStart=/sbin/zfs mount -a (code=exited, status=0/SUCCESS)
Main PID: 3385 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/zfs-mount.service
2) enable the NFS (nothing defined to be exported), reboot, all good
3) adding one share (TVSeries). /export/TVSeries created and point to correct path.
mount |grep -i export
tank0/Media on /export/TVSeries type zfs (rw,relatime,xattr,posixacl)
cat /etc/fstab |grep export
/mnt/tank0/Media/TVSeries /export/TVSeries none bind 0 0
4) reboot
5) systemctl status zfs-mount.service
● zfs-mount.service - Mount ZFS filesystems
Loaded: loaded (/lib/systemd/system/zfs-mount.service; enabled)
Active: failed (Result: exit-code) since Wed 2016-10-26 20:06:36 CEST; 29s ago
Process: 1790 ExecStart=/sbin/zfs mount -a (code=exited, status=1/FAILURE)
Main PID: 1790 (code=exited, status=1/FAILURE)
Oct 26 20:06:34 nasbox zfs[1790]: cannot mount '/mnt/tank0': directory is not empty
Oct 26 20:06:35 nasbox zfs[1790]: cannot mount '/mnt/tank0/Media': directory is not empty
Oct 26 20:06:36 nasbox systemd[1]: zfs-mount.service: main process exited, code=exited, status=1/FAILURE
Oct 26 20:06:36 nasbox systemd[1]: Failed to start Mount ZFS filesystems.
Oct 26 20:06:36 nasbox systemd[1]: Unit zfs-mount.service entered failed state.
-mount |grep -i export
/dev/sda1 on /export/TVSeries type ext4 (rw,relatime,errors=remount-ro,data=ordered)
-cat /etc/fstab |grep export
/mnt/tank0/Media/TVSeries /export/TVSeries none bind 0 0
-cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
/export/TVSeries pi-router(rw,fsid=1,subtree_check,insecure)
# NFSv4 - pseudo filesystem root
/export pi-router(ro,fsid=0,root_squash,no_subtree_check,hide)
# ZFS automatic exports
cat /etc/openmediavault/config.xml |grep -C7 export
<freq>0</freq>
<passno>0</passno>
<hidden>1</hidden>
</mntent>
<mntent>
<uuid>9037fff3-d77d-4369-8305-c2d05552caf3</uuid>
<fsname>/mnt/tank0/Media/TVSeries</fsname>
<dir>/export/TVSeries</dir>
<type>none</type>
<opts>bind</opts>
<freq>0</freq>
<passno>0</passno>
<hidden>0</hidden>
</mntent>
</fstab>
ZFS is working but not NFS (directory is empty)
6) reboot again
7) Delete the NFS share (only) and reboot
systemctl status zfs-mount.service
● zfs-mount.service - Mount ZFS filesystems
Loaded: loaded (/lib/systemd/system/zfs-mount.service; enabled)
Active: failed (Result: exit-code) since Wed 2016-10-26 20:15:14 CEST; 23s ago
Process: 1793 ExecStart=/sbin/zfs mount -a (code=exited, status=1/FAILURE)
Main PID: 1793 (code=exited, status=1/FAILURE)
Oct 26 20:15:13 nasbox zfs[1793]: cannot mount '/mnt/tank0': directory is not empty
Oct 26 20:15:14 nasbox zfs[1793]: cannot mount '/mnt/tank0/Media': directory is not empty
Oct 26 20:15:14 nasbox systemd[1]: zfs-mount.service: main process exited, code=exited, status=1/FAILURE
Oct 26 20:15:14 nasbox systemd[1]: Failed to start Mount ZFS filesystems.
Oct 26 20:15:14 nasbox systemd[1]: Unit zfs-mount.service entered failed state.
mount |grep -i export
/dev/sda1 on /export/TVSeries type ext4 (rw,relatime,errors=remount-ro,data=ordered)
cat /etc/fstab |grep export
/mnt/tank0/Media/TVSeries /export/TVSeries none bind 0 0
cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
# NFSv4 - pseudo filesystem root
# ZFS automatic exports
cat /etc/openmediavault/config.xml |grep -C7 export
<freq>0</freq>
<passno>0</passno>
<hidden>1</hidden>
</mntent>
<mntent>
<uuid>9037fff3-d77d-4369-8305-c2d05552caf3</uuid>
<fsname>/mnt/tank0/Media/TVSeries</fsname>
<dir>/export/TVSeries</dir>
<type>none</type>
<opts>bind</opts>
<freq>0</freq>
<passno>0</passno>
<hidden>0</hidden>
</mntent>
</fstab>
ls -l /export/
total 4
drwxr-xr-x 2 root root 4096 Oct 26 20:06 TVSeries
root@nasbox:~# ls -l /export/TVSeries/
total 0
Everything is still there.
9) Remove the lines from the /etc/openmediavault/config.xml,reboot. All are there expect the lines which I delete (of course )
10) Remove the lines from /etc/fstab, reboot. Error on zfs-mount service exists. Directory on /export exists.
11) Reboot on single mode, rename /mnt/tank0 to /mnt/tank0.old and reboot
12) systemctl status zfs-mount.service
● zfs-mount.service - Mount ZFS filesystems
Loaded: loaded (/lib/systemd/system/zfs-mount.service; enabled)
Active: active (exited) since Wed 2016-10-26 20:25:56 CEST; 26s ago
Process: 1789 ExecStart=/sbin/zfs mount -a (code=exited, status=0/SUCCESS)
Main PID: 1789 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/zfs-mount.service
Oct 26 20:25:56 nasbox systemd[1]: Started Mount ZFS filesystems.
So.... conclusion, bad cleanup on /etc/fstab (and directories), blocking correct operation of ZFS, NFS is not working.
Openmediavault bug or openmediavault-zfs bug?