Safe storage

Lars J├Ânsson 2019-09-08

How to create and use safe storage in Linux.

Create a safe storage (secret device)

dd if=/dev/zero bs=1M count=100 of=secret-device.img
sudo cryptsetup luksFormat secret-device.img 
sudo cryptsetup open --type luks secret-device.img secret-device
sudo mkfs.ext4 /dev/mapper/secret-device
mkdir safe-storage
sudo mount /dev/mapper/secret-device safe-storage
sudo chown $USER:`id -gn` safe-storage
sudo umount safe-storage
sudo cryptsetup close secret-device

Mount the safe storage (secret device)

sudo cryptsetup open --type luks secret-device.img secret-device
sudo mount /dev/mapper/secret-device safe-storage

Unmount the safe storage (secret device)

sudo umount safe-storage
sudo cryptsetup close secret-device