Encrypted External USB Drive in XFCE

Encrypted External USB Drive in XFCE

This code will show you how to create an encrypted external USB drive in XFCE. XFCE is a nice lightweight window manager for Linux. While it is very light, fast and full of features, sometimes it doesn’t do everything you want. One thing I had trouble with was encrypting a USB drive. Here is how to just that.

Assuming your USB drive is /dev/sdb and you partition it thusly:

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x76b7989c
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    19533297     9765625    4  FAT16 <32M
/dev/sdb2        19533298   488397167   234431935   83  Linux

We'll encrypt the /dev/sdb2 drive with:

cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb2

That will overwrite the partition and ask you for a password.
Now we need to open the partition:

cryptsetup luksOpen /dev/sdb2 sdb2

Now make an ext4 filesystem on it:

mkfs.ext4 /dev/mapper/sdb2

Now create a readable label

e2label /dev/mappers/sdb2 250GB

Now close it up:

cryptsetup luksClose sdb2

Unplug it and replug it. You should have an icon on your desktop with the new label. Right click it to open it and it should ask for the password and there ya go

Leave a Reply

Your email address will not be published. Required fields are marked *

14 + eight =