When dealing with NFS shares, there's often confusion about whether server-side export options (/etc/exports
) or client-side mount options take precedence. In your case, the server specifies sync
while the client requests async
.
The NFS protocol handles this conflict in a specific way:
- Server's sync: Forces synchronous writes to disk before acknowledging write requests
- Client's async: Allows the client to cache writes and acknowledge before server persistence
Actual behavior depends on NFS version and server configuration. For NFSv3 (which you're using), the server's sync option will override the client's async request.
Check the active mode on your Mac client:
nfsstat -m
Example output showing enforced sync mode:
/Volumes/home from 192.168.1.121:/home
-- Original mount options:
General mount flags: 0x0
NFS parameters: vers=3,tcp,rsize=32768,wsize=32768,hard,intr,noatime
-- Current mount parameters:
General mount flags: 0x0
NFS parameters: vers=3,tcp,rsize=32768,wsize=32768,hard,intr,noatime,sync
If you need async behavior:
- Server-side change (preferred for consistency):
/home *(rw,async,no_subtree_check,no_root_squash)
- Client-side workaround (not recommended for production):
mount -t nfs -o nocto,async ...
The
nocto
option helps but doesn't fully bypass server sync requirements.
Mode | Data Safety | Performance |
---|---|---|
sync | High (data written to disk) | Slower (waits for disk) |
async | Lower (potential data loss) | Faster (acknowledges writes early) |
Here's how to properly configure async operation end-to-end:
Server /etc/exports
:
/data 192.168.1.0/24(rw,async,no_subtree_check)
Client mount command:
mount -t nfs -o vers=3,async,rsize=65536,wsize=65536 \
192.168.1.121:/data /mnt/data
When dealing with NFS shares, the synchronization behavior can be specified at both server (/etc/exports
) and client (mount options) levels. The example shows:
# Server configuration (/etc/exports)
/home *(rw,sync,no_subtree_check,no_root_squash)
# Mac mount command
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
In NFS implementations, the client-side mount options generally override server export options when there's a direct conflict. The async
flag in your Mac's mount command will take effect despite the server's sync
setting.
This behavior difference has important consequences:
# Server expects synchronous writes (data+metadata written to disk before ACK)
# Client performs asynchronous writes (ACK before disk commit)
This mismatch could lead to data integrity risks if the client crashes between write acknowledgment and actual disk commit.
For production environments where data integrity is critical:
# Server exports file
/home *(rw,sync,no_subtree_check)
# Client mount command (matching sync)
mount -t nfs -o resvport,sync,proto=tcp,vers=3 192.168.1.121:/home /mnt/nfs
Verify actual NFS behavior using:
nfsstat -m
# Look for "sync" or "async" in the mounted share attributes
For developers building applications on NFS mounts, always implement proper file locking and consider adding application-level write verification when async is used.