31

If I mount a simple loop device,

losetup -a

give me the devices opened. Is something similar possible with cryptsetup?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
elbarna
  • 12,050
  • 22
  • 92
  • 170

2 Answers2

41

dmsetup is useful for anything device mapper related. For Example:

[root@localhost]~# dmsetup ls --target crypt
luks-90dc732d-e183-4948-951e-c32f3f11b305   (253, 0)
[root@localhost]~# 
Cristian Ciupitu
  • 2,430
  • 1
  • 22
  • 29
Bratchley
  • 16,684
  • 13
  • 64
  • 103
  • 4
    Is there any way to list all mappings with their target type? The best I could manage was `for i in $(sudo dmsetup targets | cut -f1 -d' '); do echo $i:; sudo dmsetup ls --target $i; echo; done` – mwfearnley Apr 05 '18 at 09:49
  • 8
    Thx. Getting the list shouldn't be so _cryptic_... `luksList` would be nice. – bvj Apr 18 '19 at 05:31
31

I just looked for the same thing, a list of my luks partitions, though I wanted a mapping to the physical /dev/sdX devices.

I found a solution for that here: https://bbs.archlinux.org/viewtopic.php?id=164798

lsblk --fs
kaefert
  • 421
  • 4
  • 3
  • 8
    Just a friendly reminder that `lsblk` supports `-J` or `--json` to output the result in a machine readable format. Which can be useful when doing a reverse lookup of dmcrypt mapper devices *(`/dev/sda` -> `luksloop` for instance by iterating the `/dev/sda` children object)*. – Torxed Mar 14 '21 at 11:53