Hi,

Marcelo Laia wrote:
> If the USB SSD is unexpectedly disconnected, the USB bus resets, or the
> filesystem becomes unmounted for any reason, the mount point directory
> still exists. As I understand it, applications may continue writing to
> that directory, which now belongs to the underlying root filesystem.
> [...]
> 3. How would you implement a robust solution for this type of logging
>   system?

Did you consider to install a safety rail by directing the logs to a
directory under the mount point, with a name that surely does not exist
in the filesystem which holds the mount point ?

Like

  sudo mount /dev/sdd /mnt/sdd

  log_program >>/mnt/sdd/WeIrD_NaMe/file.log

As soon as the filesystem of the USB SSD is unmounted, the directory
WeIrD_NaMe will not exist and no file in it can be opened.
(I expect open file descriptors on the vanished filesystem to cause
error when trying to write.)

This is of course not a neat solution for smartly redirecting the
log programs to fallback locations. But it will prevent unaware
programs to create files in the wrong filesystem.


Have a nice day :)

Thomas

Reply via email to