Recently, I used to mdev
to replace udev
. Comparing to udevd
, mdev
really save much memory usage. The configuration is as follow:
in
/etc/mdev.conf
, if the device matched againstsd[a-z][0-9]
, the scriptusbmount_wrapper
will be called for both "after creating and before removing device"sd[a-z][0-9] 0:0 660 */usbmount_wrapper
in
usbmount_wrapper
, we called theusbmount
utility of debian.
This configuration works fine for hotplug events (nodes under /dev
are created and partitions are mounted correctly on devices plugged in, partitions are unmounted and device nodes are removed on device unplugged).
Issue happened when we tried to format the disk with fdisk
tool. By dumping the hotplug event, the event sequence is :removing all old partition -> adding all new created partition. If we do a ls /dev/sd*
right after fdisk
, we can see new device nodes for these new partitions, after a few seconds, these partitions are removed. We can conclude that there is race condition in mdev
, the device nodes are first created and then removed, this is contrary the sequence of hotplug events. I also tried to create /dev/mdev.seq
but it does not solve the issue. The mdev
version is from busybox
1.17
If anyone has experimented with mdev
and encountered the same issue, please give some advice. Appreciate your helps and thanks in advanced.