2

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?

0

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. – roaima Aug 3 '16 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.