Encrypting Backups

It's a good idea to encrypt your backups, particularly if you take them offsite (and you SHOULD!).

1. Partition your external usb hard drive as normal: fdisk /dev/disk/by-id/usb-external_drive
2. Encrypt the created partition: cryptsetup luksFormat /dev/disk/by-id/usb-external_drive-part1 /etc/volume_key
3. Open the encrypted partition: cat /etc/volume_key | cryptsetup luksOpen /dev/disk/by-id/usb-external_drive-part1 EncryptedBackup
4. Create a filesystem in the opened (mapped) encrypted partition: mkfs -t ext4 /dev/mapper/EncryptedBackup
5. Mount the filesystem to check that it works: mount /dev/mapper/EncryptedBackup /mnt/backup
6. Umount the filesystem once finished: umount /dev/mapper/EncryptedBackup
7. Close the encrypted partition: cryptsetup luksClose /dev/mapper/EncryptedBackup