28.4.4. Create a mapping to allow access to the device's decrypted contents
To access the device's decrypted contents, a mapping must be established using the kernel device-mapper
.
It is useful to choose a meaningful name for this mapping. LUKS provides a UUID (Universally Unique Identifier) for each device. This, unlike the device name (eg: /dev/sda3
), is guaranteed to remain constant as long as the LUKS header remains intact. To find a LUKS device's UUID, run the following command:
cryptsetup luksUUID <device>
An example of a reliable, informative and unique mapping name would be luks-<uuid>
, where <uuid> is replaced with the device's LUKS UUID (eg: luks-50ec957a-5b5a-47ee-85e6-f8085bbc97a8
). This naming convention might seem unwieldy but is it not necessary to type it often.
cryptsetup luksOpen <device> <name>
There should now be a device node, /dev/mapper/<name>
, which represents the decrypted device. This block device can be read from and written to like any other unencrypted block device.
To see some information about the mapped device, use the following command:
dmsetup info <name>
Tip
For more information, read the dmsetup(8)
man page.