See dm-crypt/Device encryption
List devices on computer
sudo fdisk -l
# or
lsblkBenchmarking different encryption algorithms
Since changing an encryption cipher of a block device after setup is difficult, it is important to check dm-crypt performance for the individual parameters in advance:
cryptsetup benchmarkcan give guidance on deciding for an algorithm and key-size prior to installation. If certain AES ciphers excel with a considerable higher throughput, these are probably the ones with hardware support in the CPU.
Quoted from here
Encrypting a device with LUKS
See here
# format a LUKS partition, this will prompt you for a password
sudo cryptsetup luksFormat <device>
# check the results
sudo cryptsetup luksDump <device>Accessing a LUKS-encrypted device
See here
# this creates a device at `/dev/mapper/<device_mapped_name>`
sudo cryptsetup open <device> <device_mapped_name>
# example
sudo cryptsetup open /dev/sda1 backupAll access must be through /dev/mapper/backup for the encryption to work. This includes creating a filesystem such as Btrfs.
sudo mkfs.btrfs /dev/mapper/backup/dev/mapper/backup can be mounted like any regular partition.
To close the LUKS encryption, unmount the partition, then run
sudo cryptsetup close backup