[systemd-devel] How to stop systemd-udevd reading a device after dd

Akira Hayakawa ruby.wktk at gmail.com
Fri Oct 13 11:08:27 UTC 2017


Hi,

Thanks.

The udev rule worked. But only for the unexpected read after write
(or close the device by dd maybe)
Because the device I want to remove udev control is device-mapper devices
which have prefix dm-, I changed the KERNEL in the line from sdb* to dm* then worked.

But still I have problem: There are still reads after dmsetup create
and dmsetup resume. I suppose these operations send uevents to udev
but I guess the nowatch line in udev rules should suppress them.

What do you think the remaining problems are?

- Akira

On 2017/10/13 18:01, Michal Sekletar wrote:
> On Thu, Oct 12, 2017 at 6:01 PM, Akira Hayakawa <ruby.wktk at gmail.com> wrote:
> 
>> And I want to stop the read request because it makes it difficult to test kernel code.
>> So the second question is: how can I stop the read request?
> 
> You can install local udev rule that will disable udev's monitoring of
> the block device.
> 
> # cat /etc/udev/rules.d/61-no-watch-sdb.rules
> ACTION!="remove", SUBSYSTEM=="block", KERNEL=="sdb*", OPTIONS:="nowatch"
> # udevadm control --reload-rules
> 
> Udev watches exist because block layer doesn't have any generic
> mechanism that could be used by the tools (e2fsprogs and friends) to
> make sure that udev picks up changes that they did, e.g. change in
> filesystem label.
> 
> Michal
> 


More information about the systemd-devel mailing list