预读值会在启动时自动更新

操作系统版本:CentOS Linux版本7.2.1511(核心)

我在我的rc.local文件中有以下命令:

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

启动后,/ root / test_boot文件具有以下内容:

猫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 

而命令

blockdev – 报告

给出了不同的价值:

 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 

所以似乎有一些其他的内核程序正在覆盖启动时的值。 什么可能是该计划? 有什么办法可以在启动过程的最后执行blockdev –setra命令吗?

注意:我也尝试将这些命令放在init.d,systemd和crontab中。 同样的事情总是发生。

这是来自centos 7服务器的cat /etc/rc.local的输出。

 #!/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.