Specify I/O Scheduler with udev rules

Since the advent of systemd the use of /etc/rc* startup-scripts has been discouraged and phased out. However, systemd still supports the use of certain local startup scripts for compatibility purposes. Nevertheless, to ensure full current- and future compatibility with systemd, administrators are encouraged to create own systemd service files or udev rules to run scripts during boot.  This post will briefly outline the use of a udev rule to assign a specific I/O scheduler to a specific HDD.


To see an example using the phased-out rc-startup scripts, take a look at my previous post.

Create a custom rules-file, e.g. 99-custom.rules, in the /etc/udev/rules.d/ directory with your editor of choice.  The following example will instruct udev to assign the deadline I/O scheduler to the /dev/sdb device:

# vim /etc/udev/rules.d/99-custom.rules
ACTION=="add|change", SUBSYSTEM=="block" , KERNEL=="sdb*",  RUN+="/bin/sh -c 
'echo deadline > /sys/block/sdb/queue/scheduler'"
The line starting with ACTION is one continuous line! In order to let the rule take effect on the system without restarting, execute:
# udevadm control --reload

Popular posts from this blog

Centos 7 pulseaudio

RHEL 7 and CentOS 7 syslog Rate Limit

Password Policy in RHEL 7