Linux/nfs: Difference between revisions
< Linux
(Created page with "== Restart NFS Client == You forced lazy unmount, but now your dmesg is still filled with: [4321018.374470] nfs: server my-nfs-store not responding, timed out [4321031.750618] nfs: server my-nfs-store not responding, timed out Restart client nfs services: sudo systemctl restart nfs-client.target rpcbind change /etc/fstab to: MYNFSSERVER:/shared_dir /mnt/your_mount_point nfs rw,soft,intr,bg,timeo=100,retrans=2 0 0 • soft: Tells the client to return an I/O e...") |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== Restart NFS Client == | == Restart NFS Client == | ||
Stuck nfs: | |||
umount -f -l /nfs-mount | |||
You forced lazy unmount, but now your dmesg is still filled with: | You forced lazy unmount, but now your dmesg is still filled with: | ||
| Line 5: | Line 8: | ||
[4321031.750618] nfs: server my-nfs-store not responding, timed out | [4321031.750618] nfs: server my-nfs-store not responding, timed out | ||
Method 1: Flush the Kernel RPC State | |||
sudo systemctl restart nfs-client.target rpcbind | sudo systemctl restart nfs-client.target rpcbind | ||
Method 2: Flush the System Inode & Dentry Caches | |||
sudo sync | |||
sudo echo 2 > /proc/sys/vm/drop_caches | |||
Method 3: Temporarily Fake the Network Target (The "Trick" Fix) | |||
# Assign that IP to your loopback interface (should be in the log) | |||
sudo ip addr add <SERVER_IP>/32 dev lo | |||
# wait 30 seconds, for it to get rejected, then.. | |||
sudo ip addr del <SERVER_IP>/32 dev lo | |||
# to get ip address of connections | |||
grep -R . /sys/kernel/debug/sunrpc/rpc_clnt/*/xprt | |||
Method 4: Clear the Stuck Kernel Threads | |||
sudo systemctl stop nfs-client.target | |||
sudo nfsidmap -c | |||
sudo systemctl start nfs-client.target | |||
Long term fix: | |||
Change /etc/fstab to: | |||
MYNFSSERVER:/shared_dir /mnt/your_mount_point nfs rw,soft,intr,bg,timeo=100,retrans=2 0 0 | MYNFSSERVER:/shared_dir /mnt/your_mount_point nfs rw,soft,intr,bg,timeo=100,retrans=2 0 0 | ||
* soft: Tells the client to return an I/O error to the application after a timeout, instead of hanging forever. | |||
* intr: Allows you to interrupt stuck processes (like using Ctrl + C). | |||
* bg: If the server is offline during a system reboot, Ubuntu will mount it in the background instead of stalling your entire boot process. | |||
* timeo=100: Sets the timeout to 10 seconds before retrying. | |||
== keywords == | |||
Latest revision as of 22:19, 3 November 2026
Restart NFS Client
Stuck nfs:
umount -f -l /nfs-mount
You forced lazy unmount, but now your dmesg is still filled with:
[4321018.374470] nfs: server my-nfs-store not responding, timed out [4321031.750618] nfs: server my-nfs-store not responding, timed out
Method 1: Flush the Kernel RPC State
sudo systemctl restart nfs-client.target rpcbind
Method 2: Flush the System Inode & Dentry Caches
sudo sync sudo echo 2 > /proc/sys/vm/drop_caches
Method 3: Temporarily Fake the Network Target (The "Trick" Fix)
# Assign that IP to your loopback interface (should be in the log) sudo ip addr add <SERVER_IP>/32 dev lo # wait 30 seconds, for it to get rejected, then.. sudo ip addr del <SERVER_IP>/32 dev lo
# to get ip address of connections grep -R . /sys/kernel/debug/sunrpc/rpc_clnt/*/xprt
Method 4: Clear the Stuck Kernel Threads
sudo systemctl stop nfs-client.target sudo nfsidmap -c sudo systemctl start nfs-client.target
Long term fix:
Change /etc/fstab to:
MYNFSSERVER:/shared_dir /mnt/your_mount_point nfs rw,soft,intr,bg,timeo=100,retrans=2 0 0
- soft: Tells the client to return an I/O error to the application after a timeout, instead of hanging forever.
- intr: Allows you to interrupt stuck processes (like using Ctrl + C).
- bg: If the server is offline during a system reboot, Ubuntu will mount it in the background instead of stalling your entire boot process.
- timeo=100: Sets the timeout to 10 seconds before retrying.