[parted-devel] [PATCH 0/2] gpt: Preserve relocated primary partition table

Pascal Hambourg pascal at plouf.fr.eu.org
Fri Dec 12 19:22:58 GMT 2025


On 12/12/2025 at 17:29, Brian C. Lane wrote:
> On Thu, Dec 11, 2025 at 09:44:39PM +0100, Pascal Hambourg wrote:
>> On 11/12/2025 at 20:51, Brian C. Lane wrote:
>>>
>>> I'm not really comfortable with guessing at the
>>> location of the primary partition array when using the backup header. It
>>> would be better to use the backup table to try and search for the
>>> primary, maybe?
>>
>> Do you mean to search a correlation between the contents of the backup
>> partition entry array and of possible locations between the primary header
>> and the first usable LBA ?
> 
> Yes.

Then we need to a way to compare two partition entry arrays. Maybe 
something like count the number of matching bytes, partition entries or 
sectors ?

> We'd have to assume that both tables aren't corrupt, which may not
> be a great assumption considering this is triggered by the primary
> header being invalid.
> 
> Other ideas welcome :)
The primary header is considered invalid if its partition entry array 
CRC is wrong, even if the header CRC itself is good. I personally 
disagree with this choice but this is per the UEFI/GPT specification.
So the disk may have an intact primary header (good header CRC) and a 
damaged primary partition entry array (wrong partition entry array CRC). 
In this case, couldn't its partition entry array LBA field be used ?



More information about the parted-devel mailing list