GUID Partition Table

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computer hardware, GPT stands for GUID Partition Table (GPT), and is a standard for the layout of the partition table on a physical hard disk. It forms a part of the Extensible Firmware Interface (EFI) standard, which is Intel's proposed replacement for the PC BIOS. It is also used on some BIOS systems because of the limitations of MBR partition tables. GPT allows for a maximum disk and partition size of 9.4 zettabytes (9.4 × 1021 bytes[1]) As of 2010, most current operating systems support GPT, although some operating systems (including Mac OS X and Windows) require systems with EFI hardware to support booting from GPT partitions.

The MBR partition table restricts partition sizes to a maximum of 2.19 terabytes (2.19 × 1012 bytes) or almost exactly 2 TiB (2,199,023,255,040 bytes or 4,294,967,295 (232−1) sectors × 512 (29) bytes per sector).[2]. GPT supports partition sizes up to 9.3 zettabytes or 8 ZiB−512 bytes (9,444,732,965,739,290,426,880 bytes or 18,446,744,073,709,551,615 (264−1) sectors × 512 (29) bytes per sector).

Diagram illustrating the layout of the GUID Partition Table scheme. In this example, each logical block (LBA) is 512 bytes in size, and each partition entry is 128 bytes. LBA addresses that are negative indicate position from the end of the volume, with −1 as the last addressable block.

Contents

[edit] History

The widespread MBR partitioning scheme, dating from the early 1980s, imposed limitations which affected the use of modern hardware. 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.[3]

[edit] Features

MBR-based partition table schemes insert the partitioning information in the master boot record (MBR) (which on a BIOS system is also the container for code that begins the process of booting the system). In a GPT, partition table information is stored in the GPT header, but to maintain compatibility, GPT retains the MBR entry as the first sector on the disk followed by a primary partition table header, the actual beginning of a GPT.

Like modern MBRs, GPTs use logical block addressing (LBA) in place of the historical cylinder-head-sector (CHS) addressing. Legacy MBR information is contained in LBA 0, the GPT header is in LBA 1, and the partition table itself follows. 64-bit Windows operating systems reserve 16,384 bytes (or 32 sectors at 512 bytes) for the GPT, leaving LBA 34 as the first usable sector on the disk.

Apple warns:[4] "Do not assume that the block size is always going to be 512 bytes." Modern storage devices such as solid-state drives may contain 1024-byte LBAs and some magneto-optical (MO) drives use 2048-byte sectors (but MO drives are typically not partitioned).

Hard disk manufacturers are transitioning to 4096-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 (hidden) 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.[5] Such a misalignment occurs by default if the first partition is placed immediately after the GUID partition table, as the next block is LBA 34. The next 4 KiB boundary begins with LBA 40.

Drives which boot Intel-based Macs must be formatted with a GUID Partition Table, rather than with the Apple Partition Map (APM).

GPT also provides redundancy, writing the GPT header and partition table both at the beginning and at the end of the disk.

Microsoft Windows implementations limit the number of possible partitions to 128.

[edit] Legacy MBR (LBA 0)

In the GPT specification, the location corresponding to the MBR in MBR-based disks is structured in a way that prevents MBR-based disk utilities from mis-recognizing, and possibly over-writing, GPT disks. This is referred to as a "protective MBR". In operating systems that support GPT-based boot, it is also used to store the first stage of the bootloader code. A single partition type of EEh, encompassing the entire GPT drive, is indicated and identifies it as GPT. Operating systems 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, Apple's advice is that GPT aware tools should 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 device should not be manipulated.[6]

If the disk exceeds 2 TiB—-the maximum partition size representable using the 32-bit LBAs of the legacy MBR (assuming a 512 byte block size)—-the size of this partition is marked as 2 TiB, ignoring the rest of disk.

Apple's Boot Camp Intel based Apple macs software creates a hybrid partition table to allow the booting of Windows (which at the time of Boot Camp's creation did not support GPT or EFI). 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.

[edit] Partition table header (LBA 1)

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. On 64-bit Windows Server 2003 machines, 128 partitions can be created. There are 128 partition entries reserved, each 128 bytes long. (The EFI specification requires that a minimum of 16,384 bytes be reserved for the partition table, so this gives space for 128 partition entries.)

The header contains the disk GUID (Globally Unique Identifier). It records its own size and location (always LBA 1) and the size and location of the secondary GPT header and table (always the last sectors on the disk). 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.

GPT header format
Offset Length Contents
0 8 bytes Signature ("EFI PART", 45h 46h 49h 20h 50h 41h 52h 54h)
8 4 bytes Revision (For GPT version 1.0 (through at least UEFI version 2.3.1), the value is 00h 00h 01h 00h)
12 4 bytes Header size in little endian (in bytes, usually 5Ch 00h 00h 00h meaning 92 bytes)
16 4 bytes CRC32 of header (0 to header size), with this field zeroed during calculation
20 4 bytes Reserved; must be zero
24 8 bytes Current LBA (location of this header copy)
32 8 bytes Backup LBA (location of the other header copy)
40 8 bytes First usable LBA for partitions (primary partition table last LBA + 1, usually 34)
48 8 bytes Last usable LBA (secondary partition table first LBA - 1, usually Disk-Size - 34)
56 16 bytes Disk GUID (also referred as UUID on UNIXes)
72 8 bytes Partition entries starting LBA (always 2 in primary copy)
80 4 bytes Number of partition entries
84 4 bytes Size of a partition entry (usually 128)
88 4 bytes CRC32 of partition array
92 * Reserved; must be zeroes for the rest of the block (420 bytes for a 512-byte LBA)
LBA size Total

The values for current and backup LBAs of the primary header should be the second sector of the disk (1) 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.

[edit] Partition entries (LBA 2–33)

The GPT uses simple and straightforward entries to describe partitions. The first 16 bytes designate the partition type GUID. 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. Starting and ending 64-bit LBAs are also recorded here, and space is allocated for partition names and attributes. As is the nature and purpose of GUIDs, no central registry is needed to ensure the uniqueness of the GUID partition type designators.

GUID partition entry format
Offset Length Contents
0 16 bytes Partition type GUID
16 16 bytes Unique partition GUID
32 8 bytes First LBA (little-endian)
40 8 bytes Last LBA (inclusive, usually odd)
48 8 bytes Attribute flags (e.g. bit 60 denotes read-only)
56 72 bytes Partition name (36 UTF-16LE code units)
128 Total

Apple warns: "Do not hardwire the current size of the partition entry (128 bytes)."[7] Microsoft TechNet says that attributes are divided into two halves: the lower 4 bytes representing partition independent attributes, and the upper 4 bytes are partition type dependent. Microsoft uses the following bits in general:[8]

Partition attributes
Bit Content
0 System partition (disk partitioning utilities must reserve the partition as is)
2 Legacy BIOS Bootable (equivalent to MBR 80h Active flag)[9]
60 Read-only
62 Hidden
63 Do not automount (i.e., do not assign drive letter)

[edit] OS support of GPT

Hybrid MBRs are non-standard and can be interpreted in different ways by different OSes.[10] 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[11], 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.

[edit] Unix-class operating systems

OS Version/
edition
Platform Boot from GPT on PC/BIOS Boot from GPT on EFI Note
FreeBSD Since 7.0 x86, x86-64 Yes Yes In a hybrid configuration, both GPT and MBR partition identifiers may be used.
Linux Most of the x86 Linux distributions

Fedora 8+ and Ubuntu 8.04+[12]

x86, x86-64 Yes Yes Some distribution tools, such as fdisk, don't work with GPT.

New tools such as gdisk,[13] GNU Parted,[14][15] Syslinux, grub .96+ patches and grub2 have been GPT-enabled.

Mac OS X Since 10.4.0 (some features since 10.4.6)[16] x86, x86-64 Unofficial support (Hackintosh) Yes
MidnightBSD Since 0.4-CURRENT x86, x86-64 Yes No In a hybrid configuration, both GPT and MBR partition identifiers may be used.
Solaris Since Solaris 10 x86, x86-64, SPARC No (work in progress) No (work in progress)

[edit] Windows 32-bit versions

Microsoft does not support EFI on 32-bit platforms, and by extension, does not allow booting from GPT partitions.

OS Version/
edition
Platform Boot from GPT on PC/BIOS Boot from GPT on EFI Note
Windows XP (2001-10-25) x86 No No No native support on this architecture and version.
Windows Server 2003 (2003-04-24) x86 No No No native support on this architecture and version.
Windows Server 2003 (2005-03-30) x86 No No Data Disk only [11] MBR takes precedence in hybrid configuration.
Windows Vista (2005-07-22) x86 No No MBR takes precedence in hybrid configuration.
Windows Server 2008 (2008-02-27) x86 No No MBR takes precedence in hybrid configuration.
Windows 7 (2009-10-22) x86 No No MBR takes precedence in hybrid configuration.[10]

[edit] Windows x64 64-bit versions

The following table lists only the 64-bit IA-32, also called x86-64, EM64T, or x64, Windows versions that support GPT. These are also since 2001 the "64-bit" editions for the IA-64 processor platform that come with EFI and support GPT boot since the first release, as GPT is the default partitioning type on that platform. The "x64" editions for the x86-64 processor platform initially only had limited GPT support until mainstream Windows variants reached parity with the IA-64 variants on the release of Windows Server 2008. Please note that below the so-called "Windows XP" version listed is in fact technically equivalent with the above-mentioned Windows Server 2003 version.

OS Version/
edition
Platform Boot from GPT on PC/BIOS Boot from GPT on EFI Note
Windows Server 2003 (2005-04-25)[17] x86-64 No No Data disk only[11] MBR takes precedence in hybrid MBR configuration.
Windows XP (2005-04-25)
x86-64 No No Data disk only[11] MBR takes precedence in hybrid configuration.

Detachable disks: only support for MBR partitioning.

Windows Vista (2006-07-22) x86-64 No No MBR takes precedence in hybrid configuration.
Windows Server 2008

Windows Vista SP1

(2008-02-27) x86-64 No Yes MBR takes precedence in hybrid configuration.
Windows 7 (2009-10-22) x86-64 No Yes MBR takes precedence in hybrid configuration.[10]
Windows Server 2008 R2 (2009-10-22)
x86-64 No Yes MBR takes precedence in hybrid configuration.

[edit] Partition type GUIDs

Assoc. OS Partition type Globally unique identifier (GUID)[1]
(None) Unused entry 00000000-0000-0000-0000-000000000000
MBR partition scheme 024DEE41-33E7-11D3-9D69-0008C781F39F
EFI System partition C12A7328-F81F-11D2-BA4B-00A0C93EC93B
BIOS Boot partition[2] 21686148-6449-6E6F-744E-656564454649
Windows Microsoft Reserved Partition E3C9E316-0B5C-4DB8-817D-F92DF00215AE
Basic data partition[3] EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
Logical Disk Manager metadata partition 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3
Logical Disk Manager data partition AF9B60A0-1431-4F62-BC68-3311714A69AD
Windows Recovery Environment DE94BBA4-06D1-4D40-A16A-BFD50179D6AC
IBM General Parallel File System (GPFS) partition 37AFFC90-EF7D-4E96-91C3-2D7AE055B174
HP-UX Data partition 75894C1E-3AEB-11D3-B7C1-7B03A0000000
Service Partition E2A1E728-32E3-11D6-A682-7B03A0000000
Linux Linux filesystem data[3] EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

0FC63DAF-8483-4772-8E79-3D69D8477DE4[citation needed]

RAID partition A19D880F-05FC-4D3B-A006-743F0F84911E
Swap partition 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
Logical Volume Manager (LVM) partition E6D6D379-F507-44C2-A23C-238F2A3DF928
Reserved 8DA63339-0007-60C0-C436-083AC8230908
FreeBSD Boot partition 83BD6B9D-7F41-11DC-BE0B-001560B84F0F
Data partition 516E7CB4-6ECF-11D6-8FF8-00022D09712B
Swap partition 516E7CB5-6ECF-11D6-8FF8-00022D09712B
Unix File System (UFS) partition 516E7CB6-6ECF-11D6-8FF8-00022D09712B
Vinum volume manager partition 516E7CB8-6ECF-11D6-8FF8-00022D09712B
ZFS partition 516E7CBA-6ECF-11D6-8FF8-00022D09712B
Mac OS X Hierarchical File System Plus (HFS+) partition 48465300-0000-11AA-AA11-00306543ECAC
Apple UFS 55465300-0000-11AA-AA11-00306543ECAC
ZFS[4] 6A898CC3-1DD2-11B2-99A6-080020736631
Apple RAID partition 52414944-0000-11AA-AA11-00306543ECAC
Apple RAID partition, offline 52414944-5F4F-11AA-AA11-00306543ECAC
Apple Boot partition 426F6F74-0000-11AA-AA11-00306543ECAC
Apple Label 4C616265-6C00-11AA-AA11-00306543ECAC
Apple TV Recovery partition 5265636F-7665-11AA-AA11-00306543ECAC
Apple Core Storage (i.e. Lion FileVault) partition 53746F72-6167-11AA-AA11-00306543ECAC
Solaris Boot partition 6A82CB45-1DD2-11B2-99A6-080020736631
Root partition 6A85CF4D-1DD2-11B2-99A6-080020736631
Swap partition 6A87C46F-1DD2-11B2-99A6-080020736631
Backup partition 6A8B642B-1DD2-11B2-99A6-080020736631
/usr partition[4] 6A898CC3-1DD2-11B2-99A6-080020736631
/var partition 6A8EF2E9-1DD2-11B2-99A6-080020736631
/home partition 6A90BA39-1DD2-11B2-99A6-080020736631
Alternate sector 6A9283A5-1DD2-11B2-99A6-080020736631
Reserved partition 6A945A3B-1DD2-11B2-99A6-080020736631
6A9630D1-1DD2-11B2-99A6-080020736631
6A980767-1DD2-11B2-99A6-080020736631
6A96237F-1DD2-11B2-99A6-080020736631
6A8D2AC7-1DD2-11B2-99A6-080020736631
NetBSD[5] Swap partition 49F48D32-B10E-11DC-B99B-0019D1879648
FFS partition 49F48D5A-B10E-11DC-B99B-0019D1879648
LFS partition 49F48D82-B10E-11DC-B99B-0019D1879648
RAID partition 49F48DAA-B10E-11DC-B99B-0019D1879648
Concatenated partition 2DB519C4-B10F-11DC-B99B-0019D1879648
Encrypted partition 2DB519EC-B10F-11DC-B99B-0019D1879648
ChromeOS[6] ChromeOS kernel FE3A2A5D-4F32-41A7-B725-ACCC3285A309
ChromeOS rootfs 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC
ChromeOS future use 2E0A753D-9E48-43B0-8337-B15192CB1B5E
MidnightBSD[7] Boot partition 85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7
Data partition 85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7
Swap partition 85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7
Unix File System (UFS) partition 0394Ef8B-237E-11E1-B4B3-E89A8F7FC3A7
Vinum volume manager partition 85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7
ZFS partition 85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7
  1. ^ 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.
  2. ^ The formation of this GUID does not follow the GUID definition, it is formed by using the ASCII codes. Such formation of "GUID" value breaks down the guaranteed uniqueness of GUID.
  3. 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. This new GUID was defined jointly by GPT fdisk and GNU Parted developers. It is identified as type code 8300 in GPT fdisk.[citation needed]
  4. a b The GUID for /usr on Solaris is used as a generic GUID for ZFS by Mac OS X.
  5. ^ Definitions are in src/sys/sys/disklabel_gpt.h. NetBSD had used the FreeBSD GUIDs before unique NetBSD-specific GUIDs were created.
  6. ^ Definitions are in http://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format.
  7. ^ Definitions are in [2]. MidnightBSD had used the FreeBSD GUIDs before unique GUIDs were created.

[edit] See also

[edit] References

  1. ^ Bill Boswell (2002-07-01). "FAQ: Drive Partition Limits". Redmondmag.com. http://redmondmag.com/Articles/2002/07/01/The-64Bit-Question.aspx. Retrieved 2010-06-09. "GPT disks also support very large partitions thanks to a 64-bit Logical Block Address scheme. A logical block corresponds to one sector, or 512 bytes, yielding a maximum theoretical capacity of eight zettabytes." 
  2. ^ "FAQ: Drive Partition Limits" (pdf). UEFI Forum. http://www.uefi.org/learning_center/UEFI_MBR_Limits_v2.pdf. Retrieved 2010-06-09. 
  3. ^ Nikkel, Bruce J. (September 2009). "Forensic analysis of GPT disks and GUID partition tables". Digital Investigation 6 (1-2): 39–47. "The current popular BIOS and MBR partitioning scheme was originally developed in the early 1980s for the IBM Personal Computer using IBM PC-DOS or MS-DOS. The Basic Input/Output System (BIOS) provides an interface to the hardware and initiates the boot process (IBM, 1983). The MBR, located in sector zero, contains the initial boot code and a four entry partition table (Microsoft, 1983). Intended to solve booting and partitioning limitations with newer hardware, a replacement for both the BIOS and the MBR partition table was developed by Intel in the late 1990s (Intel, 2000). This is now called the Unified EFI (UEFI, 2008 UEFI Forum. Unified extensible firmware interface specification version 2.2 2008.UEFI, 2008) specification, and managed by the UEFI Forum (UEFI, 2009). A subset of this specification includes GUID (globally unique identification) Partition Tables, or GPT, intended to replace the DOS/MBR partition tables." 
  4. ^ "Technical Note TN2166: Secrets of the GPT". Apple. http://developer.apple.com/technotes/tn2006/tn2166.html. 
  5. ^ "Western Digital’s Advanced Format: The 4K Sector Transition Begins". Anandtech. http://anandtech.com/storage/showdoc.aspx?i=3691. 
  6. ^ http://developer.apple.com/library/mac/technotes/tn2166/
  7. ^ http://developer.apple.com/mac/library/technotes/tn2006/tn2166.html#SECGPTOVERVIEW
  8. ^ http://technet.microsoft.com/en-us/library/cc739412%28WS.10%29.aspx#w2k3tr_basic_how_fgkm
  9. ^ "e09127r3 EDD-4 Hybrid MBR boot code annex". http://t13.org./documents/UploadedDocuments/docs2010/e09127r3-EDD-4_Hybrid_MBR_boot_code_annex.pdf. 
  10. ^ a b c Smith, Rod. "Hybrid MBRs: The Good, the Bad, and the So Ugly You'll Tear Your Eyes Out". http://www.rodsbooks.com/gdisk/hybrid.html. 
  11. ^ a b c d "Windows and GPT FAQ". Microsoft. http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx#ELD. 
  12. ^ "Ubuntu on MacBook". Ubuntu Community Documentation. https://help.ubuntu.com/community/MacBook. 
  13. ^ Smith, Rod. "GPT fdisk for Linux". http://www.rodsbooks.com/gdisk. 
  14. ^ "GNU Parted FAQ". https://www.gnu.org/software/parted/faq.shtml#features. 
  15. ^ "mklabel - GNU Parted Manual". https://www.gnu.org/software/parted/manual/html_node/mklabel.html. 
  16. ^ "Myths and Facts About Intel Macs". rEFIt. http://refit.sourceforge.net/myths/. 
  17. ^ Microsoft Raises the Speed Limit with the Availability of 64-Bit Editions of Windows Server 2003 and Windows XP Professional [1]

[edit] External links

Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages