[dm-crypt] dm-crypt LUKS and USB power management

Axel Heider axelheider at gmx.de
Tue May 31 12:59:38 CEST 2016

> I doubt if it could be done clean. Most targets in Device Mapper ask for
> careful unstacking.

Couldn't LUKS/cryptsetup/dm-crypt set up a monitor for the disk peripheral
at least? So it releases any connection to the device if it is diconnected.
The device is gone anyway, so there is no gain in keeping any handles open.
Internally, the higher layer file system driver should still get errors
then. But the lower lever driver stack is no longer blocked. So a new
device can become /dev/sda again and not dev/sdb because /dev/sda is still
"somehow" active.

> I would rather investigate the (flaky) USB device. First, does it happen only
> when Runtime PM is enabled ? If so, you should just blacklist it from Power
> Management. Many devices, under Linux, report (false) PM capabilities.

My current solution is using a hub with a dedicated power support to
connect the USB/SATA adapter with the HDD. Then disk spindown can
still be used, but there is no USB disconnect/reconnect. That solves
the problem practically.
I did not find a way yet to disable power/idele management on the
board USB ports. It's a Odroid C1 or C2 with Debian Jesse Kernel
3.14.29 or 3.14.65. The suggestion from
does not work
and so far nobody else had a solution. Will keep searching...


More information about the dm-crypt mailing list