Linux – Read Ahead value automatically getting updated at boot

block-devicebootlinuxrc.localstartup

OS version: CentOS Linux release 7.2.1511 (Core)

I have the following commands in my rc.local file:

/usr/sbin/blockdev --report > /root/test_boot
/usr/sbin/blockdev --setra 256 /dev/vdb
/usr/sbin/blockdev --report >> /root/test_boot

After booting the /root/test_boot file has following content:

cat test_boot

RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0     10737418240   /dev/vda
rw   256   512  4096       2048      8588886016   /dev/vda1
rw   256   512  4096          0     53687091200   /dev/vdb
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0     10737418240   /dev/vda
rw   256   512  4096       2048      8588886016   /dev/vda1
rw   256   512  4096          0     53687091200   /dev/vdb

whereas the command

blockdev –report

gives a different value:

RO    RA   SSZ   BSZ   StartSec            Size   Device
rw  8192   512  4096          0     10737418240   /dev/vda
rw  8192   512  4096       2048      8588886016   /dev/vda1
rw  8192   512  4096          0     53687091200   /dev/vdb

So it seems that some other kernel program is overwriting the value at boot. What could be the program? Is there some way that I can execute the blockdev –setra command at the very end of the boot process?

Note: I've also tried putting the commands in init.d, systemd and crontab. Same thing happens all the times.

Best Answer

  1. Disable readahead value in tuned.conf.
  2. Run these commands to reload the tuned.conf file:

    # tuned-adm profile
    # tuned-adm active virtual-guest
    

After this the values will load from /etc/rc.d/rc.local file.

Related Topic