[dm-crypt] force luksClose

Milan Broz gmazyland at gmail.com
Thu Nov 29 15:53:03 CET 2012

On 11/29/2012 02:43 PM, Matthias Schniedermeyer wrote:

> IOW. It's a problem of finding the culprit who holds the mountpoint 
> open.

Exactly. You cannot remove open (in-use) device-mapper device.

You can it replace with "error" target though (this will detach
underlying device from mapping.).

Just run "dmsetup remove -f <name>"
instead of cryptsetup remove/luksClose <name>"

But the dead DM device will still be in system. I can easily add such
force option to cryptsetup as well but it will not help much.

The correct way is to force unmout fs (or whatever use this device)
and then remove crypt mapping (see lsblk, lsof etc).


There is a request to add "auto" removal flag for device-mapper devices
(automatic remove after last close, similar to loop auto removal).

Once this option will be in kernel cryptsetup will support it too.
But this will not help with your situation anyway.

More information about the dm-crypt mailing list