1. Home
  2. Docs
  3. Ubuntu
  4. Ubuntu: Setting elevator=none

Ubuntu: Setting elevator=none


If you’re running Linux (any distro) on a physical RAID controller, on NVME, or on a hypervisor, you probably want to set your disk scheduler to the equivalent of “noop” (no operation). This lets the underlying mechanism(s) handle scheduling and can realize huge performance gains (or, conversely, save you from huge performance problems).

On Linux kernel 5, serious work has been on disk scheduling modules, and on Ubuntu 20.04.1 LTS (Focal Fossa) – which runs kernel 5.4.something – noop has been replaced with “none”, and the default is now mq-deadline.

Right off the bat, this poses a challenge to us old geezers relying upon dated personal notes: setting “elevator=noop” in grub.conf won’t work, simply because “noop” is no longer a valid option.

Worse, setting “elevator=none” in grub.conf doesn’t work, either. Why this functionality has been removed is a subject of research I’m unwilling to do at this time (and you’re probably not going to do that research either, or you wouldn’t be reading this). The important thing is this: Apparently, setting the scheduler on a per-block device basis in a udev script is now the preferred management method.

Here’s how to do it:

  1. Either as root or via sudo, do:

    echo 'ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="none"' >> /etc/udev/rules.d/60-ssd-scheduler.rules

    This will likely create a new file, and that’s OK.

    This line tells UDEV during the boot process that it should add or change an attribute for any kernel devices enumerated as ‘sda’ through ‘sdz’, and for each of those devices, the attribute “queue/scheduler” should be set to “none”.

  1. Either as root or via sudo, do:

    echo 'ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="none"' >> /etc/udev/rules.d/60-ssd-scheduler.rules

    This will likely create a new file, and that’s OK.

    This line tells UDEV during the boot process that it should add or change an attribute for any kernel devices enumerated as ‘sda’ through ‘sdz’, and for each of those devices, the attribute “queue/scheduler” should be set to “none”.

  2. As root or via sudo, you can now manually set the scheduler, without having to reboot, with something like:

    for i in `ls -d /sys/block/sd*`; do echo "none" > ${i}/queue/scheduler; done

    This, however, isn’t the point; we want to see the change go in during a system boot. So… reboot!

  3. Once the box is back online, validate with something like:

    for i in `ls -d /sys/block/sd*`; do echo $i; cat ${i}/queue/scheduler; done

    Your output should look something like:
    /sys/block/sda
    [none] mq-deadline

Hope that helps, and maybe saves you from pulling out some hair.

-j