LUKS is the standard for Linux hard disk encryption. The following few commands are all you need to encrypt your next external hard disk or USB key on a Debian-based distribution like Ubuntu.

Installation

Install the required software and load the module into the running kernel without restarting:

sudo aptitude install cryptsetup
sudo modprobe dm_crypt

Drive creation

Set up encryption on the disk and mount it:

sudo cryptsetup luksFormat /dev/sdb1
sudo cryptsetup luksOpen /dev/sdb1 external
sudo mkfs.ext4 /dev/mapper/external
sudo mount /dev/mapper/external /mnt

Mounting

How to mount the drive:

sudo cryptsetup luksOpen /dev/sdb1 external
sudo mount /dev/mapper/external /mnt

Unmounting

How to unmount the drive:

sudo umount /mnt
sudo cryptsetup luksClose external