Re: label written on top of the header

Milan Broz <[email protected]> Wed, 25 Jun 2025 16:16:34 +0200
Newsgroups dev.linux.lists.cryptsetup
Message-ID <[email protected]>
On 6/25/25 4:05 PM, Dominik Rak wrote:
> hello
> i have overwritten a part of the luks2 header with an mbr label but the 2nd binary header and 2nd json area and everything after it is fully intact

If it is LUKS2, then crypsetup repair <device> should fix it automatically.

Always create a backup (dd first 16 MB if header is corrupted and you cannot use luksHederBackup command).

...

> also after creating a few sample volumes i have noticed that the area where the 1st binary header and 1st json area are compared to the area where the 2nd binary header and 2nd json area are is not identical because there is some undocumented something, unspecified in the https://gitlab.com/cryptsetup/LUKS2-docs/blob/main/luks2_doc_wip.pdf , if its not random then it was overwritten by the label

What exactly is not documented? There is some random data, the reason is explained in spec (to avoid deduplication).

> and the last thing i can think of, does the uuid of the device matter in decryption?

No, but you have to calculate correct checksum of the binary and JSON area.


Milan