NFSv4 is great. It does wonderful things. And you only have to mount the export root from your host to get access to all the exports beneath it. This makes life really easy. One line in your fstab per host. Only it breaks the autofs demon. Fortunately the script to generate an automount map is really really simple.
Install autofs and nfs-common packages.
Edit /etc/auto.master to mount /etc/auto.nfs4 somewhere sensible
Put something like this in /etc/auto.nfs4. Read the comments.
#!/bin/bash
# /etc/auto.nfs4
# This file must be executable to work! chmod 755
# This is very simple
opts="-fstype=nfs4,nodev,nosuid,nonstrict,nodev,sync,_netdev,proto=tcp,retry=10,rsize=8192,wsize=8192,soft"
# Just echo options, a hostname and the export root.
echo "${opts} ${1}:/"
Also this might help:
#/etc/idmapd.conf
[General]
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = somedomain.local
[Mapping]
Nobody-User = nobody
Nobody-Group = nobody
#[Translation] # Probably not needed.
#Method = nsswitch
Also loading the NFS module on boot fixes a few weird behaviours, what file your system keeps the modules it loads on boot is anybodys guess, on gentoo:
echo "nfs" >> /etc/modules.autoload.d/kernel-2.6
Or on *buntu and probably debian
echo "nfs" | sudo tee >> /etc/modules




