[parted-devel] Wrong metadata and free space geometries with non-standard GPT layout

Pascal Hambourg pascal at plouf.fr.eu.org
Fri Oct 3 10:46:26 BST 2025


On 28/09/2025 at 11:17, Pascal Hambourg wrote:
> 
> However the reported metadata and free space geometries are wrong when 
> the GPT partition entry array does not start at LBA 2: they are reported 
> as if the partition array started at LBA 2, like in the above example. 
> This is confusing and gets in the way of my intent to check if the GPT 
> metadata overlap with the boot loader area.

After some testing and code reading, I understand that the partition 
entry array will be relocated at LBA 2 on write regardless of the 
original on-disk PartitionEntryLBA, so the reported metadata geometry 
reflects what would be written to disk and may be different from the 
original on-disk metadata layout.

Note: IMO relocating the partition entry array is dangerous if the 
original partition table layout was carefully crafted to reserve space 
for the boot loader between the GPT header and the partition entry 
array: any change to the partition table will relocate the partition 
entry array and overwrite the boot loader.

What about free space geometry ? Shouldn't it reflect actually usable 
space and be bounded to the data area (between FirstUsableLBA and 
LastUsableLBA) ?



More information about the parted-devel mailing list