Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

The Short Answer

Use GPT for every new disk. It handles any disk size in use today, keeps a backup copy of itself, and works with UEFI and, with GRUB, with BIOS too. MBR is still found on older servers and small virtual disks, and it works there, but there is no reason to choose it for a new disk.

Side by Side

MBRGPT
Largest disk2 TiB8 ZiB
Partitions4 primary128 by default
Backup copyNoYes, at the end
ChecksumsNoCRC32
Partition IDsOne-byte typeGUIDs
BootBIOS or UEFIUEFI, or BIOS with GRUB
lsblk showsdosgpt

The size limits assume the usual 512-byte sectors.

Why MBR Stops at 2 TiB

MBR stores partition start and length as 32-bit sector numbers. 2 to the 32nd power sectors of 512 bytes are 2 TiB, about 2.2 TB. On a larger disk with an MBR table, the space beyond that point cannot be used. MBR also has room for only four entries; to get more partitions, one of them becomes an extended partition that holds logical partitions inside it.

What GPT Adds

  • 64-bit addresses: no practical size limit.
  • More partitions: the table has 128 entries by default, with no need for extended partitions.
  • A backup: a second header and table at the end of the disk, used when the first one is damaged.
  • Checksums: damage to the header or table is detected instead of read as valid.
  • A protective MBR: the first sector holds a placeholder MBR, so old tools see the disk as in use and do not overwrite it.

Booting: UEFI and BIOS

UEFI firmware reads GPT directly and starts the boot loader from an EFI System Partition, a small partition formatted with FAT. BIOS firmware only runs code in the first sector; to boot GRUB from a GPT disk under BIOS, the disk needs a small BIOS boot partition with no file system, where GRUB stores the rest of itself. Virtual servers can use either kind of firmware. To see which one your server started with:

[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

The firmware side is explained in UEFI vs BIOS.

Check Which One a Disk Uses

lsblk -o NAME,SIZE,PTTYPE

The PTTYPE column shows dos for MBR and gpt for GPT. Two other ways:

sudo parted -l
sudo fdisk -l /dev/sda

parted prints a line "Partition Table:" with msdos or gpt, and fdisk prints "Disklabel type:". More ways to inspect disks are in how to list disks in Linux.

Create a GPT Table on a New Disk

Warning: writing a new partition table makes every partition on that disk unreachable. Use it only on an empty disk, and confirm the device name with lsblk first.

sudo parted /dev/sdb mklabel gpt

Creating partitions on it is covered in how to partition a disk in Linux.

Converting an MBR Disk to GPT

Warning: converting the partition table of a disk that holds data can make it unreadable if something goes wrong. Take a full backup first, and on a virtual server a snapshot as well.

The sgdisk tool from the gdisk package can convert a table in place with --mbrtogpt. GPT needs a little room at the start and at the end of the disk for its tables, and the conversion fails most often because the last partition reaches the final sector, leaving no room for the backup GPT. On a boot disk the boot loader must change too: a BIOS boot partition or an EFI System Partition has to be added and GRUB installed again. For a boot disk the safer path is often to back up, repartition, and restore, and to test the result on a copy first.

Was this answer helpful?
Loading...