I have been working on my server, from which I export one directory using NFS.
Of course over the week or so of server reboots, I multiple times forgot to umount
the export filesystem in my workstation (which gets mounted from /etc/fstab
on boot). In between I was able to umount
after the fact and remount (I am not using autofs
):
umount -fl /data0
mount /data0
But this no longer works.
I cannot mount the exported directory from the server on a different directory (mount hangs), but I can nfs mount that exported dir on a virtual machine running on my workstation.
What I tried is removing (rmmod
) the nfs
and nfsv3
module (which would not work: Resource temporarily unavailable
). lsof
hangs. mount
doesn't show anything mounted via nfs
. This is all probably a result of using 'umount -l' multiple times, but the first two times this worked without a problem.
I have restarted the server in the mean time, after not being able to mount without that making any difference. I also used service nfs-kernel-server restart
. I suspect everything would be back to normal if I restart the client workstation.
Is there a way to recover from this and reinitialise the nfs client side on my workstation without a reboot?
If I cannot fix this without reboot, would this not reoccur if I start using autofs
?
lsof -b
hangs with as last lines:
lsof: avoiding readlink(/run/user/1001/gvfs): -b was specified.
lsof: avoiding stat(/run/user/1001/gvfs): -b was specified.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1001/gvfs
Output information may be incomplete.
in the lines preceding that, there is no /data0
.
The entry in /etc/fstab
:
192.168.0.2:/data0 /data0 nfs defaults,auto,nolock,user 0 2
Best Answer
As @PaperMonkey suggested in comments, you may be screwed because you used the default mount options, which include retrying forever.
intr
used to be a way to make it easier to interrupt things that were stuck on I/O to a broken NFS mount, but now it's a no-op.SIGKILL
can still interrupt processes stuck on NFS, at least sonfs(5)
claims. See that man page for mount options.Use
soft
instead of the defaulthard
if you want NFS not to retry forever.I also recommend using the automounter. Make symlinks to /net/host/foo/bar somewhere, if you want.
Often it's easier to just reboot, but I think in theory you should be able to
kill -9
(i.e.kill -KILL
) any processes that are stuck on NFS. THEN umount -f might work. Just be careful not to let tab-completion get more processes stuck on the NFS mount.