Create filesystems on the mapped device, or continue to build complex storage structures using the mapped device
29.4.5. Create filesystems on the mapped device, or continue to
build complex storage structures using the mapped device
Use the mapped device node (/dev/mapper/<name>) as any other block device. To create an ext2
filesystem on the mapped device, use the following command:
mke2fs /dev/mapper/<name>
To mount this filesystem on /mnt/test, use the following command:
mount /dev/mapper/<name> /mnt/test
29.4.6. Add the mapping information to /etc/crypttab
In order for the system to set up a mapping for the device, an entry must be present in the /etc/
crypttab file. If the file doesn't exist, create it and change the owner and group to root (root:root)
and change the mode to 0744. Add a line to the file with the following format:
<name>
<device>
The <device> field should be given in the form "UUID=<luks_uuid>", where <luks_uuid> is the LUKS
uuid as given by the command cryptsetup luksUUID <device>. This ensures the correct device
will be identified and used even if the device node (eg: /dev/sda5) changes.
29.4.7. Add an entry to /etc/fstab
Add an entry to /etc/fstab. This is only necessary if you want to establish a persistent association
between the device and a mountpoint. Use the decrypted device, /dev/mapper/<name> in the /
etc/fstab file.
In many cases it is desirable to list devices in /etc/fstab by UUID or by a filesystem label. The
main purpose of this is to provide a constant identifier in the event that the device name (eg: /dev/
sda4) changes. LUKS device names in the form of /dev/mapper/luks-<luks_uuid> are based
Tip
For more information, read the dmsetup(8) man page.
Important
The directory /mnt/test must exist before executing this command.
none
Tip
For details on the format of the /etc/crypttab file, read the crypttab(5) man page.
291