autofs + default /net map + NFS4 — how to?

Lev Serebryakov lev at
Thu May 13 20:16:28 UTC 2021

  I have server, named "blob", which exports some shares via NFSv4:

/usr                    -maproot 0:0 -network -mask
... <snip 4 more records for /usr for different networks> ...
/usr/ports              -maproot 0:0 -network -mask
/usr/ports/distfiles    -maproot 0:0 -network -mask
/usr/home               -maproot 0:0 -network -mask
/usr/home/lev           -maproot 0:0 -network -mask
... <snip all other home directories> ...
V4:     /usr    -sec=sys -network -mask
... <snip 4 more records for V4 for different networks> ...

(it is shame, that I need to enumerate all home directories separately, for each my network!)

So, NFSv4 uses "/usr" as export root and exports shares with stripped "/usr" prefix ("/home", /ports" not "/usr/home", "/usr/ports").

I could mount "blob:/home" or "blob:/ports" with mount -t nfs like this:

# mount -t nfs -o nfsv4,tcp blob:/home /mnt
# ls /mnt
.... lev ....
# umount /mnt
# ls /mnt

  No problem, it works.

I've added "nfsv4,tcp" options to "/net" map in "/etc/auto_master", run "automount" and try:

# cd /net/blob/home
/net/blob/home: No such file or directory
# ls /net
# ls /net/blob
# cd /net/blob/usr/home
WARNING: autofs_trigger_one: request for /net/blob/usr/ completed with error 5, pid 1519 (csh)
May 13 23:05:15 hamster automountd[2564]: mount failed
... <snip 4 more repitions of the same> ...
/net/blob/usr/home: Input/output error

Looks like it is because "autofs" uses "showmount -E" to determine available mount points, and "showmount" shows NFSv3 mounts, which conflicts with NFSv4.

Should it work out-of-the-box? Or I need to custom-fix script in "/etc/autofs" (I don't like this idea!)

// Lev Serebryakov

More information about the freebsd-fs mailing list