Skip to content

USB drive encryption with LUKS (btrfs)

Linked Documentation

cryptsetup format new disk

Format you device
cryptsetup -V || echo "ERROR: cryptsetup not found"

DEVICE=/dev/sdX
LABEL="SECRET_KLAUS_HERGERSHEIMER"
#CIPHER="nsa"

sudo cryptsetup  --label $LABEL luksFormat $DEVICE -
sudo cryptsetup isLuks $DEVICE && echo Success
sudo cryptsetup luksDump $DEVICE | grep -E '^(Label|UUID):'

sudo cryptsetup luksOpen $DEVICE $LABEL 
sudo dmsetup info $LABEL
sudo mke2fs /dev/mapper/$LABEL

# make tea

sudo mount /dev/mapper/$LABEL $HOME/$LABEL
cd $HOME/$LABEL
sudo touch TEST && echo WriteOK
cd && sudo umount $HOME/$LABEL