Learn more about Linux Unified Key Setup.
# create partition
fdisk /dev/sdX
# initiate partition encryption (optional, but suggested)
cryptsetup open --type plain /dev/sdXN container
# fill with encrypted data (optional, but suggested)
dd if=/dev/zero of=/dev/mapper/container
# establish LUKS encryption
cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 8000 --use-random luksFormat /dev/sdXN
# create file of N size
fallocate -l N /path/to/file
# establish LUKS encryption
cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 8000 --use-random luksFormat /path/to/file
# decrypt LUKS
cryptsetup luksOpen /path/to/file container
# fill with encrypted data (ensure real disk allocation. maybe optional, but suggested)
dd if=/dev/zero of=/dev/mapper/container
# close LUKS
cryptsetup luksClose container
# decrypt LUKS
cryptsetup luksOpen /dev/sdXN container
mkfs.ext4 /dev/mapper/container
/dev/mapper/container
points to the decrypted file space. container
can be replaced with your string of choice.
mount /dev/mapper/container /mountpoint
umount /mountpoint
(be sure to unmount first)
cryptsetup luksClose container