大网数据广告活动
服务器运维问答

In CentOS 7, is there a way to specify which block devices should be tuned with the scheduler (or ELEVATOR)?

· 52CE 我爱测

In CentOS 6, there was /etc/tune-profiles/my-server/ktune.sysconfig with this text(I'm referring to the comments that explain what the code is doing): # This is the I/O scheduler ktune will use. This will *not* override anything …

问题原文

原帖链接 · Levi Uzodike · CC BY-SA 4.0

In CentOS 6, there was /etc/tune-profiles/my-server/ktune.sysconfig with this text(I'm referring to the comments that explain what the code is doing):

# This is the I/O scheduler ktune will use.  This will *not* override anything
# explicitly set on the kernel command line, nor will it change the scheduler
# for any block device that is using a non-default scheduler when ktune starts.
# You should probably leave this on "deadline", but "as", "cfq", and "noop" are
# also legal values.  Comment this out to prevent ktune from changing I/O
# scheduler settings.
ELEVATOR="deadline"

# These are the devices, that should be tuned with the ELEVATOR
ELEVATOR_TUNE_DEVS="/sys/block/{sd,cciss,vd,dasd,xvd}*/queue/scheduler"

But it seems like CentOS 7 has left ktune behind. I see an alternate method to change the default I/O scheduler:

Add the elevator parameter to the GRUB_CMDLINE_LINUX line in the /etc/default/grub file.

# cat /etc/default/grub
...
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=vg00/lvroot rd.lvm.lv=vg00/lvswap elevator=noop"
...

And it goes on. But this would be a system-wide change. I'm looking for a solution like I had in CentOS 6 where I could specify which block devices would get the I/O scheduler specified by the ELEVATOR parameter. I was hoping I could just add the elevator_tune_devs parameter to the GRUB_CMDLINE_LINUX line, but according to this, there is no such kernel parameter. I know I can do this:

echo 'noop' > /sys/block/hda/queue/scheduler

for example, but I was hoping for something that lasts past the reboot. The best solution so far is to stick that echo command in a one-shot service so it'd be run every time at boot, but I was hoping for a cleaner method similar to the CentOS 6 solution.

已采纳解答

原帖链接 · shodanshok · CC BY-SA 4.0

You have at least two methods:

  • use a custom tuned profile with the right disk option
  • insert the "echo noop" command in /etc/rc.local or create a specific systemd service.

EDIT: here you can find an example tuned.conf file:

# tuned configuration

[main]
summary=ZFS General non-specialized tuned profile
include=balanced

[disk]
# Comma separated list of devices, all devices if commented out.
type=disk
devices=sda,sdb
elevator=noop

As described in the RHEL tuned guide I linked above you have different possibilities to define the device list:

  • via coma separated list (as per example above);
  • via wildcards (eg: sd*);
  • to all disks, by not specifying anything (as by the comment included in the file above).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-11-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。