User Tools

Site Tools


GUID Partition Table

GUID Partition Table (GPT) is a HDD partitioning standard defined as a part of the EFI standard. It can be also used in BIOS based systems, instead of the typical MBR, though.

GPT has some other advantages over MBR:

  • can handle disks bigger than 2.20TB
  • can handle disks with sectors bigger than 512B
  • can handle virtually any number of partition entries in the single table. No need for 'extended partition' weirdness
  • no 'DOS compatibility' and 'CHS addressing' weirdness
  • used together with a 'protective MBR' or a 'hybrid MBR' – it can be used to boot BIOS systems too
  • (U)EFI systems can boot from it

The disadvantages are:

  • many tools still cannot handle it well ({c,s}fdisk from util-linux up to 2.22.1 does not support GPT)
  • not every boot loader can boot from GPT
  • some operating systems (notably all 32-bit Windows) cannot boot from GPT (workarounds are possible, though)
  • not always MBR partitioned disk can be converted to GPT easilly

Creating and manipulating GPT

New disks may come already partitioned with GPT. Other will come with MBR partition table or no partition table at all.

GPT can be created and edited with gdisk or parted. gdisk is a utility similar to fdisk, but made to manipulate GPT instead of MBR.

parted will create GPT if told to by the mklabel gpt command.

GPT partition types are identified by GUIDs instead of one-byte identifier used in MBR, so there is no limit on number of possible partition types and no central registry is needed. Though, using such long identifiers would be inconvenient, so gdisk uses 16-bit hexadecimal codes for known partition types.

Converting MBR to GPT

If gdisk is run on a MBR-partitioned HDD it will attempt to convert it to GPT automatically. This will only succeed if there is enough place to put the primary and secondary GPT records on the HDD – the sectors just after the MBR and sectors at the end of the disks must not be allocated to any partition.

The space for the primary GPT is usually not assigned to any partition because of partition alignment used (if 'DOS compatibility mode' was used, the first partition will start on sector 63, otherwise it may start at the sector 2048 (first megabyte)), but the end of the disk will usually be taken by the last partition. So, to convert an existing HDD to GPT one has to shrink the last partition first.

To resize a partition (DANGEROUS!): – resize file system or other data on that partition. If it is ext2/3/4 file system – use resize2fs, if it is an LVM pv – use pvresize. – note current partition position and size, as displayed by the 'print' command of fdisk or gdisk – delete the partition – re-create the partition with the same start position, but the size adjusted

Remember to set up boot partitions (see below)

Hybrid MBR for booting legacy OS

FIXME: to be written

Booting from GPT

Booting a (U)EFI system

Booting an (U)EFI system will be described in detail on the EFI page. The most important thing, as far as partitioning is concerned, is to create the EFI Boot Partition on the disk. It should be the first partition and be about 300MB in size. Examples

Booting a BIOS system

Most PC machines still use BIOS for booting. This is still possible with GPT, but there are some differences.

When MBR is in use, many boot loaders (e.g. GRUB) would store themselves on the sectors between the MBR and the first partition. This is not possible when GPT is in use, as the exact space is used by the GPT records. Instead a dedicated partition for the boot loader should be created. A special partition type has been defined – the BIOS Boot partition (UUID: 21686148-6449-6E6F-744E-656564454649, gdisk code: EF02). GRUB2 will use it if present.

GRUB legacy does not have any GPT support (unless patched for it) and won't normally boot from a GPT system, though it probably is possible to make it install and boot, using a hybrid mbr

Boot loaders stored in a file system (like SYSLINUX/extlinux) do not require a dedicated partition, but they still need GPT support to properly locate the file system.

SYSLINUX/extlinux, starting from version 4.00, see the /usr/share/doc/syslinux-4.05/gpt.txt.gz file in the package.

Booting legacy (32-bit Windows) systems from GPT

FIXME: to be written

guid_partition_table.txt · Last modified: 2014-05-30 20:46 by arekm