In my Linux server I have the following options in /etc/exports
/home *(rw,sync,no_subtree_check,no_root_squash)
And I mount from a Mac using
mount -t nfs -o resvport,rw,noatime,soft,intr,rsize=32768,wsize=32768,timeo=900,retrans=3,proto=tcp,vers=3,async 192.168.1.121:/home /Volumes/home
As you can see the server is specifying the sync
but my mount option is using async
, so which one will be used?
sync
andasync
have different meanings for the two different situations.sync
in the client context makes all writes to the file be committed to the server.async
causes all writes to the file to not be transmitted to the server immediately, usually only when the file is closed. So another host opening the same file is not going to see the changes made by the first host.Note that NFS offers "close to open" consistency meaning other clients cannot anyway assume that data in a file open by others is consistent (or frankly, that it is consistent at all if you do not use
nfslock
to add some form of synchronization between clients).sync
in the server context (the default) causes the server to only reply to say the data was written when the storage backend actually informs it the data was written.async
in the server context gets the server to merely respond as if the file was written on the server irrespective of if it actually has written it. This is a lot faster but also very dangerous as data may have a problem being committed!In most cases,
async
on the client side andsync
on the server side. This offers a pretty consistent behaviour with regards to how NFS is supposed to work.Basically what MIfe said; these options are context sensitive. The important part are in the manpages:
and on the (Mac) client:
Note: on a Mac,
mount_nfs(8)
states that theasync
option will only be honored if thenfs.client.allow_async
option innfs.conf(5)
is also enabled (can also be set viasysctl(8)
)So, you can request
async
on the client and write requests will just assume they've reached ther server. Since you specifiedsync
on the server, it will fulfill requests from the client when the data has been actually written to disk. (Of course, your local filesystems on the server can also be mounted with "sync", though "async" seems to be the default)A word on your mount options on the client: * rsize & wsize are set to 32768 by default for TCP mounts. * proto=tcp is the default, will fallback to udp if not supported by the server * vers=3 is the default, will fallback to 2 if not supported by the server