kesto.de Cheatsheets

cryptsetup

Create and format encrypted partition

# WARNING: destroys existing data
cryptsetup luksFormat /dev/sda5
cryptsetup luksOpen /dev/sda5 sda5_crypt
mkfs.ext4 /dev/mapper/sda5_crypt

Open and mount encrypted partition

cryptsetup luksOpen /dev/sda5 sda5_crypt
mount /dev/mapper/sda5_crypt /mnt/tmp

Unmount and close encrypted partition

umount /mnt/tmp
cryptsetup luksClose sda5_crypt

List opened encrypted partitions

dmsetup ls

(will list other logical volumes too)