Mount NFS share on Linux with mount -t nfs server:/path /mnt/local. Persistent via /etc/fstab. On-demand via autofs (mounts when accessed). The team that uses hard mount type with timeo=600,retrans=5 for production has reliable NFS. The team that uses soft risks data corruption on network blips.
Table of contents
- One-off mount
- Persistent mount with fstab
- Hard vs soft mount
- NFS version
- On-demand with autofs
- Unmounting
- Troubleshooting
- FAQ
One-off mount
sudo mount -t nfs server.example.com:/exported/path /mnt/nfs
server:/path is the NFS server and exported path. /mnt/nfs is the local mount point. The team that has the path right has it mounted in seconds.
Persistent mount with fstab
server.example.com:/exported/path /mnt/nfs nfs defaults,_netdev 0 0
_netdev is critical - waits for network before mounting at boot. mount -a to test without reboot. The team that forgets _netdev has boot-time failures.
Hard vs soft mount
hard: client retries indefinitely on errors. Production default.soft: client fails after timeout. Risky for data integrity.
Production-recommended options:
server:/path /mnt/nfs nfs hard,timeo=600,retrans=5,_netdev,noatime 0 0
The team that uses hard has correct behavior on network blips; soft risks corruption.
NFS version
Specify explicitly for predictability:
server:/path /mnt/nfs nfs vers=4.1,_netdev 0 0
- NFSv3: oldest still supported, no Kerberos.
- NFSv4: Kerberos support.
- NFSv4.1: pNFS (parallel NFS).
- NFSv4.2: latest.
The team that uses v4.1+ on modern servers has better throughput with pNFS.
On-demand with autofs
# /etc/auto.master
/mnt/nfs /etc/auto.nfs --timeout=60
# /etc/auto.nfs
share -fstype=nfs,rw server:/exported/path
Accessing /mnt/nfs/share mounts on demand. After 60s idle, unmounts. The team that uses autofs for rarely-accessed shares avoids boot-time dependencies.
Unmounting
umount /mnt/nfs
# or
umount server:/exported/path
If busy: lsof /mnt/nfs to find what’s using it. umount -l for lazy unmount. The team that uses these has clean unmounts.
Troubleshooting
mount.nfs: Connection timed out:
- Network unreachable.
- Firewall blocking (port 2049 + mountd).
- NFS server not running.
mount.nfs: access denied by server:
- Server’s
/etc/exportsdoesn’t include this client.
The team that runs showmount -e server from the client side has export list visibility.
FAQ
What’s the default NFS version?
Modern Linux: NFSv4 (auto-negotiated). Specify explicitly for predictability.
Why is my NFS mount slow?
Default options (add noatime,async), wrong NFS version, network latency, or server load. The team that benchmarks with nfsstat -m finds the bottleneck.
Can I have multiple clients write to the same NFS share?
Yes - NFS handles concurrent access via locking. The team that uses NFS for shared home directories or build artifacts has concurrent access working.
What ports does NFS use?
NFSv4: 2049 (TCP). NFSv3: 2049 + mountd + rpcbind (portmap 111).
Is NFS secure?
NFSv3 has no built-in security beyond IP-based access. NFSv4 with Kerberos adds authentication. The team that runs NFS over public internet uses Kerberos or a VPN.
If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.
Useful related references: