Linux NFS Mount — Server Not Responding Fix
In this tutorial, you'll learn about Linux NFS Mount. We cover key concepts, practical examples, and best practices.
NFS mounts fail with "mount.nfs: Connection timed out", "mount.nfs: Server not responding", or the mount hangs indefinitely. These occur when the NFS server is unreachable, firewall blocks the ports, the export is misconfigured, or the NFS service is not running.
The Problem
sudo mount -t nfs server:/export /mnt
Error:
mount.nfs: Connection timed out
Or the command hangs with no output. After forcing a disconnect:
mount.nfs: Connection reset by peer
Wrong Approach
# WRONG — randomly choosing NFS versions
sudo mount -t nfs4 server:/export /mnt
sudo mount -o vers=4 server:/export /mnt
Right Approach
# Test connectivity first
rpcinfo -p server
Expected output:
program vers proto port service
100003 3 tcp 2049 nfs
100003 3 udp 2049 nfs
100005 1 tcp 892 mountd
100005 1 udp 892 mountd
Then mount with explicit options:
sudo mount -t nfs -o vers=4.2,noatime,hard,intr server:/export /mnt
Step-by-Step Fix
Step 1: Check NFS server availability
rpcinfo -p server
showmount -e server
Step 2: Check firewall rules on both sides
# On server — ensure NFS ports are open
sudo firewall-cmd --add-service=nfs --permanent
sudo firewall-cmd --reload
# On client
sudo firewall-cmd --list-all
Step 3: Verify the export exists
showmount -e nfs-server
Expected:
Export list for nfs-server:
/export client-ip
Step 4: Check the NFS server configuration
# On the NFS server
cat /etc/exports
Expected:
/export client-ip(rw,sync,no_subtree_check)
Step 5: Restart NFS services
# On the server
sudo systemctl restart nfs-server
sudo systemctl restart nfs-mountd
sudo exportfs -r
Step 6: Mount with correct options
sudo mount -t nfs -o vers=4.2,hard,intr,timeo=30,retrans=3 server:/export /mnt
Step 7: Auto-mount with fstab
server:/export /mnt nfs vers=4.2,hard,intr,timeo=30,retrans=3,_netdev 0 0
Prevention Tips
- Keep NFS server and client versions compatible
- Open the following ports in the firewall: 2049 (NFS), 111 (portmapper), 892 (mountd)
- Use NFSv4+ for better performance and simpler firewall rules
- Set
timeo=30andretrans=3to avoid long timeouts - Test mounts with
mount -vfor verbose output
Common Mistakes with nfs mount
- Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
- Using
returnto exit a function early instead of wrapping a pure value in the monad - Mixing let bindings with <- bindings in do notation, producing type errors
These mistakes appear frequently in real-world LINUX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro