StorageSystem

Change I/O Disk Scheduler without Reboot

There are four I/O schedulers for hard disks and block devices: anticipatory, noop, deadline, and CFQ. CFQ is usually the default. To change the I/O scheduler:

echo SCHEDNAME > /sys/block/DEV/queue/scheduler

SCHEDNAME is the scheduling algorithm name (anticipatory, noop, deadline, or CFQ), and DEV is the device name, such as sda, sdb, or sdc. For example, to change the I/O scheduler for sda from cfq to anticipatory:

  1. Check the current I/O scheduler.

    # cat /sys/block/sda/queue/scheduler
    noop anticipatory deadline [cfq]
  2. Change the I/O scheduler from cfq to anticipatory. # echo anticipatory > /sys/block/sda/queue/scheduler

  3. Check whether the system has changed the I/O scheduler to anticipatory.

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

To select the desired I/O scheduler after a reboot or startup, add the following to /etc/rc.local:

echo SCHEDNAME > /sys/block/DEV/queue/scheduler

Alternatively, append elevator=SCHEDNAME to the kernel line in grub.conf. For example, to use the deadline I/O scheduler:

title CentOS (2.6.xx-xx.x.elx.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.xx-xx.x.elx.x86_64 ro root=UUID=1c83-4e9a-82e7-a529f8 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM elevator=deadline
        initrd /initramfs-2.6.xx-xx.x.elx.x86_64.img

More information about I/O schedulers is available under /usr/share/doc/kernel-*/Documentation/block.

EOF.← Back to articles