Elevator / dm-crypt
Hi,
assuming /dev/sda1 is an LUKS/dmcrypt encrypted partition. The default elevator is "noop" (given in kernel command-line), but "cfq" is set for /dev/sda in /sys/block/sda/queue/scheduler.
What elevator is used for the underlying /dev/mapper/dm-0 (sda1)?
sys/block/dm-0/queue/scheduler contains "none", btw.
Thanks,
Heinz.
Quoted 5 lines · Heinz Diehl
assuming
/dev/sda1is an LUKS/dmcrypt encrypted partition. The default elevator is "noop" (given in kernel command-line), but "cfq" is set for/dev/sdain/sys/block/sda/queue/scheduler.What elevator is used for the underlying
/dev/mapper/dm-0(sda1)?
Partitions just use whole device elevator.
And it should be default from your kernel parameter configuration if not set by some script later... is that param correct? Anyway, you can just switch it later using
echo "noop">/sys/block/sda/queue/scheduler
Device-mapper devices (except request based - which is currently multipath only) do not use own elevator at all. So only elevator for underlying device is important.
BTW you can easily check it with lsblk -t.
Or explicitly name fields - here is example of my nb with SSD (default sched. is noop for me):
# lsblk -o NAME,TYPE,SCHED /dev/sdb NAME TYPE SCHED sdb disk noop ├─sdb1 part noop ├─sdb2 part noop │ └─sdb2_crypt (dm-0) crypt │ ├─mnbook-data (dm-1) lvm │ ├─nbook-swap (dm-2) lvm │ └─nbook-root64 (dm-3) lvm └─sdb3 part noop
Quoted 1 line
sys/block/dm-0/queue/scheduler contains "none", btw.
Yes, it is irrelevant for dm-crypt, there is no elevator. (If you ask why there is <dev>/queue dir then, the because someone decided to put some important attributes there which applies even when elevator is not set. No idea why...)
Milan
On 02.09.2012, Milan Broz wrote:
[....]
Thanks a lot, Milan! Now it's all clear to me.
My main intention is to set "noop" as the default elevator, and switch to cfq for the harddisk via rc.local when booting (it's a conventional rotating drive, no SSD). This has the effect that all USB drives plugged in later will get "noop" as their active scheduler, since it's the default, while all partitions on the harddisk have "cfq".
This way, I avoid hair-pulling work with udev/systemd to have "noop" for all non-rotational drives plugged in :-)
Quoted 6 lines · Heinz Diehl
On 02.09.2012, Milan Broz wrote:
[....]
Thanks a lot, Milan! Now it's all clear to me.
Quoted 8 lines
My main intention is to set "noop" as the default elevator, and switch to cfq for the harddisk via rc.local when booting (it's a conventional rotating drive, no SSD). This has the effect that all USB drives plugged in later will get "noop" as their active scheduler, since it's the default, while all partitions on the harddisk have "cfq".
This way, I avoid hair-pulling work with udev/systemd to have "noop" for all non-rotational drives plugged in :-)
You can also use udev rules to do this
(not tested but something like):
Add /etc/udev/rules.d/20-elevator.rules
# set cfq for all rotational devices
SUBSYSTEM=="block", ACTION=="add", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="cfq"(or perhaps reverse is better:)
SUBSYSTEM=="block", ACTION=="add", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"
.. or/and for USB
# set noop for usb disks
SUBSYSTEMS=="usb", ACTION=="add", KERNEL=="sd*[!0-9]|sr*", ATTR{queue/scheduler}="noop"(Btw I think "deadline" could be better for USB.)
Milan