Why are the terms MBR and GPT associated with Legacy BIOS and UEFI respectively?
3 Answers
The older BIOS (Basic Input/Output System) and its modern replacement UEFI (Unified Extensible Firmware Interface) can both be seen as the "firmware" of your computer.
They are stored directly on the mainboard and are the first software that is run on your computer when it is powered on. Their main job is to initialize all connected hardware and load the actual operating system's (e.g. Ubuntu or Windows) boot loader (e.g. GRUB) from the hard disk, which then starts the OS.
Most UEFI systems also support CSM (Compatibility Support Module) booting, which emulates a Legacy BIOS interface.
While Legacy BIOS boot simply and stupidly reads and executes code from a fixed address off the disk (part of the Master Boot Record), UEFI boot searches for EFI boot files in an EFI system partition and executes one of those.
The older MBR (Master Boot Record) and newer GPT (GUID Partition Table; GUID = Global Unique Identifier) are partition table formats.
Your hard disk is partitioned in either of these two formats. The older MBR format allows only 4 primary partitions on the whole disk (although one of them may be used as extended partition and contain many logical volumes), whereas GPT doesn't have this restriction and also supports larger disks.
GPT partitioned disks may also contain a hybrid MBR with boot code able to load the EFI files in order to support both UEFI and Legacy BIOS boot modes.
So why are BIOS and MBR associated with each other, as well as UEFI with GPT?
Well, apart from BIOS/MBR being the ancestors of today's modern UEFI/GPT, they are also normally used together. Some operating systems (like Windows) even only support booting MBR disks in BIOS mode and GPT disks in UEFI mode. Linux systems with e.g. GRUB generally have no problems with mixing those either way.
Legacy (CSM) booting vs UEFI booting
SuperUser has a highly-upvoted post from 2012 on OP's question that many will find helpful.
CSM (Legacy) and UEFI (Universal Extensible Firmware Interface) are mutually exclusive boot options you choose within BIOS (Basic Input Output System). BIOS applies to much more than legacy (CSM) booting:
- Disk boot format: Legacy (CSM) vs. UEFI
- Disk boot order: hard disk, SSD, USB, NIC (Network Interface Card)
- Disk low level operations: RAID vs AHCI
- USB ports: wake up on input, powered when system off, etc.
- Multiple Graphic Cards: enable/disable Intel or nVidia
- System date and time stored on RTC (Real Time Clock)
- Optional hardware POST (Power On Self Test) checks
- Many other BIOS options that vary depending on computer
Great answers have already been posted by Byte and Ravery here, so I would just summarize:
- Legacy (CSM) and UEFI are different ways to boot from storage disks (which often take the form of SSD these days).
- CSM uses an MBR (Master Boot Record) in a specific format of 512 Bytes to boot the operating system.
- UEFI uses files within a large partition (typically 100 MB) to boot the operating system. Typically they still require the MBR to be present.
- MBR and GPT are different specifications for disk partition formatting. You can have UEFI boot on an MBR formatted disk. You can have MBR boot on a GPT formatted disk (in non-Windows environments).
- The MBR (first 512 bytes of a disk) is typically hidden from user view.
- The EFI partition can be easily viewed, as shown below
It is important to note ambiguities that MBR can refer to disk booting method or disk partition format.
It is also important to note that UEFI is often associated with GPT disk format but MBR booting can use GPT disk format.
Viewing the EFI partition
Using lsblk you can see EFI partition and files:
$ lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL
NAME FSTYPE LABEL MOUNTPOINT SIZE MODEL
sda 931.5G HGST HTS721010A9
├─sda4 ntfs WINRETOOLS 450M
├─sda2 128M
├─sda5 ntfs Image 11.4G
├─sda3 ntfs HGST_Win10 /mnt/d 919G
└─sda1 vfat ESP 500M
nvme0n1 477G Samsung SSD 960 PRO 512GB
├─nvme0n1p5 ext4 NVMe_Ubuntu_16.0 / 44.6G
├─nvme0n1p3 16M
├─nvme0n1p1 ntfs 450M
├─nvme0n1p6 swap Linux Swap [SWAP] 7.9G
├─nvme0n1p4 ntfs NVMe_Win10 /mnt/c 414.9G
├─nvme0n1p2 vfat /boot/efi 99M
└─nvme0n1p7 ntfs Shared_WSL+Linux /mnt/e 9G
There are many files in /boot/efi you can see using ls command. To see the size of all files within the 99MB partition use:
$ du -hs /boot/efi
35M /boot/efi