How to Create an Encrypted USB Drive in Ubuntu

Data encryption has become a hot topic, especially in the wake of Snowden's revelations about government surveillance, with tech giants like Google and Apple now offering options to encrypt data on the latest versions of their respective mobile operating systems.

Aside from smartphones, laptop encryption is also recommended and is certainly gaining ground. However, a USB drive is one device that is used by almost everyone today but is usually not encrypted. In this article, we will discuss how to create an encrypted USB drive in Ubuntu.

Getting the prerequisites installed

Before you can go ahead and create an encrypted USB drive in Ubuntu, you need to install the cryptsetup utility on your Linux system, something which the Ubuntu users can easily do by executing the following command:

sudo apt-get install -y cryptsetup

You can also install the up-to-date version of the tool by downloading its latest release from its official website.

Encrypting the USB drive

WARNING: the encryption process requires your USB drive to be formatted, so make sure you've backed up all the existing data that you have in it.

Once you've installed cryptsetup, plug in your USB drive and open the Disks utility from Dash.

Open the Disks utility from Dash.

As you can see in the image above, in my case the utility detected the USB drive that I had plugged in. Make sure you select the USB drive in the Devices list and the relevant partition (shown in the right-hand side of the UI if there are more than one). Now click the Stop (or Unmount partition) icon present just below the highlighted partition - it will turn into a Play button as shown in the image below.

Click the Stop (or Unmount partition) icon.

Next, click the Gears icon present in the same line and select the "Format" option,

Click the Gears icon.

and you'll get the following window:

Format Volume window.

You can choose any of the Erase options (although slow erase is safer), but make sure to choose "Encrypted, compatible with Linux systems (LUKS +Ext4)" in Type. Further, you can enter any name in the Name field and a password of your choice in the next two fields.

As you click the Format button, you'll be asked to confirm your actions; just click the Format button again.

Confirm you want to format the volume.

The format process may take time depending on which Erase option you selected. Once done, pull your USB drive out and re-insert it, and you should see the following prompt:

Pull your USB drive out and re-insert it.

Congratulations! You've successfully encrypted your USB drive.


As you have observed, it's an easy way to create a secure USB drive on Ubuntu. A point worth mentioning here is that encrypting the drive could slow it down a bit, but that's not a high price, especially if safeguarding your data is your highest priority.

Himanshu Arora

Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox