Some people may have noticed something changed in the Linux Kernel. The change could impact all storage IO depending on IO scheduler. The default maximum IO size was changed, which has been increased from 512KB to 1280KB. The change mostly impacts Linux Kernel Version 4.x but some distributions have back ported the change, such as with Oracle Linux 6.5 and above. The problem is some systems might not like this new default maximum size. Especially if they use NFS as the back end datastore storage of a virtual machine as it will fragment IO’s. So what should you do about it?
The default maximum IO size set by Max_Sectors_KB restricts the largest IO size that the OS will issue to a block device. Whether you will be issuing IO at this size will depend on the elevator (scheduler) being used, the driver, and the type of IO your applications are issuing. But large reads and writes are often at the maximum IO size.
The answer is to use UDEV. UDEV can ensure that all block devices connected to your VM, even if they are hot plugged, will get the same consistent maximum IO size applied. All you need to do is create a file “71-block-max-sectors.rules” under /etc/udev/rules.d/ with the following line.
ACTION==”add|change”, SUBSYSTEM==”block”, RUN+=”/bin/sh -c ‘/bin/echo 1024 > /sys%p/queue/max_sectors_kb’”
If you don’t have UDEV in your distribution then the alternative is to use rc.local and essentially apply the same command, as an example, “echo 1024 > /sys/block/sda/queue/max_sectors_kb”
Thanks to Mike Cui, Greg A Smith and Krishna Ramineni @Nutanix for catching this problem and providing the solution via UDEV.
—
This post first appeared on the Long White Virtual Clouds blog at longwhiteclouds.com. By Michael Webster +. Copyright © 2012 – 2015 – IT Solutions 2000 Ltd and Michael Webster +. All rights reserved. Not to be reproduced for commercial purposes without written permission.
Watch out when copying this command from here, the quotes are not true quotes, both the single and double quotes are “forward” quotes! udev hates these… Thank you, after figuring this out this was very helpful to me!
[…] Default Maximum IO Size Change in Linux Kernel […]