WARNING: I’ve made some mistakes in this post. Sorry. Upon further research, I’ve discovered that the Mac automount defaults to NFSv3. I have not yet found a way to force it to use NFSv4.
There is alpha support for NFSv4 when manually mounting an NFS share. The mount command becomes …
$ mount -t nfs -o vers=4.0alpha hostname:/nfsv4_share mountpoint
Once I work out how to get the Mac automount to use NFSv4, I’ll update this post again.
I run NFSv4 on my Linux box to share various directories. I wanted to take advantage of the Mac’s ability to automatically connect to an NFS share by changing directory to /net/hostname/nfs_share. Unfortunately, every attempt to connect resulted in an error message. (No, I can’t remember the error message now.)
The Linux box’s /etc/exports file contained …
# NFSv4 exports.
/srv/nfs4 *.camden.airport.au(ro,sync,fsid=0,crossmnt,no_subtree_check)
/srv/nfs4/flac *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/john *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/mp3 *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/photo *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/public *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/richard *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/video *.camden.airport.au(rw,nohide,sync,no_subtree_check)
Googling revealed what the problem was. I needed to add the insecure keyword to the definition of each NFS share. The Linux machine’s /etc/exports file now reads …
# NFSv4 exports.
/srv/nfs4 *.camden.airport.au(ro,sync,fsid=0,crossmnt,no_subtree_check,insecure)
/srv/nfs4/flac *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/john *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/mp3 *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/photo *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/public *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/richard *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/video *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
After restarting the NFS server the Mac is now able to connect to the NFSv4 shares.
However, there is one quirk that you should be aware of. When connecting to an NFSv4 from another Linux machine, the mount command is …
mount -t nfs4 hostname:/richard /local_mount_point
When connecting to the same NFSv4 share from the Mac, the cd command is …
cd /net/hostname/srv/nfs4/richard
You should notice that Linux NFSv4 client is able to omit the /srv/nfs4 part of the export definition because of the way that that part of the exported directory tree is configured. The Mac does not have the ability to omit the /srv/nfs4 part of the export definition.