I have some embedded devices running Linux (4.14.126), and i want them to write some of their logfiles to a network share on another (Windows 10) computer. Mounting the network share works mostly fine, apart from the fact that i have to provide login credentials (which i wanted to avoid), but i need some reliable way to detect a broken mount (for example when i reboot the PC).

  • Is it possible to get some kind of status information for a cifs mount?
  • What error conditions (if any) can be detected without actually trying to read from (or write to) the share?
  • Is it possible for my application to get automatic notifications in case of an error (maybe through inotify)?
  • Do i have to handle remounting myself, or does that happen automatically once the share becomes available again?

PS (in case it matters): I won't use fstab, because the location of the network share is not known at boot time.

1 Answer 1


Checking the existence of a certain file (which resides only on the smb target share) by the backup routine is the way which works pretty reliable in my scenario. So first step in a potential backup script is to check, if a certain file exists in the mount location. If not, the mount is broken and needs to be re-mounted. Next step (optional) is to examine the content of this file, where I stored information relevant for the further process (as my backup targets may vary, I use this to identify the target server). After all this passed, the intended process can be safely executed.

I do use /etc/fstab for mounting, while the credentials to access the target server lives in a separate file referenced in fstab. The credential file may stored in a path on your filesystem with limited access for other users.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .