[dm-crypt] inconsistency in opening multiple mappers on the same device

Milan Broz asi at seznam.cz
Fri Jun 1 08:31:33 CEST 2012

On 06/01/2012 12:12 AM, .. ink .. wrote:
> It looks like by default, cryptsetup does not allow opening more than
> one mapper on the same device bu it only checks the mapper name, not
> the device behind the mapper and hence it allows opening of multiple
> mappers on the same device as long as they use a different mapper
> name.

No. Try it with real device. (Loop devices are strange, losetup
allows you to map more loopback devices to one file. It was
always the same here, try it with previous version...)

It is basically about this:

By default, cryptsetup require exclusive access to underlying device:

# echo xxx | src/cryptsetup create x /dev/sdb x
# echo xxx | src/cryptsetup create y /dev/sdb x
Cannot use device /dev/sdb which is in use (already mapped or mounted).

With --shared it allows to use the same (already used) underlying device
# echo xxx | src/cryptsetup create y /dev/sdb x --shared

Obviously you cannot have the same mapping name...


More information about the dm-crypt mailing list