From: Milan Broz <gmazyland@gmail.com>
To: Vitalii Hordii <vitalnodo@outlook.com>, util-linux@vger.kernel.org
Subject: Re: luks2: need to check the availability of a JSON area
Date: Thu, 9 May 2024 12:00:35 +0200 [thread overview]
Message-ID: <2cd5daa0-9b7c-409d-86e7-a2f0951bd63c@gmail.com> (raw)
In-Reply-To: <DBBP194MB111315092E137148D78773F3B0E52@DBBP194MB1113.EURP194.PROD.OUTLOOK.COM>
On 5/8/24 6:07 PM, Vitalii Hordii wrote:
> Hello,
>
> I had some problems with restoring a luks2 partition after using, for
> example, mkfs.ntfs because it only leaves a 2nd JSON area without a
> secondary binary header, which I had to create myself. What if there was
> a function in libblkid that allows one to determine if there is a 2nd
> JSON and if there is a chance of recovery? Because as I see here,
> automatically repairing
> https://gitlab.com/cryptsetup/cryptsetup/-/issues/750 is apparently
> missing due to the lack of checking if there is an area here in
> libblkid. Also this seems to be a pretty popular problem on the internet
> when it comes to installing other operating systems. Would it be okay to
> add such a feature?
Hi,
Blkid already scans for *valid* 2nd LUKS2 header.
If the binary area for LUKS2 is missing, the header corrupted. Blkid
should not touch JSON metadata at all (JSON on-disk follows binary area).
Binary area was specifically designed for blkid use to be fast and do
not require any advanced metadata parsing.
So there is nothing to fix in blkid.
What we can add to cryptsetup repair command is to check
for specific case when wipefs marks LUKS2 binary area unusable
(this case can be easily recovered as it overwrites magic string only).
But I doubt mkfs format will touch only magic string, if the keyslot area
is (even partially) overwritten, the LUKS2 header is unusable anyway.
You should have a backup to recover data, not rely on a magic recovery.
Milan
prev parent reply other threads:[~2024-05-09 10:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 16:07 luks2: need to check the availability of a JSON area Vitalii Hordii
2024-05-09 10:00 ` Milan Broz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cd5daa0-9b7c-409d-86e7-a2f0951bd63c@gmail.com \
--to=gmazyland@gmail.com \
--cc=util-linux@vger.kernel.org \
--cc=vitalnodo@outlook.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).