How to create an encrypted partition?

It's probably best to use a built-in solution like eCryptFS or LUKS. For an explanation about using eCryptFS, see the sites Jorge points to.

LUKS encryption is easy to set up with the GNOME Disk Utility; just tick the encryption checkbox at the bottom of the "format partition" dialog:

Screenshot of Format Partition dialog

The difference between both is that eCryptFS encrypts files (including the filenames), while LUKS encrypts a complete partition under the filesystem level.

Ubuntu can then remember your password when mounting if you want, allowing you to just plug and play on your device after logging in.


You don't really go into details of what your use case is so I'll just highlight the built in encryption features:

Ubuntu has built in support for an encrypted Private directory that might meet your needs, or you can set up encrypted home directories.


I suggest you use the Alternate Installer, which is able to encrypt the whole disk except the /boot partition.