guidendiannessdiskuefiguid-partition-table

How is data stored on disk? - EFI GUID


I posted this question earlier on SuperUser but I feel it is more suited for programmers.

If I understand correctly, according to GPT, the first 16 bytes of LBA 2 is the partition type GUID for the first partition on disk. In Windows Disk Management the first partition is designated as an EFI System Partition. However upon further investigation an EFI System Partition's GUID is:

C12A7328-F81F-11D2-BA4B-00A0C93EC93B

And yet the first 16 bytes tell me otherwise:

28732AC1-1FF8-D211-BA4B-00A0C93EC93B

Interestingly the first 3 sections act as little endian while the other 2 are big endian.

Why is this the case?


Solution

  • EFI_GUID datatype is declared as follows:

    typedef struct {
      UINT32  Data1;
      UINT16  Data2;
      UINT16  Data3;
      UINT8   Data4[8];
    } EFI_GUID;
    

    Because original EFI architectures (IA64 LE and IA32e) were little-endian by default, so are the integers. I haven't really seen an UEFI implementation on big-endian machine, so I don't know if standard GUIDs will be stored otherwise.