I want to monitor USB-Keys on my system. I know they are always mounted in /media so I use inotify to monitor /media. Some USB Keys create a folder (e.g. sda) when plugged which
You can use inotifywait
command (from the inotify-tools
package) to monitor the /media directory, in order to check whether the inotify
events which interest you do occur.
reference:
http://www.noah.org/wiki/Inotify,_FAM,_Gamin#Examples_with_inotify-tools
If inotify
does miss events, the reason might be:
Inotify
does report some but not all events in sysfs
and procfs
.
(Well, I can not say for sure. Just my guess.)
Reference:
http://en.wikipedia.org/wiki/Inotify#Limitations
http://en.wikipedia.org/wiki/Sysfs
http://en.wikipedia.org/wiki/Procfs