What is the correct way to export NFS4 shares?

Recommended Posts

I'm on 6.12.9.


It's my understanding that nfs4 relies on a root file system id where all of the exports live, which is exported with fsid=0. /etc/exports doesn't seem to have this fsid set anywhere which results in shares failing to mount with nfs4 when they work with nfs3. 

The share from /etc/exports:

"/mnt/user/playground" -fsid=122,async,no_subtree_check,async,no_subtree_check,secure)

Take the following /etc/fstab entry: /mnt/nfs/playground nfs defaults,rw 0 0

This correctly mounts the share to /mnt/nfs/playground but negotiates nfs v3. If I add vers=4.2 to the options and try to remount I encounter the following error:

mount.nfs4: mounting failed, reason given by server: No such file or directory


fstab, autofs, and manual mounting all throw the same error.


After running it down and figuring out the path to the share is relative to what's exported as fsid=0 I began looking into how to set that. I can manually edit /etc/exports and change the entry for this share from fsid=122 to 0, which then works when I change the path to However, this does not persist across changes to shares or a reboot.


I've delved into the depths of pages 5+ and search results but can't find anyone specifically laying out how they have their unraid shares set up without having to do any hacky tricks. [1][2]†  My current hack is to create a separate share in the UI named nfs4 and specifying fsid=0 in the rule, which does work:

"/mnt/user/nfs4" -fsid=122,async,no_subtree_check,async,no_subtree_check,secure,fsid=0)

This feels bad and negates a lot of the benefits around shares in general. I can't imagine this is the only (or even correct) way to get this going, but I'm coming up empty on all other attempts. What am I missing here?


† I know this user is having issues with the mount not persisting, but their initial mount still works, where mine does not.

Link to comment

A couple ideas for you to look at:

  • UD uses this as the rule to mount another NFS share on another Unraid server: "*(rw,sec=sys,insecure,anongid=100,anonuid=99,no_root_squash,lock)".
  • UD uses this command to mount a remote NFS share: "/sbin/mount -t 'nfs' -o rw,soft,relatime,retrans=4,timeo=300 'MEDIASERVER:/mnt/user/Public' '/mnt/remotes/MEDIASERVER_Public'"  If you use "-t 'nfs'", nfs will negotiate the version to use, starting with v4..
  • This is the setup of an Unraid NFS share set to "Public": "/mnt/user/Public" -fsid=106,async,no_subtree_check *(rw,sec=sys,insecure,anongid=100,anonuid=99,all_squash)"

These may give you some help in solving your issues.

Link to comment

Right, I get that each entry has it's own fsid, my nfs4 mount technically has two when I have nfs4 working. But from what I've read on nfs4 it relies on an fsid=0 somewhere to act as the root of the exports, then everything else is available under it. It's why setting fsid=0 in the rule for my nfs4 share works and I can mount it as when the actual path to content is /mnt/user/nfs4/playground. When there is no file system with and id of 0 it never finds any of the exports.


I've used both a Debian 12 and Fedora 39 VM (moving from docker to podman and switching to Fedora for more recent version support.) They both fail with the same error. I've tried multiple different hosts of those two flavors, even a fresh install with no modifications fails. I've also tried connecting from my Arch desktop with the same error. 


I've also tried mounting with fstab, autofs, and manually running mount commands. They all fail until I set an export with fsid=0. I don't want to do this at the share level because it lumps everything into one share with the same settings, and when I manually edit /etc/exports to set fsid=0 it gets overwritten with any change on the shares screen.


For illustration, this is how shares are by default. This works with nfs3 just fine as I mount /mnt/user/media or any of those directories. However when I switch to nfs4 it fails I'm heavily assuming because no fsid=0 means nfs doesn't know where the root to start looking from.

mnt (export root)
└── user
    ├── media
    ├── nextcloud
    └── paperless


In order to get nfs4 working I've had to construct my shares like this (note it's 1 share in the UI)

└── user
    └── nfs4 (fsid=0 turns this into the export root)
        ├── media
        ├── nextcloud
        ├── paperless
        └── playground


This is the only way I can get nfs4 working, and the mount path changes from to because fsid 0 is the root of the export.


The way things are currently working for me I'd have to export / with fsid=0 to get pathing to stay /mnt/user/media which I obviously won't do. There has to be something I'm missing.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.