How to open unmounted luks volume which believes it is open

luks

I took a snapshot of a (live) luks encrypted block device, copied it to another system and am now trying to open it, but am unable to do so. Any help with solving this problem would be much appreciated.

The copied image is currently sitting on its own LVM partition

When I attempt to open the device with the command, and after entering the password

cryptsetup -v luksOpen /dev/hdd/luksCrypted blockname

I receive the response back "Cannot use device /dev/hdd/unenc_mail_dev which is in use (already mapped or mounted).
Command failed with code 16: Cannot use device /dev/hdd/unenc_mail_dev which is in use (already mapped or mounted).
"

I suspect there is something on the luks Device which says its mounted because it was a snapshot, but don't know what or how to clear it. I've tried looking for traces of this as a mounted filesystem by doing a df, losetup -a and grepping "luksCrypted" in the output of lsof with no luck.

When I run either of "crytpsetup status /dev/hdd/luksCrypted" or "cryptsetup status blockname" I get a response /dev/mapper/[luksCrypted|mailblock] is inactive.

Any ideas how I can open the volume ?

Best Answer

dmsetup remove_all worked for me, from the linked stackoverflow question.

Related Topic