Can I use zfs property sharenfs with 13.3 CORE?

Hi,

I am experimenting with using NFSv4 and realized that I have set the zfs property sharenfs manually to ON (at least for existing shares, did not try to set up a new one).

Has anyone any experience with this? Is there a possibility that I break something when I do this?

I tested it with a single share and found it in /etc/zfs/exports afterwards. I could create and edit a file. Everything seemed to work normally.

Why do you need to use sharenfs? What’s wrong with the default way of exporting an NFS share?

I have many nested shares and exporting those never worked for me. I have set up autofs and it serves me well.

Hm, after restarting TrueNAS the zfs property sharenfs is unchanged but the file /etc/zfs/exports is empty.

Haven’t tried it myself, but it sounds like it will work as intended, until the next TrueNAS update.[1]

Once you circumvent the GUI or middleware, you take on a risk and will make troubleshooting trickier.


  1. Does a reboot preserve the /etc/zfs/exports file with your modifications? EDIT: Just saw your reply. ↩︎

When I revert the zfs property to sharenfs=off and still leave the GUI setting to NFSv4, which version of NFS will I be getting in the end?

sharenfs and sharesmb are unsupported on truenas and may result in unexpected behavior due to undesigned interaction with the middleware backend configuration for exports. We explicitly disable in linux versions of TrueNAS for this reason.

That said, it’s your server, you can do what you want (with the caveat that if you break it, you get to pick up the pieces). Just make sure to document for the next guy.

1 Like

Got it. And already re-set sharenfs to off on that particular dataset. I just thought NFSv4 on ZFS was somehow connected to the sharenfs property. So I still get NFSv4 and don’t need to start rpc_lockd and rpc_statd on my client?

There’s a global setting on the NFS server to enable v4. C.f. docs.

I know. And I set it accordingly. My question was whether I now don’t need to start rpc_lockd and rpc_statd on the clients that are mounting the shares with the nfsv4 option.

Right now, my best practice is:

  1. Exports the dataset and all its nested/sub datasets.
  2. Enable NFSv4 only.
  3. Mount that dataset only in the NFS client. Don’t mount the nested datasets.
  4. If you cannot find/access the nested datasets on your NFS client, try to umount and remount it.

This method helps me a lot, and I hope it can help you as well. There is no need to modify the system settings using the unsupported CLI.