Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:GPT partition table

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

GUID Partition Table: the UEFI partition scheme with a header "EFI PART" at LBA 1, a backup header in the last LBA, CRC32-protected header and entry array, and 128-byte entries naming a type GUID, unique GUID, LBA range, attributes and a UTF-16 name. Fronted by a protective MBR with a 0xEE entry.

Layout

Per util-linux libblkid/src/partitions/gpt.c:

  • LBA 0: protective MBR (Format:MBR partition table) with an entry of type 0xEE. libblkid requires a valid MBR signature and a 0xEE entry before probing GPT unless forced.
  • LBA 1 (GPT_PRIMARY_LBA): primary header. The backup header is in the last LBA of the device (libblkid tries LBA 1 first, then the last LBA).
  • Entry array: partition_entries_lba (2 in the primary copy), num_partition_entries x sizeof_partition_entry.

Header (struct gpt_header, little endian, 92 bytes used)

Offset Size Field
0 8 signature "EFI PART" (0x5452415020494645)
8 4 revision
12 4 header_size (usually 92; must be >= 92 and <= sector size)
16 4 header_crc32 (computed with this field zeroed)
20 4 reserved
24 8 my_lba (must equal the LBA the header was read from)
32 8 alternate_lba
40 8 first_usable_lba
48 8 last_usable_lba
56 16 disk_guid
72 8 partition_entries_lba
80 4 num_partition_entries
84 4 sizeof_partition_entry (libblkid insists on 128)
88 4 partition_entry_array_crc32

CRC32 is the standard zlib CRC (seed ~0, final xor ~0) over header_size bytes for the header and over the whole entry array for the second checksum.

Entry (struct gpt_entry, 128 bytes)

partition_type_guid (16), unique_partition_guid (16), starting_lba (8), ending_lba (8, inclusive), attributes (8), partition_name (72 bytes, UTF-16LE). An all-zero type GUID marks an unused entry.

GUID byte order

GUIDs are mixed endian on disk: the first three fields (4, 2, 2 bytes) are little endian, the last 8 bytes are in order. C12A7328-F81F-11D2-BA4B-00A0C93EC93B is stored as 28 73 2A C1 1F F8 D2 11 BA 4B 00 A0 C9 3E C9 3B.

Well-known partition type GUIDs (util-linux include/pt-gpt-partnames.h)

GUID Name
C12A7328-F81F-11D2-BA4B-00A0C93EC93B EFI System
21686148-6449-6E6F-744E-656564454649 BIOS boot
E3C9E316-0B5C-4DB8-817D-F92DF00215AE Microsoft reserved
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 Microsoft basic data
DE94BBA4-06D1-4D40-A16A-BFD50179D6AC Windows recovery environment
0FC63DAF-8483-4772-8E79-3D69D8477DE4 Linux filesystem
0657FD6D-A4AB-43C4-84E5-0933C84B4F4F Linux swap
E6D6D379-F507-44C2-A23C-238F2A3DF928 Linux LVM
933AC7E1-2EB4-4F13-B844-0E14E2AEF915 Linux home
4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 Linux root (x86-64)
A19D880F-05FC-4D3B-A006-743F0F84911E Linux RAID
7C3457EF-0000-11AA-AA11-00306543ECAC Apple APFS

Analyst notes

  • Sector size matters: LBA 1 is byte 512 on 512-byte media and byte 4096 on 4Kn media; libblkid uses the probed sector size.
  • When copying an image to a larger disk the backup header is no longer in the last LBA; tools rewrite it.
  • Unverified: Android and ChromeOS images use their own type GUIDs not listed here.

Code & repositories

  • util-linux libblkid/src/partitions/gpt.c (GPL).
  • https://github.com/util-linux/util-linux @ d427f58b7a22b960ccc8d02ce30c58bdbe4286d8 · license: GPL-2.0
    include/pt-mbr.h, include/pt-gpt-partnames.h, libblkid/src/partitions/dos.c and gpt.c: partition table structures and type ids/GUIDs
    Tested on: source read, not run: source read only · checked 2026-10-19; last activity 2026-10-14