How to change IO scheduler permanently in Linux


In my last article I gave an overview on I/O related optimization and performance improvement, now in this article I will share the steps to change IO scheduler (permanently or temporarily) in Linux.


How to change IO scheduler permanently in Linux


One of the more controversial tunable Linux performance features, in that there are no universally accepted guidelines available, is that of the I/O scheduler choice.

  • The name elevator is used due to how they sort incoming requests.
  • Consider a real elevator, currently at the first floor.
  • Perhaps the first person in requests the ninth floor, then the next person the third.
  • The elevator will not visit the floors in the order requested; it will visit the third floor first, then continue to the ninth.
  • The scheduler elevator does read and write sorting to optimize in a similar fashion.


How to change IO scheduler for runtime (temporary)?

You can check the currently active scheduler using the below file and command

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

To change the active scheduler for the current session

# echo cfq > /sys/block/sda/queue/scheduler

Now again validate the active scheduler

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

This change is not persistent and will switch back to deadline after reboot of the node


How to change IO scheduler permanently using GRUB2?

You can set the default elevator scheduler at kernel boot time. Modify your GRUB configuration and add your choice of elevator in the format shown below under GRUB_CMDLINE_LINUX

# cat /etc/sysconfig/grub
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet elevator=cfq"

Next rebuild your initramfs

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-862.14.4.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.14.4.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-43f0510283784c858d39e38e358b4669
Found initrd image: /boot/initramfs-0-rescue-43f0510283784c858d39e38e358b4669.img

Reboot the node to activate the changes

Once the node is back UP, check the active scheduler

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

So as expected the active scheduler is "cfq" as we set with kernel


How to change IO scheduler permanently using GRUB2?

You can also use tuned profile to permanently change your active IO scheduler. Create your own tuned profile and add below content in the tuned.conf file


Here we are setting deadline as my default IO scheduler.

Next activate the tuned profile. Here golinuxcloud is my custom tuned profile

# tuned-adm profile golinuxcloud

Now validate the active scheduler

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

So as expected our active scheduler as changed again.


Now the above steps can change your active IO sceduler and make it persistent to reboot but to modify one of the tunables which is part of these elevator, you will need the steps from below article
How to make IO disk scheduler change reboot persistent in Linux


Lastly I hope the steps from the article to configure NIC teaming on Linux was helpful. So, let me know your suggestions and feedback using the comment section.


If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

1 thought on “How to change IO scheduler permanently in Linux”

Leave a Comment