I was wondering if there was a way to register a callback with the system so that when a user attached an external drive my callback is called and I can then proceed to manually mount the disk.
What I'm doing currently is putting a default entry into /etc/fstab
with nofail
on, this way if the drive is inserted before boot it will be automatically mounted. What'd I'd rather do though is allow the drive to be inserted at anytime, and have it automounted by the system.
Is there a way to do this without polling lsblk
in a loop?
udev
rules, several are described in the following question: unix.stackexchange.com/questions/44454/…