I need to run some code on storage device mounting and unmounting.
How can i listen for these events on linux?
- I was thinking on adding some udev rules to run some script (any know-how in this matter is appreciated).
- But I would much rather listen for events from the kernel in some netlink socket with my daemon (just like udev does) or something like that.