[dm-crypt] u?mount (8) helper script for luks encrypted disks

Milan Broz gmazyland at gmail.com
Fri Aug 30 07:29:53 CEST 2013

Well, if you want use such mount helper script, you can.

But I do no think this should be part of upstream package.

On 30.8.2013 1:56, .. ink .. wrote:
> On unmounting.
> 1. Look at the path to be unmounted,if it starts with "/dev/mapper/"
> then it could an mdraid path or a cryptsetup mapper path or
> something else.Its easy to check which one is it.


You have /dev/VG/LV or /dev/mpath/NAME (aka friendly mpath names) etc.
These are symlinks, or on non-udev system directly device nodes.

If you want to check for dm device, you should check for major
number of device. Ditto for MD (note md can be some fake
raid as well as replacement for dmraid.)

In shell script, I would use lsblk to detect it (that should have all
"known" tricks included :)

> 2. If its
> encrypted mapper path,then unmount the mapper and then call
> cryptsetup to unmap the mapper.If its not encrypted then just
> unmount.

Not sure if it works for lazy umount (device is still in use).

Also udev can perform blkid "scan on close" blocking the device
but this one problem should be already solved inside libdevmapper
(retrying removal).


More information about the dm-crypt mailing list