I'm trying to figure out a way to run a script when a specific remote fs like cifs or nfs is mounted and also when it's about to be unmounted. I have entries in my fstab so mounting icons are automatically created on my desktop. But I need to mount an overlay fs when some specific remote fs is mounted and unmount it before remote fs gets unmounted. With the udev monitor I see add/remove notifications but attributes are pretty useless:
~$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[41113.912505] add /devices/virtual/bdi/cifs-2 (bdi)
UDEV [41113.913868] add /devices/virtual/bdi/cifs-2 (bdi)
^
~$ udevadm info -a -p /devices/virtual/bdi/cifs-2
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/virtual/bdi/cifs-2':
KERNEL=="cifs-2"
SUBSYSTEM=="bdi"
DRIVER==""
ATTR{min_ratio}=="0"
ATTR{stable_pages_required}=="0"
ATTR{read_ahead_kb}=="1024"
ATTR{max_ratio}=="100"
Is there anything I can use instead then? Thanks