UEFI-GPT Partitioning
When I was a teenager testing my system and installing new OSs I quickly learned how to partition drives using the classic MBR scheme. As such, it took a bit of research and trial & error to learn the new UEFI with GPT scheme. In this post I focus on partitioning with UEFI-GPT, and do not delve into other aspects of UEFI. This post is here to hopefully help those who got stuck as I did.
Classic MBR Partitioning
Classically, hard drives would follow what is known as an MBR partitioning scheme, a Master Boot Record (MBR) stored in the first 512 Bytes of the storage device containing the boot loader (the first 440 Bytes) and the partitioning table.
Under a BIOS system, when booting, the BIOS will load the MBR into memory and the bootloader will run. This is done because the BIOS can’t understand the filesystems, thus the bootloader will be responsible for loading the operating system(s) which reside on the disk partitions.
The Primary partition was the traditional type of partition, and the MBR supported a maximum 4 of them. To counter this limitation, Extended partition were introduced, allowing for 3 Primary and 1 Extended partition. Extended partitions hold a potentially unlimited number of Logical partitions (according to the standard) allowing us to bypass the limitation of 4 partitions per disk.
As an example my Dual-Boot configuration, with Windows and Linux alongside, would be the following:
Partition Nbr | Type | Contents |
---|---|---|
1 | Primary | Windows Reserved |
2 | Primary | Windows |
3 | Extended | |
4 | Logical | Linux Boot Partition |
5 | Logical | Linux Swap Partition |
6 | Logical | Linux Root Partition |
UEFI
UEFI is a new system which replaces the BIOS and it’s boot process. When the computer turns on, after the POST, instead of having the BIOS initialize hardware, the UEFI firmware is loaded and takes over this initialization.
So what’s different? In the next stage the firmware itself will read the boot entries in its boot manager, which is located on a partition, since it is able to read the file system.
UEFI typically (under Windows it is actually obliged to) uses a new partitioning scheme: GUID Partition Table (GPT). Noticeable advantages of this scheme are
- Support for disks larger than 2 TB (a maximum of 2 ZB)
- Uses a unique GUID for the disk and Partition GUID for the partitions (all of which are filesystem independent)
- Contains space for 128 partitions with the possibility of extending the space for more
With the noticeable advantages it provides, one must bare in mind that it is new and works differently than MBR. The way you partition your drives now changes slightly.
UEFI Partitioning
UEFI-GPT requires that your first partition is a FAT 32 formatted partition referred to as the EFI System Partition (ESP). The UEFI firmware will launch the UEFI bootloader and application from the ESP. This special partition can hold multiple bootloader’s and applications, and is shared for each system on the drive (if for example you are dual booting Windows and Linux).
If partitioning with fdisk or gdisk ensure this partition is of type EFI System or EF00
The rest of the partitions are up to you and your requirements.
For example, my partitioning for a UEFI-GPT Linux system is the following:
Device | Size | Type |
---|---|---|
/dev/sda1 | 512M | EFI System Partition |
/dev/sda2 | 2G | Linux Swap Partition |
/dev/sda3 | 17.5G | Linux Root Partition |
Concerning Bootloaders, I personally use Systemd-boot as it is part of systemd (already installed on my distribution) and I find it is easier than GRUB for UEFI-GPT. As such the ESP is mounted to /boot and contains the kernel and initramfs files. Systemd-boot auto-detects the Windows Loader and adds an option for it, although the Linux systems need manual entries, but this is simple to do (refer to my arch install post).
Leave a Comment