Use an Encrypted USB drive/partition January 24, 2006Posted by Carthik in applications, snippets, ubuntu.
Martin Pitt, an Ubuntu developer, had written up a little note on how to use encrypted partitions with Ubuntu. I reproduce it below with minimal edits:
To create an encrypted partition on a removable device (like an USB stick), do the following:
* Install the package ‘cryptsetup’.
* If you do not want to encrypt the whole stick, repartition the stick with “sudo cfdisk /dev/sda” (or whichever device). E. g. my personal USB stick has a big unencrypted partition for data exchange and a very small (5 MB) encrypted partition for storing my GPG and SSH keys.
* Create an encrypted partition on the target partition:
sudo luksformat /dev/sda1
(or sda2 if you want to format the second partition, and so on).
This will ask you for a passphrase. The default file system is “vfat”, but you can specify a different one with the “-t” option (see manual page).
After this procedure, remove the stick and plug it in again. This should trigger a dialog which asks you for the passphrase and mounts the encrypted partition (along with any unencrypted one, of course).
Just a little warning at the end: Please be aware that if you lose the passphrase, there is *NO WAY* to restore your data!