How to setup partition encryption?
To setup partition encryption on Ubuntu, perform the following steps:
Install the required software
apt-get install cryptsetup
For more security, erase the partition you want to encrypt with one of the following commands
sudo dd if=/dev/zero of=/dev/sdXN bs=4K or sudo badblocks -c 10240 -s -w -t random -v /dev/sdXN or sudo dd if=/dev/urandom of=/dev/sdXN bs=4K
Load the encryption kernel modules
sudo modprobe dm-crypt sudo modprobe sha256 sudo modprobe aes
Enable encryption on the partition you want to encrypt
cryptsetup --verify-passphrase luksFormat /dev/sdXN -c aes -s 256 -h sha256
Map the partition you want to encrypt
cryptsetup luksOpen /dev/sdXN securebackup
Format the partition
mkfs -t ext3 -m 0 -O dir_index,filetype,sparse_super /dev/mapper/securebackup