From ArchWiki
Jump to: navigation, search

I can't remember where this was mentioned in the documentation, but for now you can see the example in manpage exports(5) showing no special root NFS export directory.

On the other hand when you do the NFS4 mount on the client side you have to use a path relative to this root. Does this mean the path is only relevant if there is a root? I was going to spend some time experimenting with this in the next couple of days, as getting NFSv4 working involved way too much trial and error for my tastes. The particular issue of whether or not you need a server root seems sufficiently complicated that I wanted to take it up with the developers if I can't find further documentation. It's certainly not true that you need a special NFS root for NFSv3, but there seems to be something going on with NFSv4. Thanks. Pgoetz (talk) 16:18, 16 January 2017 (UTC)
So it looks like NFSv4 does require an NFS export root. Quoting from the exports man page
For NFSv4, there is a distinguished filesystem which is the root of all exported filesystem. This is specified with fsid=root or fsid=0 both of which mean exactly the same thing.
It likely doesn't need to be special in the sense that you create a directory just for exports and bind in everything you want to export, but this seems like the most sensible way to do things given that you must have such a root. Pgoetz (talk) 21:19, 18 January 2017 (UTC)
My interpretation is that the use of /srv/nfs* for the so-called NFS export root stems from the File Hierarchy Standards entry for /srv. While the FHS isn't specific beyond requiring /srv, it posits a couple different approaches for what to put/how to structure entries below /srv: by service type (e.g. nfs, www, smb, svn), or by administrative context (e.g. department name) and then by service type. That said, technically there's nothing requiring NFS exports all live in /srv/nfs* but it seems like good, perhaps common, practice to do so (reduces clutter, simplifies administration, etc.). NFS (including v4) allows any directory to be shared through /etc/exports; it just might get really messy if you export directories from all over your file hierarchy, and it'll complicate or compromise v4's exported pseudo-file system.
Speaking of v4's pseudo-FS, I think we need to be careful not to confuse the server's physical directory structure and what directories are exported from it (possibly collected under a common directory like /srv/nfs), and what clients see as the NFS root via the server's /etc/exports and its fsid=root option. See the NFSv4 RFC 7530, Section 7 "NFS Server Namespace". Regarding the note prompting this discussion (that "NFS shares have to reside in /srv"), the fsid=root points are a separate topic. NFSv4 doesn't require the use of fsid=root in /etc/exports; not using it requires clients to mount exports like with v3, using the full path on the server. Using fsid=root enables v4's pseudo-file system for exports, simplifying client mounts. Vic acid (talk) 04:05, 15 February 2017 (UTC)