Udev: Changing SSD’s default (CFQ) I/O Scheduler

Courtesy of falconindy @ #archlinux

1
2
3
4
5
# set a larger readahead size
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/read_ahead_kb}="1024"
 
# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

To verify:

$ cat /sys/block/sda/queue/scheduler
noop [deadline] cfq

3 Comments

  1. WonderWoofy says:

    @w0ng – thanks a bunch to both you can falconindy for providing this. I was using the rc.local method before which seemed like something of a hack. But when I switched to systemd, it seemed wrong to have a service file that ran an echo command. This seems like the *right* way to do it.

  2. ColdFeetBob says:

    Thanks for this post – I found it already in the Arch’s Wiki.
    Is the “larger readahaed size” required for the deadline/noop scheduler or it is another kind of SSD optimization?

  3. ColdFeetBob says:

    Also, does the rule affect even pendrive, sd cards, etc (as “non rotating disks”)?

Leave a Reply