== Step 3: Creating mapping to allow access to a decrypted content
To access a decrypted content on a device, you need to create a mapping using the kernel `device-mapper`.
LUKS provides a UUID (Universally Unique Identifier) for each device. This UUID is guranteed to remain the same as long as the LUKS header remains intact. To find a LUKS UUID for the device, 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 LUKS UUID for the device (for example, luks-50ec957a-5b5a-47ee-85e6-f8085bbc97a8).
. Create a mapping to access the decrypted contents on the device:
+
--------
# cryptsetup luksOpen <device> <name>
--------
+
You are prompted to enter the passphrase for the device. Once you have authenticated, you can see the mapping `/dev/mapper/<name>` which represents the decrypted device. You can read from and write to this device like you would any other unencrypted block device.
. To see the status of the mapping:
+
------
# cryptsetup -v status <name>
------
+
Sample output:
+
--------
/dev/mapper/<name> is active.
type: LUKS1
cipher: aes-cbc-essiv:sha256
keysize: 256 bits
device: /dev/xvdc
offset: 4096 sectors
size: 419426304 sectors
mode: read/write
Command successful.
--------
[id='proc_create-filesystems-on-mapped-device']
== Step 4: Creating filesystems on a mapped device
After <<proc_create-mapping-to-allow-access-to-decrypted-contents>>, you can now use the mapped device node `/dev/mapper/<name>` like any other block device.
. To create an `ext2` filesystem on the mapped device:
+
-------
# mke2fs /dev/mapper/<name>
-------
. To mount this file system:
+
--------
# mkdir /mnt/test/
# mount /dev/mapper/<name> /mnt/test
--------
[id='proc_add-mapping-information-to-etc-fstab']
== Step 5: Adding the mapping information to `/etc/fstab`
In order for a system to setup mapping to a device, add a corresponding entry in the `/etc/crypttab` file.
. If your system does not have the `/etc/crypttab` file, create a new file and change the owner and group to `root` (`root:root`):
+
----------
# touch /etc/crypttab
# chmod 0744
----------
. To identify the correct device in case the device name changes, add:
+
---------
<name> <device> none
---------
+
Here, the `<device>` field should be given in the form `UUID=<luks_uuid>`, where `<luks_uuid>` is the LUKS UUID.
[id='proc_add-entry-to-etc-fstab']
== Step 6: Adding an entry to `/etc/fstab`
To ensure a persistent mapping between the device and the mount point, add the entry in the `/etc/fstab` file: