You can create and enable a TuneD profile that sets a given disk scheduler for selected block devices. The setting persists across system reboots.
About this task
When creating a TuneD profile to set a disk scheduler, replace:
- device with the name of the block device, for example
sdf and
- selected-scheduler with the disk scheduler that you want to set for the device, for example bfq.
Procedure
-
Optional: Select an existing TuneD profile on which your profile will be based. For a list of available profiles, see TuneD profiles distributed with RHEL.
-
To see which profile is currently active, use:
-
Create a new directory to hold your TuneD profile:
# mkdir /etc/tuned/profiles/<new_profile>
-
Find the system unique identifier of the selected block device:
# udevadm info --query=property --name=/dev/device | grep -E '(WWN|SERIAL)'
ID_WWN=0x5002538d00000000_
ID_SERIAL=Generic-_SD_MMC_20120501030900000-0:0
ID_SERIAL_SHORT=20120501030900000
Note This command returns all values identified as a World Wide Name (WWN) or serial number associated with the specified block device. Although using a WWN is preferred, it is not always available for every device. In such cases, you can use any value returned by the example command as the device system’s unique ID.
-
Create the
/etc/tuned/profiles/<new_profile>/tuned.conf configuration file. In the file, set the following options:
-
Optional: Include an existing profile:
[main]
include=<existing-profile>
-
Set the selected disk scheduler for the device that matches the WWN identifier:
[disk]
devices_udev_regex=IDNAME=device system unique id
elevator=selected-scheduler
Here:
- Replace IDNAME with the name of the identifier being used (for example, ID_WWN).
- Replace device system unique id with the value of the chosen identifier (for example,
0x5002538d00000000). To match multiple devices in the devices_udev_regex option, enclose the identifiers in parentheses and separate them with vertical bars:
devices_udev_regex=(ID_WWN=0x5002538d00000000)|(ID_WWN=0x1234567800000000)
-
Enable your profile:
# tuned-adm profile <new_profile>
Results
- Verify that the TuneD profile is active and applied:
Current active profile: <profile>
Verification succeeded, current system settings match the preset profile.
See TuneD log file ('/var/log/tuned/tuned.log') for details.
- Read the contents of the
/sys/block/device/queue/scheduler file:
$ cat /sys/block/device/queue/scheduler
[mq-deadline] kyber bfq none
In the file name, replace device with the block device name, for example sdc. The active scheduler is listed in square brackets ([]).