Using any of
mountpoint can give you incorrect information if any of the following have occurred:
- The remote is offline (
grep-file based solutions fail)
- For NFS mounts, the remote has stopped exporting or the NFS service has been stopped (
- The remote has changed IP addresses (all solutions fail)
How can I retrieve a simple yes/no answer as to whether or not the mount is usable as intended? As far as I understand, all of the mount information is stored in both
/etc/mtab and in
/proc/mounts. Without causing a hang (as
stat does), is there a way to verify that the actual state of the network is as the local information would lead me to believe?
This needs to be a very general tool, able to handle CIFS and NFS mounts (and others, most likely).
I can only use what comes with the standard distribution on RHEL 6. Usually, everything in
/bin:/sbin:/usr/bin:/usr/sbin is fair game. This is not by choice and is not a movable point, so I cannot accept an answer that uses external tools. For future readers' sake, though, I welcome them as comments