I have two devices: a laptop with Ubuntu 20.04, and a Raspberry Pi 4 with Raspberry Pi OS.
Both of these have an identical version of nfs-kernel-server and setup on them.
Both of of these share some of their directories with the other machine, sometimes simultaneously, via the NFS4 protocol.
Due to clumsiness, I quite often manage to interrupt these connections:
- I often shut the Raspberry down, while forgetting to unmount its share on the laptop
- my laptop either goes to sleep, or I log out / reboot, while the Raspberry is accessing its shares
In any case, neither machine in the role of client take these disruptions too well; attempts to unmount after-the-fact do not go well (endless waiting without any results), and other things can get impacted too: my Ubuntu sometimes starts to complain that no application is associated with opening .txt files (!)
Question:
How can I somehow reset these interrupted NFS connections on the clients (without rebooting)? 1.) To ease the unmounting 2.) To allow for a clean slate start for re-mounting.
Details:
nfs-common version on both machines: 1.3.4-2.5
All these mounts are initiated manually (by running a script, on demand); none of them are in /etc/fstab. I have not supplied any options with the mount command whatsoever; it's as plain as:
sudo mount IP:/share /mountpoint 11 1 Answer
You need to use the options
soft,bg, and probablytimeolike so:sudo mount -t nfs -o soft,bg,timeo=30 IP:/share /mountpointPlease see man nfs for information and usage.
When the connection to the NFS share is interrupted, refresh the mount-point with
umount -flike so:sudo umount -f /mountpointThen mount the NFS share again with the same options above.
Please see man umount for information and usage.