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?


1 Answer 1


Monitor using udevadm for subsystem block and id_type as cd .With the actions we can check the change / add / remove

  • If you expand on this, perhaps with an example, it could be a very effective answer. Aug 3, 2016 at 8:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .