cryptsetup-luksHeaderRestore - Linux


cryptsetup-luksHeaderRestore is a powerful tool for recovering the header of a LUKS (Linux Unified Key Setup) encrypted device when it has become corrupted or damaged. It can restore the header from a previously saved backup or generate a new one.


cryptsetup-luksHeaderRestore [options] device [backup-file]


  • -d, –device DEVICE: Specifies the LUKS device to restore the header for.
  • -b, –backup-file FILE: Restores the header from the specified backup file.
  • -g, –generate: Generates a new header if the device does not have a backup.
  • -h, –hash HASH: Specifies the hash algorithm to use for the header (default: sha256).


Restoring from a Backup

cryptsetup-luksHeaderRestore -d /dev/sdc1 -b backup.bin

Generating a New Header

cryptsetup-luksHeaderRestore -g -d /dev/sdc1

Common Issues

Invalid Backup File

Ensure that the backup file is valid and contains a header suitable for the device.

Header Corruption Detected

If the header on the device is already corrupted, cryptsetup-luksHeaderRestore may not be able to repair it. Consult a data recovery specialist for advanced recovery options.


cryptsetup-luksHeaderRestore can be combined with other commands to achieve complex recovery tasks:

  • dd: Copy the backup file to the device.
  • shred: Securely wipe the device before generating a new header.

Related Commands

  • cryptsetup: General tool for managing LUKS devices.
  • cryptsetup-luksDump: Creates a backup of the LUKS header.