Encrypting a USB Drive with LUKS on Linux1
- Identify the disk with
fdisk
sudo fdisk -l
- Encrypt the device
sudo cryptsetup luksFormat --type luks2 /dev/sdSOMETHING
- Unlock the device with:
sudo cryptsetup luksOpen /dev/sdSOMETHING NAME
- Write a filesystem in it
# Choose any filesytem you'd like. ext4 is often enough.
sudo mkfs -t ext4 -V /dev/mapper/DEVICE
Note
Consider making a smaller, non-encrypted partition to leave a note such as “return to” information.
- Mount the device
# /mnt/DEVICE seems to be the preferred mount location.
sudo mount /dev/mapper/DEVICE /where/you/want/it/to/be
Note
Don’t forget to umount
before removing the device!
- Mounting
-
sudo cryptsetup luksOpen /dev/sdSOMETHING DEVICE sudo mount /dev/mapper/DEVICE /where/you/want/it/to/be
- Unmounting
-
sudo umount /where/you/want/it/to/be sudo cryptsetup luksClose DEVICE
1 Thoss, S. (2021) Encrypt a usb drive with luks on linux. Stefandroid Blog. Available at: https://blog.stefandroid.com/2021/02/08/encrypt-usb-drive-with-luks.html (Accessed: March 31, 2025).