$DEV=/dev/sdXY # This is the device that gets blown away and encrypted
$MAP=backup # This is an identifier, will create a node at /dev/mapper/$MAP
Create encrypted volume:
cryptsetup -y -v luksFormat $DEV
To open it, check status:
cryptsetup luksOpen $DEV $MAP
ls -l /dev/mapper/$MAP
cryptsetup -v status $MAP
cryptsetup luksDump $DEV
This will erase all patterns, helps keeping it safe (takes forever, though):
dd if=/dev/zero of=/dev/mapper/backup2 status=progress
Now create a FS:
mkfs.ext4 /dev/mapper/$MAP
If OS doesn't auto-mount:
mkdir /mnt/$MAP
mount /dev/mapper/$MAP /mnt/$MAP
Now check it's there:
df -H
cd /mnt/$MAP
ls -l
You're good!
umount /mnt/$MAP
cryptsetup luksClose $MAP
cryptsetup luksOpen $DEV $MAP
mount /dev/mapper/$MAP /mnt/$MAP