how to change the I/O scheduler in CentOS 7+

Posted by

The I/O scheduler is a method used in CentOS but mostly in all OS to decide in which order the block I/O operations will be submitted to storage volumes. Normally exist three configurations changes that you can use, it is normal nowadays that all distributions handle [deadline] as default configuration but let’s check all of them in case you need to perform some changes in your OS:

-noop
-deadline
-cfq

To check the current configuration use the following command:

[root@securitytweak ~]# cat /sys/block/sda/queue/scheduler
noop [deadline] cfq

The current configuration is [deadline], normally the actual settings will have [] on the name.

To check what are the tunable settings for [deadline], use the following command:

[root@securitytweak ~]# ls -l /sys/block/sda/queue/iosched/
total 0
-rw-r–r–. 1 root root 4096 Jul 18 17:33 fifo_batch
-rw-r–r–. 1 root root 4096 Jul 18 17:33 front_merges
-rw-r–r–. 1 root root 4096 Jul 18 17:33 read_expire
-rw-r–r–. 1 root root 4096 Jul 18 17:33 write_expire
-rw-r–r–. 1 root root 4096 Jul 18 17:33 writes_starved
[root@securitytweak ~]#

[iosched] contains all customizable settings for the current I/O method.

To change the current settings to “cfq” use the following command:

[root@securitytweak ~]# echo cfq > /sys/block/sda/queue/scheduler

Confirm the changes:

[root@securitytweak ~]# cat /sys/block/sda/queue/scheduler
noop deadline [cfq]

Now the current configuration is, [cfq]

If you check the tunable settings for [cfq] are totally different:

[root@securitytweak ~]# ls -l /sys/block/sda/queue/iosched/
total 0
-rw-r–r–. 1 root root 4096 Jul 18 17:54 back_seek_max
-rw-r–r–. 1 root root 4096 Jul 18 17:54 back_seek_penalty
-rw-r–r–. 1 root root 4096 Jul 18 17:54 fifo_expire_async
-rw-r–r–. 1 root root 4096 Jul 18 17:54 fifo_expire_sync
-rw-r–r–. 1 root root 4096 Jul 18 17:54 group_idle
-rw-r–r–. 1 root root 4096 Jul 18 17:54 low_latency
-rw-r–r–. 1 root root 4096 Jul 18 17:54 quantum
-rw-r–r–. 1 root root 4096 Jul 18 17:54 slice_async
-rw-r–r–. 1 root root 4096 Jul 18 17:54 slice_async_rq
-rw-r–r–. 1 root root 4096 Jul 18 17:54 slice_idle
-rw-r–r–. 1 root root 4096 Jul 18 17:54 slice_sync
-rw-r–r–. 1 root root 4096 Jul 18 17:54 target_latency
[root@securitytweak ~]#

These simple steps guide you to change the I/O scheduler method to use it on your OS.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s