# How to open unmounted luks volume which believes it is open

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 ?

• Try lsof -n | grep /dev/hdd. Check to see if anything actually has it open. If so, stop the other thing. BTW are you sure you have that device name correct? /dev/hdd/luksCrypted is an unusual name. – Zoredache Dec 11 '14 at 20:32
• Nothing there.. – davidgo Dec 12 '14 at 0:57
• I've found useful tips at stackoverflow.com/questions/5881134/… - particularly with regard to using dmsetup info and related commands. – davidgo Dec 23 '16 at 20:13

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