LUKS header backup
A LUKS header backup preserves the encryption metadata and keyslot area needed to recover a volume key with a matching credential.
luksHeaderBackup stores a binary copy of the LUKS header and keyslot area. The saved header is a separate key-access path: with a passphrase valid at backup time it allows decryption of the data area even after that passphrase was changed or removed on the device. Its security relevance persists while the corresponding volume key protects data. [1]
For LUKS2, the metadata area is 16 to 4096 kB including 4096 bytes of binary header, and the keyslot area must be a multiple of 4096 bytes up to 128 MB. A backup therefore carries the whole encrypted key-material area, not only the JSON metadata. [4]
Restoration replaces the target header and keyslots, after which only passphrases from the backup work. It requires matching volume key size and data offset unless the device has no LUKS header. That match does not establish that a backup belongs to the intended payload. [2]
Relations
- related
- LUKS, LUKS keyslot, Backup, Cryptographic erase
Advantages
- A damaged on-disk header can be replaced from the file, restoring access with the passphrases that were valid when it was saved. [1, 2]
Limitations
- Overwriting the device header and keyslots no longer removes access by itself. Every header backup must also be securely erased, or the data area overwritten, which is less reliable because some sectors can survive through defect management. [1]
Citations
- cryptsetup v2.7.0: header backup and retained access
- cryptsetup v2.7.0: header replacement and compatibility checks
- cryptsetup v2.7.0: common options, --luks2-metadata-size and --luks2-keyslots-size
Further reading
Sources & caveats
- luks-backup-v270 and luks-restore-v270 are the cryptsetup v2.7.0 luksHeaderBackup(8) and luksHeaderRestore(8) sources, re-read for the warning text and the key size and data offset check.
- luks-options-v270 is the cryptsetup v2.7.0 common options source, read for the LUKS2 metadata sizes, the 4096-byte binary area and the 128 MB keyslot limit.
- A cryptsetup 2.7.0 file experiment recovered the original key from saved LUKS1 and LUKS2 headers after live-keyslot erasure.
- In the same experiment a foreign-header control passed a password check while returning a different key from the target's original one. No payload restoration was tested.
- The sanitize-nvme entry links here because a header backup kept off the device is outside a device sanitize and must be erased separately.