GUID Partition Table

From Thomas-Krenn-Wiki
Jump to: navigation, search

The GUID Partition Table (GPT) was developed on the basis of the Unified Extensible Firmware Interface (UEFI) specification and often appears in combination with this BIOS successor. GPT negates several limitations of the Master Boot Record (MBR) system, including the limitation on the maximum size of a partition at 2.2 terabytes (TB).

GPT Advantages

The following advantages result from GPT.[1]

  • GPT uses 64-bit values for addressing purposes (Logical Block Addresses or LBA), which can address up to 9.4 zettabytes (ZB).[2]
  • Support for multiple partitions, 128 partitions in most configurations. The number of primary partitions is limited to four for MBR partitions.
  • Provision of a primary and secondary (or backup) GPT header tables.[3] The safety of the partition metadata is increased by this mechanism as well as the CRC checksums discussed below For example, the secondary header table can still be accessed, if the GPT header at the beginning of the device has been deleted by accident.
  • Use of a protective MBR at LBA Sector 0 for assuring backwards compatibility for utilities that do not understand the GPT system. This protective MBR has the partition type value "0xee" and induces fdisk to refer to GNU Parted partition editor, as follows.
:~$ sudo fdisk -l /dev/sdc
WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1   156301487    78150743+  ee  GPT
  • Use of CRC32 checksums for ensuring the integrity of the GPT header. For example, damage to the GPT header caused by a bad sector at the beginning of the device can be detected using the checksums.
  • Use of GUIDs for uniquely identifying partitions and Type GUIDs for designating the purpose of the partition (instead of relying on single-byte codes as the MBR system does). The following example is the output from the gdisk program for an EFI system partition.[4]
Partition number (1-4): 1
Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
Partition unique GUID: A81C2DB8-E808-4853-A67B-3982C65C23C2
First sector: 34 (at 17.0 KiB)
Last sector: 293002 (at 143.1 MiB)
Partition size: 292969 sectors (143.1 MiB)
Attribute flags: 0000000000000000
Partition name: ''
  • Each partition can also be given a descriptive name consisting of 36 characters.

GPT Disadvantages

GPT’s disadvantages or problems are predominantly related to the issue of compatibility. Older operating systems, such as Windows XP 32-bit, may not be able to work with GPT. In addition, setting up a dual-boot system with Windows using UEFI and a Linux operating system that should start in BIOS mode can get tricky.

GPT Partition Scheme

An Example of the GPT Partition Scheme. Source: UEFI Specification 2.3, S. 100 (uefi.org)

As already noted, the first logical block (LBA 0) contains a protective MBR, to ensure compatibility with utilities that do not understand the GPT format. The first copy of the GPT header will be found at the beginning of the second logical block (LBA 1). The secondary copy will be found in the last logical block (see the figure on the right).

GPT Header

The GPT header defines those blocks that can be used by partition entries. An entry always receives the first usable LBA and the last usable LBA, where the data for the associated partition must be stored. A Disk GUID, which can be used for uniquely identifying the device, will be provided for identifying the header and its entries.

Disk /dev/sdc: 156301488 sectors, 74.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F8FAC3BE-EB16-49DD-A4B4-E3C1472E2D9B
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 156301454
Partitions will be aligned on 1-sector boundaries
Total free space is 16 sectors (8.0 KiB)

The entries describing the individual partitions follow the header information (the purple section in the figure on the figure). The so-called Partition Entry Array (whose starting position is indicated in the header by the PartitionEntryLBA entry) is an array whose records point to the beginning and ending LBAs for the partition. A CRC32 checksum is also located in the GPT header to ensure the integrity of this array.

In addition to the LBAs, a partition entry will also contain a Unique Partition GUID, which uniquely identifies the partition. The purpose of the partition will be determined by the Partition Type GUID, which is the same as the operating system type fields in the MBR:[5]. The following example uses the GUID for a Linux software RAID partition

[...]
Partition GUID code: A19D880F-05FC-4D3B-A006-743F0F84911E (Linux RAID)
Partition unique GUID: A50EFBF2-BA83-425D-94E0-378523EBE091
[...]

Several GUIDs have already been assigned as part of the specification:

  • Unused entry: 00000000-0000-0000-0000-000000000000
  • EFI System Partition (ESP): C12A7328-F81F-11D2-BA4B-00A0C93EC93B
  • Legacy MBR Partition: 024DEE41-33E7-11D3-9D69-0008C781F39F

In summary, the most important parts of the GPT header and the partition entries are:[1]

  • Header
    • A signature and a revision number, which specify the data format of the partition header
    • The size of the header as well as the CRC32 checksum for the GPT header structure
    • The Disk GUID uniquely identifies the disk
    • The starting LBA for the GUID Partition Entry Array
    • CRC32 checksum for the Partition Entry Array
    • The Partition Entry Array describing the individual partitions
  • Entry
    • The Partition Type GUID uniquely identifies and describes the purpose of the partition
    • The Unique Partition GUID uniquely identifies each partition entry
    • The beginning and ending LBAs
    • A descriptive partition name

Operating System Support

Linux

There are no barriers to using GPT with UEFI, since the GPT specification was developed as part of the UEFI specification. When using a traditional BIOS with GPT, the following issues should be taken into consideration under Linux.

  • Booting using GRUB 2 with BIOS and GPT will require a BIOS boot partition, where the components important for GRUB can be found.[6][7]

Above all, the current version of GRUB 2 will support booting with UEFI and GPT.[8] Fedora has also developed a patched version of Grub Legacy that will provide this feature. From Fedora 16, the installer will also automatically create the partition in GPT for BIOS systems.[9]

Windows

Windows support for GPT is as follows:[10]

  • Windows XP x64 can only use GPT data media as a data partition.
    • The 32-bit version will only use Protective MBR for partitions that cannot be accessed, because they can not be mounted. Applications can access data.
  • As of Windows Server 2003 Service Pack 1, all versions of Windows Server can use GPT partitions as data media. A 64-bit Itanium system will be required to boot from a GPT data medium.
  • Windows 7, Windows Vista and Windows Server 2008 can use GPT partitions as data media. A 64-bit system with UEFI will be required for booting.

References

  1. 1.0 1.1 UEFI Specification 2.3.1 (uefi.org)
  2. AMI - An Introduction to UEFI (embedded.communities.intel.com)
  3. Windows and GPT FAQ (msdn.microsoft.com)
  4. gsdisk for Ubuntu Users (ubuntuusers.de)
  5. Partition Type Entries (win.tue.nl)
  6. GRUB Basics for Ubuntu Users (wiki.ubuntuusers.de)
  7. Official Grub Manual (gnu.org)
  8. Booting from GPT (rodsbooks.com)
  9. Fedora 16 Release Notes (docs.fedoraproject.org)
  10. Windows and GPT FAQ - Windows Disk Support (msdn.microsoft.com)

Related articles

Introduction to the Unified Extensible Firmware Interface
Restoring UEFI Boot Entry after Ubuntu Update
Restoring UEFI boot entry via motherboard replacement or BIOS update