Skip to content

gs-101/.files

Repository files navigation

.files

./screenshots/hyprland.png

Notes

Encrypting a USB Drive with LUKS on Linux1

Encryption Process

  1. Identify the disk with fdisk
sudo fdisk -l
  1. Encrypt the device
sudo cryptsetup luksFormat --type luks2 /dev/sdSOMETHING
  1. Unlock the device with:
sudo cryptsetup luksOpen /dev/sdSOMETHING NAME
  1. 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.

  1. 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!

Usage

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
    

References

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).