If NFS clients mount the wrong export, edit the exports file and add fsid=N
where N
is an unique number for all exports, to the defined exports and then issue exportfs -arv
.
As part of the concurrency writeup, SQLite mentions NFS as not being lock-safe, which is a statement that has been then imported wholesale and repeated too many times. The statement would have held true for NFSv1 or NFSv2 but all the locking issues with NFS were resolved as of NFSv3 or NFSv4. Nevertheless, it's possible to ensure that NFSv4 is used throughout an organization without needing to worry whether a machine mounted an NFS export using a version lower than 4.2. In order to do this properly, edit the /etc/nfs.conf
file and locate the nfsd
section and then disable all NFS versions lower than 4.2 by commenting out. Also, it does not hurt to be explicit, so explicitly enable NFSv4.2.
[nfsd] # debug=0 # threads=8 # host= # port=0 # grace-time=90 # lease-time=90 # udp=n # tcp=y vers3=n vers4=y vers4.0=n vers4.1=n vers4.2=y # rdma=n # rdma-port=20049
On machines that mounted the NFS exports, the nfsstat
command:
nfsstat -m
can be used to list all NFS mounted shares and check the version that was used to mount the share.
It is also possible to just amend the mount table /etc/fstab
and then explicitly use the options nfsvers
(or the more common synonym vers
) to request a 4.2 version mount, however this would require changes on all machines that mount NFS mounts and it's much better to force a consistent version throughout an organization.
One of the side-advantages of using NFSv4 is that NFSv4 is able to perform copying operations from clients without needing to perform a roundtrip, or, in other words, the client just instructs the server which file should be copied and to which destination and the server performs the file-copy operation itself, which is way faster than having to pull all the data to the client and then push all the data back to the server to the destination file in case rountrip copies were not available. What is also cool about this, is that server-copies are actually implemented as a series of system calls, starting from the lowest levels such that anything that builds on top should just transparently inherit the feature.