Skip to main content
RunBook Academy

LinuxXVIII · Enterprise StorageNFS

NFS client - mounting and operating network filesystems

Intermediate⏱ ~10 minbashmountshowmountnfsstat

What you'll learn

  • Mount an NFS export with appropriate options
  • Use _netdev and nofail for safe boot behavior
  • Troubleshoot common NFS mount failures
  • Configure NFS for production workloads

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

NFS is the standard Linux network filesystem. The NFS client mounts a remote export and presents it as a local directory. Understanding the mount options, the network dependencies, and the failure modes is essential for production.

Discovering exports

Read-only / Safeshowmount -e
$ showmount -e nfs-server.example.com
Export list for nfs-server.example.com:
/export/data  10.0.0.0/24
/export/home  10.0.0.0/24

Mounting an NFS export

Configuration changemount NFS
$ mount -t nfs -o vers=4.1,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600 nfs-server:/export/data /mnt/nfs

fstab entry

Read-only / SafeNFS in fstab
$ grep nfs /etc/fstab
nfs-server:/export/data /mnt/nfs nfs4 _netdev,nofail,hard,timeo=600,retrans=3 0 0

NFS mount options

OptionEffectWhen to use
vers=4.1 (or vers=4.2)NFS versionRequired for modern kernels
proto=tcpTCP transportRequired for NFSv4
rsize=N / wsize=NRead/write block sizeMatch to server (1 MB typical)
hardRetry indefinitely on failureProduction: avoid silent data loss
softReturn error after timeoutAvoid in production
timeo=NTimeout in deciseconds (60 = 6 sec)Default 60, increase to 600 for slow links
retrans=NNumber of retriesDefault 3, increase to 6 for unreliable links
rsize=1048576,wsize=10485761 MB block sizeMatch to server MTU
lookupcache=pos or lookupcache=noneCaching modepos for POSIX; none for changing data
noaclDisable ACL processingWhen ACLs are not needed
sec=sys / sec=krb5Security modesys for local; krb5 for Kerberos

Troubleshooting NFS mount failures

Read-only / Safemount verbose
$ mount -v -t nfs nfs-server:/export/data /mnt/nfs 2>&1 | head -10
mount.nfs: timeout set for Sat Jan 15 10:00:00 2026
mount.nfs: trying text-based options 'vers=4.1,addr=10.0.0.10,clientaddr=10.0.0.20'
mount.nfs: mount(2): Connection refused
SymptomLikely causeFix
Connection refusedNFS service not running, firewallsystemctl status nfs-server and check firewall
Connection timed outNetwork issue, no routeping nfs-server, check routing
Permission deniedExport does not allow your client IPCheck /etc/exports on server, add your client IP
Stale file handleNFS server lost the export, client has open filesumount /mnt/nfs and remount
No such file or directoryExport path is wrong on serverCheck /etc/exports on server

Knowledge check

Knowledge check · 3 questions

  1. Q1. What does the hard mount option in NFS mean?

  2. Q2. For production NFS mounts, _netdev is mandatory.

  3. Q3. Which of the following are correct NFS practices? Select all that apply.

Passing score: 75%. Answers are checked in this browser.