Use this when encrypting Linux disks with LUKS.
LUKS
LUKS is the standard Linux disk encryption format on dm-crypt. It stores encrypted volume keys in key slots unlocked by passphrases, key files or TPM, managed with cryptsetup.
1. LUKS encrypts Linux block devices (LUKS2 default).
2. Multiple keyslots (passphrase, key file, TPM2, Tang/clevis).
3. Back up the header — corruption = data loss.
4. Unlock at boot via crypttab.
5. Argon2id KDF.
keyslot → master key → dm-crypt → filesystem
Context & applicabilityCommon mistakes · platform/version boundaries
- No backup of the LUKS header (
cryptsetup luksHeaderBackup) — a damaged header loses all data. - Only one keyslot with a passphrase nobody remembers.
- Weak PBKDF parameters on LUKS1; LUKS2 with Argon2id is the default.
- Forgetting
/etc/crypttabentries, so volumes do not unlock at boot.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Back up the LUKS header.
- Several key slots allow passphrase and key file.
- Lost passphrase = lost data.
cryptsetup luksDump /dev/<dev>— header and keyslotscryptsetup status <name>— active mappingcryptsetup luksHeaderBackup /dev/<dev> --header-backup-file hdr.img— header backup
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
LUKS (Linux Unified Key Setup) encrypts block devices with dm-crypt; a header holds up to 32 keyslots (LUKS2), each able to unlock the master key with a passphrase, keyfile, TPM2 or FIDO2 token.
cryptsetup luksFormat --type luks2 /dev/sdb
cryptsetup open /dev/sdb data; mkfs.xfs /dev/mapper/data
cryptsetup luksDump /dev/sdb # keyslots, cipher (aes-xts-plain64)
cryptsetup luksHeaderBackup /dev/sdb --header-backup-file sdb-luks.hdr
systemd-cryptenroll --tpm2-device=auto /dev/sdb
Back up the header: if it is damaged, the data is unrecoverable even with the correct passphrase. Unlock at boot via /etc/crypttab.
ReferenceConfiguration & state2 sections · depth on demand
Commands
cryptsetup luksFormat --type luks2 /dev/sdb
cryptsetup open /dev/sdb data
mkfs.xfs /dev/mapper/data
cryptsetup luksDump /dev/sdb
cryptsetup luksAddKey /dev/sdb
cryptsetup luksHeaderBackup /dev/sdb --header-backup-file sdb-header.img
systemd-cryptenroll --tpm2-device=auto /dev/sdb
Documented example, not captured output. Back up the LUKS header (damage makes data unrecoverable). Auto-unlock with TPM2, Clevis/Tang (network-bound) or a key file in /etc/crypttab.
Commands
cryptsetup luksDump /dev/sdb1
cryptsetup luksAddKey /dev/sdb1
cryptsetup luksHeaderBackup /dev/sdb1 --header-backup-file sdb1-header.img
systemd-cryptenroll --tpm2-device=auto /dev/sdb1
Documented example, not captured output. Store header backups securely — they plus a passphrase unlock the volume.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Data Protection → LUKS. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://csrc.nist.gov/pubs/sp/800/209/final · confidence 94%