cdisk-partitioningguid-partition-table

How to read the GUID Partition Table (GPT) and its entries?


To read the MBR partition table we use an offset of 0x1be, similarly what is the offset for reading the GP(artition)T(able) entries (ie, number of partitions and their sizes).

I am writing a C program using "gdisk" to create the partitions, I need to write the filesystems onto these partitions. So for this I need to read the GPT header to get the number of partitions and their allocated sizes.


Solution

  • what is the offset for reading the GPT partition table entries

    It typically is located in LBA 2. To verify check offset 0x30 (base-10 offset 48) to the GPT.