2017/06/23

Stale NFS mounts

Think you've got a stale NFS mount, gumming up the works?
Maybe several mounts, you're not sure which is the problem, and your usual tools are not working (ex: they just hang)?

Try this one-liner (sudo / root is required for "lsof"):


Which should ID the culprit, and give you some info to help determine how to handle.

Notes:
  • This unfortunately cannot simply be single-quoted, and executed via ansible. There's probably a way to add another level of quoting to address that, however I simply dropped the code in a file in my homedir, then ansible'd that.
  • The "-b" option to "lsof" is essential, since it avoids blocking, which is almost certain in this circumstance.
  • The "lsof" gives a simple count; if there are any, you may wish to repeat the "lsof" to actually show the open files.
  • The mount's line from /etc/mtab should show some useful info, such as the IP address where the mount at least was, when it was made.