Disk encryption
LUKS
Erase table and filesystem signatures and overwrite device with random data:
wipefs --all /dev/sde
dd if=/dev/urandom of=/dev/sde bs=4M status=progress
Initialize a LUKS partition and open it:
cryptsetup luksFormat /dev/sde
WARNING!
========
This will overwrite data on /dev/sde irrevocably.
Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/sde:
Verify passphrase:
cryptsetup open /dev/sde foo
Enter passphrase for /dev/sde:
Make filesystem and mount it:
mkfs.ext4 /dev/mapper/foo
mke2fs 1.47.4 (6-Mar-2025)
Creating filesystem with 111616 1k blocks and 27888 inodes
Filesystem UUID: e4805c08-4d97-48c8-921f-91b203279131
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
mount /dev/mapper/foo /mnt