Sign in
← Linux: booting
12 min · easy · Lesson 2 of 7

Firmware and disk: BIOS/UEFI, MBR/GPT

POST, BIOS vs UEFI, and MBR and GPT disk layouts.

Why this matters

A server won't boot, and the screen shows No bootable device. Or you're installing a system on a new disk and the installer asks which partition table to create. In both cases you need to understand two things: which firmware the machine runs and how the disk is partitioned. This pair decides where the bootloader lives and who finds it.

Where power-on starts

The moment power reaches the board, firmware takes over: code burned into a chip on the motherboard. First it runs POST (power-on self-test), a hardware self-check: memory, CPU, basic controllers. If something critical is broken, boot stops right there, and you hear a series of beeps or see an error code.

After a successful POST, firmware looks for where to boot from and hands control to the bootloader. From there the chain looks like this:

firmware -> bootloader -> kernel -> initramfs

initramfs is a temporary filesystem root unpacked into memory (into rootfs; if the kernel has CONFIG_TMPFS enabled, that's tmpfs, otherwise ramfs). It carries the drivers needed to mount the real root from disk.

BIOS vs UEFI

Firmware comes in two generations. The old mode is BIOS (basic input/output system). It doesn't understand filesystems: it just reads the boot code from the disk's first sector and runs it. You can look at that sector yourself (needs root):

sudo dd if=/dev/sda bs=512 count=1 2>/dev/null | od -A d -t x1 | tail -n 4

The new mode is UEFI (unified extensible firmware interface). It can read a filesystem on a dedicated partition called the EFI System Partition (ESP, usually FAT32). Bootloaders sit there as plain .efi files. On Ubuntu the ESP is mounted at /boot/efi, example contents:

ls /boot/efi/EFI/
BOOT  ubuntu

UEFI has one more trick. You can build the Linux kernel with an EFI stub: then the kernel file looks to firmware like a regular EFI application, and UEFI runs it directly, with no separate bootloader.

UEFI keeps its boot entries itself, in firmware memory. efibootmgr shows them (example line):

efibootmgr -v
Boot0001* Linux	HD(1,GPT,...)/File(\EFI\Linux\vmlinuz.efi)

MBR: the old layout

How a disk is partitioned is tied to the firmware mode. The classic one is MBR (master boot record). It's the disk's very first sector (sector 0), 512 bytes:

BytesWhat's there
0-445primary bootloader code (446 bytes)
446-509partition table: 4 entries of 16 bytes
510-511signature 55 aa

Without the 55 aa signature, neither BIOS nor the Linux kernel treats the sector as an MBR table. In each table entry the fifth byte (offset 4 within the entry) is the partition type. A few common types:

TypeWhat it means
83Linux partition
82Linux swap
efEFI System Partition
eeprotective MBR in front of GPT (see below)
00empty entry

MBR has hard limits. The sector number is stored in 32 bits, so with a 512-byte sector it can address no more than 2 TiB (about 2.2 TB). There are four entries in the table, so there can't be more than four primary partitions. You can work around this with an extended partition holding logical partitions inside it.

The fdisk utility from util-linux calls MBR dos:

sudo fdisk -l /dev/sda
Disklabel type: dos

GPT: the modern layout

GPT (GUID partition table) removes MBR's limits. Sector numbers are 64-bit, so the 2 TiB ceiling disappears. By default there's room in the table for 128 partitions, and extended partitions are no longer needed.

A GPT disk is laid out like this:

The header and entries are protected by CRC32 checksums. If the primary table at the start gets corrupted, tools find the copy at the end and offer to restore the primary one. That's what the Linux kernel, fdisk, and gdisk all do.

gdisk -l prints what it found on the disk before listing partitions:

sudo gdisk -l /dev/sda
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

MBR: protective means there's a protective MBR in sector 0, and GPT: present means a GPT table was found.

In practice, disks under UEFI are laid out as GPT: that's where the ESP lives, and firmware reads the bootloader or kernel from it. There's no hard rule: an ESP can also sit on an MBR disk (type ef), and such systems do exist. It buys you nothing, though, and some UEFI implementations won't boot from MBR, so "UEFI plus GPT" is considered the normal pairing. The reverse combination also happens: GRUB boots a system from a GPT disk on a BIOS machine, if the disk has a small BIOS boot partition where GRUB puts its main code.

The difference in short:

PropertyMBRGPT
Where the table livessector 0sector 1 onward, copy at the end of the disk
Disk size limit2 TiB with a 512-byte sectorpractically none
Partitions4 primary128 by default
Usual pairingBIOSUEFI (with an ESP)

What the system does next

Once the kernel has unpacked initramfs and mounted the real root, the first process takes over. On most distributions that's systemd, the system manager that starts the remaining services from unit files. It brings up independent services in parallel.

systemctl get-default
graphical.target

The boot goal is described through targets, which depend on each other:

graphical.target -> multi-user.target -> basic.target -> sysinit.target

The arrows show dependency, not a strict step-by-step order. Targets are covered in detail in the systemd lesson.

Common mistakes

What to remember

POST is the hardware self-check at power-on, before any bootloader.

BIOS reads raw code from sector 0, UEFI reads files from the EFI System Partition and can boot the kernel directly through an EFI stub.

MBR is sector 0: 446 bytes of code, 4 table entries, signature 55 aa. Up to 2 TiB and 4 primary partitions.

GPT is a protective MBR with type ee, an EFI PART header in sector 1, and its copy in the last sector. In practice GPT is used under UEFI, though an ESP can also sit on an MBR disk.

In the next lesson we'll look at how the bootloader passes parameters to the kernel and what ends up on the kernel command line.

What you'll need for the tasks

Done reading?

Mark the lesson as read to move your track progress forward.

Go through it with an AI agent

The agent explains anything unclear in plain words, gives you 1 lab for this lesson and drills you on interview questions. $49 one-time, lifetime access.

Get access for $49

Tell the agent: use MCP izi, give me lesson linux-boot-02-firmware-disk