How to tell where a LUKS device is mapped to

Dave Smith dave at thesmithfam.org
Mon Aug 9 17:42:26 MDT 2010


I want to relate two related LUKS-related puzzles.

Puzzle 1: Finding where a LUKS device is mapped.

I have a device that is known to be LUKS formatted. Let's call it 
/dev/sda3. I verify that it is LUKS formatted as follows:

 > cryptsetup isLuks /dev/sda3
 > echo $?
0

Now I want to find out whether it's open. My first guess is to look in 
/dev/mapper, and sure enough, there are multiple devices in there that 
could be candidates.

 > ls -l /dev/mapper
total 0
crw-rw---- 1 root root  10, 59 2010-08-07 11:39 control
brw-rw---- 1 root disk 252,  0 2010-08-09 17:11 
udisks-luks-uuid-6497d53d-5413-4368-80eb-bef311497fb6-uid2343
brw-rw---- 1 root disk 252,  0 2010-08-09 17:15 
udisks-luks-uuid-54779533-1245-1234-5efb-1dcb3ac3def-uid1371

How can I tell which of the two /dev/mapper devices corresponds to 
/dev/sda3?

Puzzle 2: The Reverse

I have a mountpoint, /mnt/foo, that I think might be mounted to a LUKS 
device. I use 'df' to find where it's mounted, as follows:

 > df -h /mnt/foo
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/udisks-luks-uuid-6497d53d-5413-4368-80eb-bef311497fb6-uid2343
                       236M  2.1M  222M   1% /mnt/foo

That looks like a candidate to me. How do I find out which physical 
device that comes from?

Thanks in advance!

--Dave


More information about the PLUG mailing list