Is there a way to tell, given a path to a LUKS block device, and not knowing the passphrase, whether the device is already open (decrypted)?

What about knowing the path to the decrypted device?


The following code checks whether the device DEV_LUKS is an encrypted LUKS device and already opend (decrypted).


cryptsetup isLuks $DEV_LUKS && echo "$DEV_LUKS is a LUKS Device" || echo "$DEV_LUKS is not a LUKS Device"
test -b /dev/disk/by-id/dm-uuid-*$(cryptsetup luksUUID $DEV_LUKS | tr -d -)* && echo "$DEV_LUKS is opened" || echo "$DEV_LUKS is not opened"
| improve this answer | |

Another simple option which may show what you need:

dmsetup ls | grep crypt | cut -f1 -d_

On my system this returns:


This returns device names which include crypt which may be the case in your system.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.