Question on mdev's custom command invocation

Didier Kryn kryn at in2p3.fr
Wed Nov 16 15:27:12 UTC 2016


     Hello.

     I'm willing to create/delete symlinks in /dev/disk/by-uuid and 
/dev/disk/by-label . For this, I've written a script and added the 
following lines to /etc/mdev.conf:
sd[a-z][0-9]*   root:disk 660 */sbin/mdev-disk
hd[a-z][0-9]*   root:disk 660 */sbin/mdev-disk

     Note that I use /dev/mdev.seq to serialize events.

     Is there a means for my script mdev-disk to determine if the device 
is being inserted or extracted? For example it would be easy if mdev 
provided the uevent's action (add, remove)

     My current trick is to create links when they don't exist and 
delete them when they exist, but it's far from rock-solid.

     Possible alternatives I see are:
         - use different commands for insertion and extraction - not 
sure mdev.conf allows to have two lines per device pattern
         - monitor /dev with inotify instead of using a command launched 
by mdev, but this process would be constantly there sleeping.

     Thanks for your help.
                                                 Didier


More information about the busybox mailing list