Some systems have more then 26 (block) devices (like hard disk drives), which the kernel names as follows:


Most udev rules examples are quite simple, only matching the first 26 devices, like for example:

ACTION=="add|change", KERNEL=="sd[a-z]|sr[0-9]", SUBSYSTEM=="block", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

But how to match after the 26th device? One can't write sd* because partitions like sda1 should not be matched.

I can imagine writing another "or" (pipe symbol: |) to make the match, like:


Or split the match in a positive and negative part, like:

..., KERNEL=="sd[a-z]*|sr[0-9]", KERNEL!="sd[a-z]*[0-9]", ...

Is there a better way to write udev rules that are readable, do match device #27 and up, but not any partition?

1 Answer 1



Can be found at the operating system supplied udev rules themselves.

In this Arch Linux case, have a look at file:


Section ATA:

$ grep /usr/lib/udev/rules.d/60-persistent-storage.rules -e \"ATA\"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"

You must log in to answer this question.

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