1

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.

2 Answers2

1
  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.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
Chinthith
  • 11
  • 1
0

This is the ouput of cat /etc/rc.local from a centos 7 server.

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
c4f4t0r
  • 5,149
  • 3
  • 28
  • 41
  • The symlink between files /etc/rc.local and /etc/rc.d/rc.local exists. The changes are getting reflected across both the files. If I add "touch /root/dummy_file" in the rc.local file, the file is getting created! – Shikhar Awasthi Aug 30 '17 at 12:39
  • @Shikhar Awasthi In contrast to previous versions due to parallel execution during boot this script will NOT be run after all other services. – c4f4t0r Aug 30 '17 at 14:16
  • so for versions below Centos 7, all the startup scripts used to run serially? – Shikhar Awasthi Aug 31 '17 at 13:46