sodcalculator

10 Tech How-To

NFS Mount Timeout: Step-by-Step Troubleshooting

Guide 10-59849 · Updated · Step by step

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

  1. 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.
  2. 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 -p from the client to list the RPC services. If this times out, the server’s rpcbind or firewall may be blocking access.
  3. Verify the NFS export is available. Run showmount -e on 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.
  4. Check the server’s NFS service status. On the server, run systemctl status nfs-server (or nfs-kernel-server on Debian/Ubuntu). Ensure it is active and running. If not, start it with systemctl start nfs-server and enable it to start on boot with systemctl enable nfs-server.
  5. 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, run exportfs -ra to reload the exports.
  6. 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 :/srv/nfs /mnt/nfs. The soft option makes the client return an error after retries instead of hanging. timeo is the timeout in tenths of a second (50 = 5 seconds).
  7. 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.
  8. Check the client’s /etc/fstab entry. If you mount via fstab, ensure the options are correct. A typical entry looks like: :/srv/nfs /mnt/nfs nfs defaults,soft,timeo=50,retrans=2 0 0. If you use hard (the default), a server outage can cause the client to hang indefinitely.
  9. 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, use firewall-cmd --add-service=nfs --permanent and reload.
  10. Check for network issues like packet loss or MTU problems. Use ping -M do -s 1472 to 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.
  11. Look at system logs. On the client, check dmesg | tail and journalctl -u nfs-client.target for NFS-related errors. On the server, check journalctl -u nfs-server. These logs often contain specific error messages that point to the root cause.
  12. Test with NFSv4 vs NFSv3. If you are using NFSv4, try mounting with -o vers=3 to see if the issue is version-specific. Conversely, if you are using NFSv3, try vers=4. Some firewalls or configurations handle one version better than the other.

Common Mistakes

  • Using the hard mount option by default. Hard mounts cause the client to hang indefinitely when the server is unreachable. Use soft unless 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 -ra on the server for changes to take effect.

Tips

  • Use mount -v to see verbose output during the mount attempt; it often shows where the process is hanging.
  • For troubleshooting, try mounting with nfsvers=3 and tcp explicitly, as some older configurations may default to UDP, which is more prone to timeouts.
  • If you have a flaky network, consider using the retrans option to limit the number of retransmissions before giving up.
  • On the server, check the NFS service’s status with systemctl status nfs-server and ensure it is not in a failed state.
  • Use ss -tulpn | grep 2049 on 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 top or htop to check CPU and memory usage.
  • Examine the server’s export options. Some options like sync can cause delays if the server’s storage is slow. Try async temporarily 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 strace on the mount command. Run strace -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 traceroute to 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

The whole Tech How-To bed →