NFS (Network File System) mount timeouts happen when a client cannot establish or maintain a connection to the NFS server, often due to network issues, server unresponsiveness, or misconfigured export options. This guide walks you through diagnosing and fixing the most common causes of NFS mount timeouts on Linux, from checking basic connectivity to adjusting mount and server settings.
What You’ll Need
- Root or sudo access on both the NFS client and server
- IP addresses or hostnames of the NFS server and client
- Access to the command line on both machines
- Basic familiarity with Linux networking commands (ping, ip, etc.)
Step-by-Step
- Verify basic network connectivity. From the client, ping the server’s IP address:
ping. If ping fails, check the network path, firewall rules, and that the server is up. If ping works but NFS times out, the issue is likely at a higher layer. - Check if the NFS server is reachable on the expected ports. NFS uses port 2049 for the NFS service itself, plus auxiliary services (mountd, rpcbind) that may use dynamic ports. Use
rpcinfo -pfrom the client to list the RPC services. If this times out, the server’s rpcbind or firewall may be blocking access. - Verify the NFS export is available. Run
showmount -eon the client. This lists the server’s exported directories. If this fails, the export may be restricted to specific clients, or the NFS server service may not be running. - Check the server’s NFS service status. On the server, run
systemctl status nfs-server(ornfs-kernel-serveron Debian/Ubuntu). Ensure it is active and running. If not, start it withsystemctl start nfs-serverand enable it to start on boot withsystemctl enable nfs-server. - Review the server’s /etc/exports file. Ensure the directory you want to mount is listed correctly, with the proper options and the client’s IP or subnet. For example:
/srv/nfs 192.168.1.0/24(rw,sync,no_subtree_check). After editing, runexportfs -rato reload the exports. - Check client-side mount options. When mounting, use options that are more tolerant of transient network issues. For example:
mount -t nfs -o soft,timeo=50,retrans=2. The:/srv/nfs /mnt/nfs softoption makes the client return an error after retries instead of hanging.timeois the timeout in tenths of a second (50 = 5 seconds). - Test the mount manually. Instead of mounting via fstab, try mounting manually first. This isolates whether the issue is with the mount command or with the automatic mount at boot. Use the command from step 6 and check for error messages.
- Check the client’s /etc/fstab entry. If you mount via fstab, ensure the options are correct. A typical entry looks like:
. If you use:/srv/nfs /mnt/nfs nfs defaults,soft,timeo=50,retrans=2 0 0 hard(the default), a server outage can cause the client to hang indefinitely. - Inspect firewall rules. On both server and client, ensure that NFS-related ports are allowed. For the server, allow TCP/UDP port 2049, and the ports used by rpcbind (111) and mountd (often 20048, but can vary). You can check the mountd port with
rpcinfo -p. If using firewalld, usefirewall-cmd --add-service=nfs --permanentand reload. - Check for network issues like packet loss or MTU problems. Use
ping -M do -s 1472to test if jumbo frames (MTU 9000) are causing issues. If the ping fails, try with a smaller size. If you suspect MTU, set the client’s interface MTU to a lower value (e.g., 1500) and test again. - Look at system logs. On the client, check
dmesg | tailandjournalctl -u nfs-client.targetfor NFS-related errors. On the server, checkjournalctl -u nfs-server. These logs often contain specific error messages that point to the root cause. - Test with NFSv4 vs NFSv3. If you are using NFSv4, try mounting with
-o vers=3to see if the issue is version-specific. Conversely, if you are using NFSv3, tryvers=4. Some firewalls or configurations handle one version better than the other.
Common Mistakes
- Using the
hardmount option by default. Hard mounts cause the client to hang indefinitely when the server is unreachable. Usesoftunless you have a specific reason for hard mounts (e.g., to avoid data corruption on some workloads). - Forgetting to export the directory with the correct client access. If the export is restricted to a specific IP, and the client’s IP is not in the list, the mount will fail. Always verify with
showmount -e. - Blocking NFS ports in the firewall. NFS uses multiple ports, and if only port 2049 is open, the mount may still fail because rpcbind or mountd are blocked. Open all necessary ports.
- Ignoring DNS resolution. If you use hostnames in /etc/exports or fstab, ensure both client and server can resolve each other’s hostnames. Use IP addresses to rule out DNS issues.
- Not reloading exports after editing /etc/exports. You must run
exportfs -raon the server for changes to take effect.
Tips
- Use
mount -vto see verbose output during the mount attempt; it often shows where the process is hanging. - For troubleshooting, try mounting with
nfsvers=3andtcpexplicitly, as some older configurations may default to UDP, which is more prone to timeouts. - If you have a flaky network, consider using the
retransoption to limit the number of retransmissions before giving up. - On the server, check the NFS service’s status with
systemctl status nfs-serverand ensure it is not in a failed state. - Use
ss -tulpn | grep 2049on the server to confirm the NFS service is listening on the expected port.
Troubleshooting
If you’ve followed the steps and still experience timeouts, consider the following:
- Check the server’s load. If the server is overloaded, it may not respond to NFS requests in time. Use
toporhtopto check CPU and memory usage. - Examine the server’s export options. Some options like
synccan cause delays if the server’s storage is slow. Tryasynctemporarily to see if performance improves (but be aware of data integrity trade-offs). - Test with a different client. If another client can mount without issues, the problem is likely specific to your client’s configuration or network path.
- Use
straceon the mount command. Runstrace -f mount -t nfs ...to see exactly where the system call hangs. This is advanced, but can reveal issues like stuck DNS lookups. - Consider using automount. Instead of a static fstab entry, use autofs to mount the NFS share on demand. This can avoid boot-time timeouts if the server is temporarily unavailable.
- Check for network routing issues. Use
tracerouteto see if packets take an unusual path or get dropped. If you see high latency or packet loss, the issue may be outside your control.
Frequently Asked Questions
Why does my NFS mount hang at boot?
This is often due to a hard mount option in /etc/fstab, which causes the system to wait indefinitely for the server. Switch to soft and add nofail to allow the system to boot even if the mount fails.
What is the difference between soft and hard mounts?
With soft, the client gives up after a certain number of retries and returns an error. With hard, the client keeps retrying forever, which can cause processes to hang. soft is generally better for desktop use, while hard is sometimes preferred for servers to avoid data corruption.
How do I check if the NFS server is exporting a directory?
Use showmount -e from the client. This lists all exported directories. If it fails, the server may not be running or the export list is empty.
What ports need to be open for NFS?
Port 2049 (NFS), port 111 (rpcbind), and the port for mountd (often 20048, but check with rpcinfo -p). If you use NFSv4, you may only need port 2049, but rpcbind is still used for some operations.
Why does NFS work with IP but not with hostname?
This is usually a DNS or /etc/hosts resolution problem. Ensure both client and server have correct entries in /etc/hosts or that DNS is working properly.
Can I increase the timeout value to avoid timeouts?
Yes, you can increase the timeo value (in tenths of a second) in the mount options. For example, timeo=100 sets a 10-second timeout. However, this may make the system slower to detect a real server failure.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Google Play Store Won’t Connect to Internet
- Windows Window Management Tips & Shortcuts
- Disable Automatic Updates on iPhone (iOS 18)
- Minimize All Windows in Windows: Shortcut Guide
- Android Messages on Desktop: Send & Receive from PC
- Forgot Windows 11 Password? Reset It Now