[dm-crypt] Elevator / dm-crypt

Milan Broz gmazyland at gmail.com
Sun Sep 2 21:17:27 CEST 2012

On 09/02/2012 07:45 PM, Heinz Diehl wrote:
> 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 :-)

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


More information about the dm-crypt mailing list