Is there a good way to detect a stale NFS mount

后端 未结 7 1107
别跟我提以往
别跟我提以往 2020-12-23 15:08

I have a procedure I want to initiate only if several tests complete successfully.

One test I need is that all of my NFS mounts are alive and well.

Can I do

7条回答
  •  生来不讨喜
    2020-12-23 15:27

    I wrote https://github.com/acdha/mountstatus which uses an approach similar to what UndeadKernel mentioned, which I've found to be the most robust approach: it's a daemon which periodically scans all mounted filesystems by forking a child process which attempts to list the top-level directory and SIGKILL it if it fails to respond in a certain timeout, with both successes and failures recorded to syslog. That avoids issues with certain client implementations (e.g older Linux) which never trigger timeouts for certain classes of error, NFS servers which are partially responsive but e.g. won't respond to actual calls like listdir, etc.

    I don't publish them but the included Makefile uses fpm to build rpm and deb packages with an Upstart script.

提交回复
热议问题