GUID Partition Table is a standard for the layout of the partition table on a physical
hard disk, using globally unique identifiers. Although it forms a part of the Unified Extensible
Firmware Interface standard, it is also used on some BIOS systems because of the limitations
of master boot record partition tables, which use 32 bits for storing logical block addresses
and size information. As of 2010, most current operating systems
support GPT. Some, including OS X and Microsoft Windows, only support booting from GPT partitions
on systems with EFI firmware, but FreeBSD and most Linux distributions can boot from
GPT partitions on systems with either legacy BIOS firmware interface or EFI.
History
The widespread MBR partitioning scheme, dating from the early 1980s, imposed limitations
which affect the use of modern hardware. One of the main limitations is the usage of 32
bits for storing logical block addresses and size information. For hard disks with 512-byte
sectors, the MBR partition table entries allow up to a maximum of 2 TiB.
Intel therefore developed a new partition table format in the late 1990s as part of
what eventually became UEFI. The GPT as of 2010 forms a subset of the UEFI specification.
GPT allocates 64 bits for logical block addresses and therefore allows a maximum partition size
of 264−1 sectors. For disks with 512-byte sectors, that would be 9.4 ZB or 8 ZiB−512
bytes sectors × 512 bytes per sector). Features
MBR-based partition table schemes insert the partitioning information for four "primary"
partitions in the master boot record. In a GPT, the first sector of the disk is reserved
for a "protective MBR" such that booting a BIOS-based computer from a GPT disk is supported,
but the boot loader and O/S must both be GPT-aware. Regardless of the sector size, the GPT header
begins on the second logical block of the device.
Like modern MBRs, GPTs use logical block addressing in place of the historical cylinder-head-sector
addressing. The protective MBR is contained in LBA 0, the GPT header is in LBA 1, and
the GPT header has a pointer to the partition table, or Partition Entry Array, typically
LBA 2. The UEFI specification stipulates that a minimum of 16,384 bytes, regardless of sector
size, be allocated for the Partition Entry Array. On a disk having 512-byte sectors,
a partition entry array size of 16,384 bytes and the minimum size of 128 bytes for each
partition entry, LBA 34 is the first usable sector on the disk.
Hard disk manufacturers are transitioning to 4,096-byte sectors. As of 2010, the first
such drives continue to present 512-byte physical sectors to the OS, so degraded performance
can result when the drive's internal 4 KiB sector boundaries do not coincide with the
4 KiB logical blocks, clusters and virtual memory pages common in many operating systems
and file systems. This is a particular problem on writes when the drive is forced to perform
two read-modify-write operations to satisfy a single misaligned 4 KiB write operation.
Such a misalignment occurs by default if the first partition is placed immediately after
the GPT, as the next block is LBA 34, whereas the next 4 KiB boundary begins with LBA 40.
For backward compatibility with most operating systems before Windows Vista, including DOS,
OS/2 and Windows, MBR partitions must always start on track boundaries according to the
traditional CHS addressing scheme and end on a cylinder boundary. This even holds true
for partitions with emulated CHS geometries or partitions accessed only via LBA. Extended
partitions always start on cylinder boundaries as well.
This typically causes the first primary partition to start at LBA 63 on disks accessed via LBA,
leaving a gap of 62 sectors with MBR-based disks, sometimes called "MBR gap", "boot track",
or "embedding area". That otherwise unused disk space is commonly used by boot loaders
such as GRUB for storing their second stages. On older computers using alternative LBA/CHS
translation schemes or different extended CHS mappings, with smaller LBA-accessed disks,
or on disks accessed via CHS only, the gap could be smaller, although not normally less
than LBA 16 on normal hard disks. Since Windows Vista, the first partition usually
starts after a gap of 2,047 sectors at LBA 2,048 as part of its new 1 MiB partition alignment
policy, so no large-sector misalignment occurs by default, but serious compatibility problems
with older operating systems and disk tools exist.
Drives which boot Intel-based Macs are typically formatted with a GPT, rather than with the
Apple Partition Map. GPT also provides redundancy, writing the
GPT header and partition table both at the beginning and at the end of the disk.
If the minimum size of 16,384 bytes is allocated for the partition entry array, and the default
size of 128 bytes is used for each partition entry, then the maximum number of partitions
is limited to 128. Legacy MBR
Traditionally, in IBM PC compatible systems the first sector of the disk holds the Master
Boot Record, containing the drive's partitioning information and the code of the first stage
boot loader for BIOS-based systems. For limited backward compatibility, this sector is still
reserved for a MBR in the GPT specification, but it is now used in a way that prevents
MBR-based disk utilities from misrecognizing and possibly overwriting GPT disks. This is
referred to as a protective MBR. A single partition type of EEh, encompassing
the entire GPT drive, is indicated and identifies it as GPT. Operating systems and tools which
cannot read GPT disks will generally recognize the disk as containing one partition of unknown
type and no empty space, and will typically refuse to modify the disk unless the user
explicitly requests and confirms the deletion of this partition. This minimizes accidental
erasures. Furthermore, GPT-aware OSes may check the protective MBR and if the enclosed
partition type is not of type EEh or if there are multiple partitions defined on the target
device, the OS may refuse to manipulate the partition table.
While the MBR layout was defined around a sector size of 512 bytes per sector, the actual
sector size can be larger on various media such as MO disks or hard disks with Advanced
Format. Extra space in the MBR typically remains unused.
If the actual size of the disk exceeds the maximum partition size representable using
the legacy 32-bit LBA entries in the MBR partition table, the recorded size of this partition
is clipped at the maximum, thereby ignoring the rest of disk. This amounts to a maximum
reported size of 2 TiB, assuming a disk with 512 bytes per sector. It would result in 16
TiB with 4 KB sectors, but since many older operating systems and tools are hard-wired
for a sector size of 512 bytes or are limited to 32-bit calculations, exceeding the 2 TiB
limit would cause serious compatibility problems. In operating systems that support GPT-based
boot through BIOS services rather than EFI, the first sector is also still used to store
the first stage of the bootloader code, but modified to recognize GPT partitions. The
boot loader in the MBR must not assume a fixed sector size of 512 bytes / sector.
Apple's Boot Camp software for Intel-based Apple Macs creates a hybrid partition table
to allow the booting of Windows. In this system the protective partition is reduced in size
to cover from sector 1 to the sector before the first regular partition included in the
hybrid MBR. Additional MBR partitions are then defined to correspond to the next three
GPT partitions. Partition table header
The partition table header defines the usable blocks on the disk. It also defines the number
and size of the partition entries that make up the partition table. The EFI stipulates
a minimum of 16,384 bytes be reserved for the partition table array, so there are 128
partition entries reserved, each 128 bytes long.
The header contains the disk globally unique identifier. It records its own size and location
and the size and location of the secondary GPT header and table. Importantly, it also
contains a CRC32 checksum for itself and for the partition table, which may be verified
by the firmware, bootloader and/or operating system on boot. Because of this, hex editors
should not be used to modify the contents of the GPT. Such modification would render
the checksum invalid. In this case, the primary GPT may be overwritten with the secondary
one by disk recovery software. If both GPTs contain invalid checksums, the disk would
be unusable, by software that checks the checksum. The values for current and backup LBAs of
the primary header should be the second sector of the disk and the last sector of the disk,
respectively. The secondary header at the end of the disk identifies its own table of
partition entries, which is located directly before that header.
This table must be referenced relative to LBA 1. Thus, on 4Kn disks with 4 KB sectors
it does not follow the 512 bytes of the MBR physically and thereby becomes part of LBA
0 on disks with larger sector sizes. While the described arrangement happens to occur
on disks with 512 bytes per sector, there may be "gaps" of unused space between them
on disks with larger sector sizes. In other words, with 512-byte sectors it starts at
512th byte from the beginning of the disk, while with 4 KB sectors it starts at 4096th
byte. If multi-sector reads are performed, the actual sector size must be included in
the calculation when referencing this table. Partition entries
The GPT uses simple and straightforward entries to describe partitions. The first 16 bytes
designate the partition type globally unique identifier. For example, the GUID for an EFI
System partition is {C12A7328-F81F-11D2-BA4B-00A0C93EC93B}. The second 16 bytes contain a GUID unique
to the partition. Then follow the starting and ending 64-bit LBAs, partition attributes
and partition names. As is the nature and purpose of GUIDs, no central registry is needed
to ensure the uniqueness of the GUID partition type designators. The location of the partition
entries array on disk is defined in the GPT header.
The GPT header contains a field that specifies the size of a partition table entry. The minimum
required is 128 bytes, but implementations must allow for other values.
Also, the sector size must not be assumed to be hard-wired to 512 bytes per sector in
calculations, that is, there can be more than four partition entries in a single sector,
and it is possible to have a sector hold only a fraction of a partition entry. Except for
the first two sectors, the GPT specification just describes the size and organization of
a data structure, not in how many sectors it is stored on disk.
The 64 bits partition table attributes are shared between 48 bits common attributes for
all partition types, and 16 bits type-specific attributes.
Microsoft defines the type-specific attributes for Basic data partition according to this
TechNet article as: Operating systems support
Hybrid MBRs are non-standard and can be interpreted in different ways by different OSes. Unless
otherwise noted, OSes provide precedence to the GPT data when a hybrid MBR configuration
is encountered. The term No native support on this arch and
version. should be understood this way: Not supported as data disk, only known legacy
partitions found in protective MBR are accessible via the OS. Detachable disks: only support
for MBR partitioning; No access with end user applications. GPT contained raw data is accessible
with third-party administrator tools for low level disk access. True file system level
support in read or read-write form might be subject of software from a third-party vendor.
UNIX and Unix-like operating systems Windows: 32-bit versions
Windows does not support EFI on 32-bit platforms, and therefore does not allow booting from
GPT partitions. Windows: 64-bit versions
Partition type GUIDs A. ^ The GUIDs in this table are written assuming
a little-endian byte order. For example, the GUID for an EFI System partition is written
as {C12A7328-F81F-11D2-BA4B-00A0C93EC93B} here, which corresponds to the 16 byte sequence
28h 73h 2Ah C1h 1Fh F8h D2h 11h BAh 4Bh 00h A0h C9h 3Eh C9h 3Bh — only the first three
blocks are byte-swapped. B. ^ The formation of this GUID does not follow
the GUID definition; it is formed by using the ASCII codes for the string "Hah!IdontNeedEFI".
Such formation of "GUID" value breaks down the guaranteed uniqueness of GUID.
C. a b Previously Linux used the same GUID for the data partitions as Windows. Linux
never had a separate unique partition type GUID defined for its data partitions. This
created problems when dual-booting Linux and Windows in UEFI-GPT setup. The new GUID was
defined jointly by GPT fdisk and GNU Parted developers. It is identified as type code
0x8300 in GPT fdisk. D. a b The GUID for /usr on Solaris is used
as a generic GUID for ZFS by Mac OS X. E. a b NetBSD and MidnightBSD had used the
FreeBSD GUIDs before their unique GUIDs were created.
F. a b Some computer manufacturers have their own GUIDs for partitions that are analogous
to the EFI System Partition, but that hold boot loaders to launch manufacturer-specific
recovery tools. G. ^ The Ceph filesystem uses GUIDs to mark
the state of preparation a disk is in. See also
Notes
References
External links Microsoft TechNet: Disk Sectors on GPT Disks
Microsoft TechNet: Troubleshooting Disks and File Systems
Microsoft TechNet: Using GPT Drives Microsoft: FAQs on Using GPT disks in Windows
Apple Developer Connection: Secrets of the GPT
Make the most of large drives with GPT and Linux
GPT fdisk: Information on Hybrid GPT-MBR, Converting MBR and BSD disklabels to GPT and
Booting from GPT disks Convert Windows Vista SP1+ or 7 x86_64 boot
from BIOS-MBR mode to UEFI-GPT mode without Reinstall
Rod Smith - A BIOS to UEFI Transformation Support for GPT and HDD greater than 2.19
TB in Microsoft Windows XP Setting up a RAID volume in Linux with >2TB
disks