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
timeo– Raffa Apr 02 '21 at 19:38man mount: http://manpages.ubuntu.com/manpages/bionic/man8/mount.8.html – Levente Apr 02 '21 at 19:50man mount... look for-torfstype. The options themselves are in man nfs... so basically you would use something likesudo mount -t nfs -o soft,bg,timeo=30 IP:/share /mountpoint– Raffa Apr 02 '21 at 20:36-t nfs4and-v. I made the client the Raspberry. Mounted my laptop's share. Set up a slideshow of images from the laptop's share. Then I sent the laptop to sleep. Slideshow app on Raspberry froze.umount -vsays:"nfs4 mount point detected", and then: "umounted". Subsequentumount -vsays "not mounted". But in the graphical file manager, the mount point keeps showing as "inode/x-corrupted type". Subsequentmount -vattempts return just one line about "trying", then exit. The mount point remains as corrupted inode. – Levente Apr 02 '21 at 21:09umount -fin this case as it might be the only way to refresh the state of the nfs share. It is helpful in case of an unreachable NFS system. – Raffa Apr 02 '21 at 21:44umount -fdo something extra, even after a regularumountaready reports "not mounted"? – Levente Apr 02 '21 at 21:46man umountspecifically under the option-f... here... It refreshes the nfs mount state – Raffa Apr 02 '21 at 21:49umount -f -v, and it worked! It said again, "nfs4 mount point detected", and then: "umounted". The graphical file manager kept showing the mount point as corrupted inode, so I closed the window, then reopened a new one, in which the mount point appears again as a healthy directory. Subsequently I could mount the share on it again. Do you want to add an answer? It could offer a solution that is ahead of several other resources. – Levente Apr 02 '21 at 23:34