[parted-devel] How large is a GPT?

Jim Meyering jim at meyering.net
Fri Dec 30 00:06:07 UTC 2011


Phillip Susi wrote:

> On 12/29/2011 10:37 AM, Jim Meyering wrote:
>> 64kb is not large enough on a disk with 4KB sectors.
>>
>> Technically, the primary GPT header occupies sectors 1..33 of
>> your disk.  The 0'th sector is the so-called protective MBR.
>> That means you can start the BIOS boot partition at sector 34,
>> aka "34s".  With parted, that "34s" notation works regardless
>> of whether you're using a drive with 512-byte sectors (most common)
>> or a newer one with 4k-byte sectors.
>
> Huh?  Why would the size change for a 4kb disk?  The entries are still
> the same size, and you still make a table with 128 entries, don't you?
> So it should be the same size.

Good catch.  The header size does depend on the sector size, but part of
what I implied is wrong.  34s does always work, but it is not a tight bound.

So with sectors larger than 512 bytes, here are the rules:

Only two parts are sector based: the pMBR and the partition table
header.  With sector size larger than 512 and PE size of 128 bytes,
there may be more than four PEs per sector.  For example, with a 4KiB
sector size, you'd have one sector for the pMBR, one whole sector
for the header and 4 sectors to accommodate 128 partition entries --
all for a total of only 6 sectors (i.e., 24KiB).

In general you'll need to allocate 2 + 128*128/sector_size sectors
for those initial GPT administrative bytes, and one sector less at
the end of the disk.



More information about the parted-devel mailing list