Some systems have more then 26 (block) devices (like hard disk drives), which the kernel names as follows:
/dev/sda
...
/dev/sdz
/dev/sdaa
/dev/sdab
/dev/sdac
...
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:
KERNEL=="sd[a-z]|sd[a-z][a-z]|sr[0-9]"
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?
Best Answer
KERNEL=="sd*[!0-9]|sr*"
Can be found at the operating system supplied udev rules themselves.
In this Arch Linux case, have a look at file:
Section ATA: