Article 5QSWG Verify that a USB Flash Drive is Actually Mounted

Verify that a USB Flash Drive is Actually Mounted

by
Steve R.
from LinuxQuestions.org on (#5QSWG)
I have a USB flash drive that is attached to my router. It's physical location is "//rt-ac3100-84e8/sda1" it is mounted on "/media/My_Passport"

The USB flash drive is always "mounted" since it is on a router and is used to store my backup files. For an unknown reason, the USB flash drive became unmounted one day. I was able to remount it. Nevertheless, I am revising my backup program to send an error message should the USB flash drive becomes unmounted.

The issue that I am having is the various utilities for listing what is mounted apparently show mount points irrespective of whether or not the USB flash drive is actually mounted or not. Is there a time delay before a computer system recognizes that a mount point is actually empty?

I have tried "findmnt", "mount", "dmesg", "lsblk". None of the commands provided real-time output that would confirm whether the USB flash drive was actually mounted or not.

The less elegant, Plan "B" solution is to issue the following two commands in the terminal to test for the existence of the top directory in the USB flash drive. In the bash program it will be revised to an "if" statement.
Code:test -e /media/My_Passport/Alcor
echo $?
That works as expected, but it would not be the best approach for identifying if a device is mounted since it actually only tests for the existence of a directory.

Is there a way to test, real-time, whether a USB flash drive attached to a router is mounted or not on the local computer?latest?d=yIl2AUoC8zA latest?i=cMShGSzydnk:iDh3scza91w:F7zBnMy latest?i=cMShGSzydnk:iDh3scza91w:V_sGLiP latest?d=qj6IDK7rITs latest?i=cMShGSzydnk:iDh3scza91w:gIN9vFwcMShGSzydnk
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments