Inspect udev rules in /etc/udev/rules.d
In the previous steps, we learned how to check the active I/O scheduler using /sys
and dmesg
. Now, let's look at how the system might be configured to set the scheduler automatically when devices are detected. This is often handled by udev
.
udev
is a device manager for the Linux kernel. It manages device nodes in /dev
and handles all user space events when hardware devices are added or removed from the system. udev
uses rules to match devices and perform actions, such as setting permissions or configuring device parameters like the I/O scheduler.
udev
rules are typically stored in the /etc/udev/rules.d/
directory. These files have a .rules
extension. We can inspect these files to see if there are any rules that specifically set the I/O scheduler for certain devices.
First, let's list the files in the /etc/udev/rules.d/
directory using the ls
command:
ls /etc/udev/rules.d/
You will see a list of files, potentially including some related to block devices or storage. The output might look something like this:
10-snapd.rules 50-cloudimg-settings.rules 70-snap.core.rules 70-snap.lxd.rules 70-snap.microk8s.rules 70-snap.snapd.rules 70-snap.snapd-desktop-integration.rules 99-vmware-scsi-udev.rules
Now, let's look inside one of these files to see if we can find any rules related to schedulers. We'll use the cat
command to display the content of a file. For example, let's look at 99-vmware-scsi-udev.rules
(the exact filename might vary slightly depending on the environment, but look for one that seems related to storage or devices):
cat /etc/udev/rules.d/99-vmware-scsi-udev.rules
You might see rules that match specific device attributes and then set properties. Look for lines that use the ATTR
keyword to match device attributes and the ATTR{queue/scheduler}
property to set the scheduler.
For example, a rule to set the deadline
scheduler might look something like this:
## Set scheduler for VMware SCSI devices
ACTION=="add|change", SUBSYSTEM=="block", ATTRS{idVendor}=="VMware", ATTRS{idModel}=="VMware Virtual S", ATTR{queue/scheduler}="deadline"
This rule matches block devices (SUBSYSTEM=="block"
) with specific vendor and model attributes and sets their scheduler to deadline
when they are added or changed.
By inspecting these rules, you can understand how the default I/O scheduler might be configured on your system.