Hubbry Logo
search
logo

BIOS boot partition

logo
Community Hub0 Subscribers
Read side by side
from Wikipedia

The BIOS boot partition is a partition on a data storage device that GNU GRUB uses on legacy BIOS-based personal computers in order to boot an operating system, when the actual boot device contains a GUID Partition Table (GPT). Such a layout is sometimes referred to as BIOS/GPT boot.[1]

A BIOS boot partition is needed on GPT-partitioned storage devices to hold the second stages of GRUB. On traditional MBR-partitioned devices, the disk sectors immediately following the first are usually unused, as the partitioning scheme does not designate them for any special purpose and partitioning tools avoid them for alignment purposes. On GPT-based devices, the sectors hold the actual partition table, necessitating the use of an extra partition. On MBR-partitioned disks, boot loaders are usually implemented so the portion of their code stored within the MBR, which cannot hold more than 512 bytes, operates as a first stage that serves primarily to load a more sophisticated second stage, which is, for example, capable of reading and loading an operating system kernel from a file system.

Overview

[edit]
In the example 2 above, GRUB 2 stores its core.img in a BIOS boot partition.

When used, the BIOS boot partition contains the second stage of the boot loader program, such as the GRUB 2; the first stage is the code that is contained within the Master Boot Record (MBR). Use of this partition is not the only way BIOS-based boot can be performed while using GPT-partitioned hard drives; however, complex boot loaders such as GRUB 2 cannot fit entirely within the confines of the MBR's 398 to 446 bytes of space, thus they need an ancillary storage space. On MBR disks, such boot loaders typically use the sectors immediately following the MBR for this storage; that space is usually known as the "MBR gap". No equivalent unused space exists on GPT disks, and the BIOS boot partition is a way to officially allocate such space for use by the boot loader.

The globally unique identifier (GUID) for the BIOS boot partition in the GPT scheme is 21686148-6449-6E6F-744E-65656445464916[2] [3] (which, when written to a GPT in the required little endian fields, forms the ASCII string "Hah!IdontNeedEFI"). In the context of GPT on a BIOS-based computer, a BIOS boot partition is similar in some respects to the EFI system partition, which is used by systems based on EFI. The EFI System partition holds a filesystem and files used by the UEFI, while the BIOS boot partition is used in BIOS-based systems and accessed without a filesystem by holding raw binary code.

The size requirements for a BIOS boot partition are quite low so it can be as small as about 30 KiB; however, as future boot loaders might require more space, 1 MiB might be a reasonable BIOS boot partition size. Due to the 1 MiB partition alignment policies used by most modern disk partitioning tools to provide optimum performance with Advanced Format disks, SSD devices and certain RAID configurations, some room is left allowing the placement of a BIOS boot partition between the GPT and the first partition aligned that way (34–2047 for 512-byte sectors; 6–255 for 4096-byte sectors). If created by utilizing that free space, the BIOS boot partition would be out of the GPT alignment specification,[4] but that is not very important since: (a) the alignment rule is "should" and not "must" (b) the rule is based on a performance consideration, which for a very small partition used only at system boot bears no real consequence.

Creation

[edit]

The following utilities are known to support BIOS boot partitions:

See also

[edit]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
The BIOS boot partition is a small, unformatted partition required on disks using the GUID Partition Table (GPT) in legacy BIOS-based systems to store the core image of the GRUB bootloader, enabling booting without the space constraints of the Master Boot Record (MBR).[1] This partition is specifically designed for embedding GRUB's second-stage components directly into raw disk space, preventing them from being overwritten or relocated by filesystem operations or other software.[1] Introduced to address the limitations of GPT partitioning on BIOS hardware—where the traditional post-MBR gap for boot code is absent—the BIOS boot partition ensures compatibility for GRUB installations on modern disk layouts exceeding 2 terabytes, which MBR cannot support.[1] It is not needed for UEFI systems, which use the EFI System Partition instead, nor for BIOS systems with MBR partitioning or alternative bootloaders like Limine that may have different requirements.[1] During GRUB installation via the grub-install command, the tool automatically detects and overwrites a portion of this partition with the bootloader code, provided it is marked with the appropriate type.[1] The partition must be created before installing GRUB and should contain no other data to avoid loss during embedding.[1] Its recommended size is 1 MiB, though the absolute minimum is 31 KiB to accommodate the core image and allow for future expansions; it remains unformatted with no filesystem and is never mounted.[1] Identification uses the GPT partition type GUID 21686148-6449-6E6F-744E-656564454649 (or hexadecimal code EF02 in tools like gdisk), which signals to GRUB and partitioning utilities its dedicated purpose.[1] Tools such as GNU Parted can set the bios_grub flag during creation, ensuring seamless integration in BIOS/GPT configurations.[1]

Background and Purpose

Definition and Role

The BIOS boot partition is a small, unformatted partition on disks employing the GUID Partition Table (GPT) partitioning scheme, specifically designated to store the second-stage bootloader—typically the core image of the GRUB bootloader—in legacy BIOS boot environments.[1] This partition plays a crucial role in enabling the booting of operating systems from GPT-formatted disks on systems using legacy BIOS firmware, which does not natively support GPT and thus requires a dedicated space for bootloader code that exceeds the constraints of the GPT protective Master Boot Record (MBR).[1] In contrast to the MBR partitioning scheme, where the bootloader can be embedded in the post-MBR gap preceding the first partition, GPT lacks such an unallocated area, necessitating this separate partition to accommodate the bootloader without risking overwrites or relocation by filesystem tools.[1] The GPT scheme itself represents a modern evolution in disk partitioning, supporting drives larger than 2 terabytes—addressing MBR's 2.2 terabyte limit—and allowing up to 128 primary partitions with enhanced data integrity through cyclic redundancy checks (CRC) and a backup partition table header.[2][3] Despite these advantages, legacy BIOS systems cannot directly access GPT structures for booting, making the BIOS boot partition essential to bridge this compatibility gap.[1] As raw storage without a mountable filesystem, the BIOS boot partition ensures the bootloader remains isolated from routine disk operations, such as defragmentation or resizing, thereby maintaining boot reliability; GRUB embeds its core image directly into this space during installation.[1]

Historical Development

The BIOS boot partition emerged in the mid-2000s during the development of GNU GRUB 2, a major rewrite of the original GRUB bootloader initiated around 2005 to enhance support for modern disk partitioning schemes, including the GUID Partition Table (GPT). This feature addressed the challenges of booting from GPT-formatted disks on legacy BIOS systems, where traditional Master Boot Record (MBR) boot sectors were absent, preventing direct compatibility with GRUB's multi-stage loading process.[1] A key milestone occurred with the release of GRUB 2.00 in June 2012, which stabilized GPT support for BIOS environments and aligned with the increasing use of GPT in Linux distributions to handle disks exceeding 2 TB in capacity, a limitation of the MBR scheme.[4] Prior beta versions, such as GRUB 1.97 in 2009, had already incorporated early GPT booting capabilities, enabling experimental use in distributions like Ubuntu 9.10.[5] The primary motivations for creating the BIOS boot partition stemmed from GPT's structural differences: unlike MBR, GPT reserves the initial sectors (typically 1-33) for protective headers and partition tables, leaving no post-MBR gap for embedding GRUB's core image without risking overwrites by filesystems or alignment tools.[1] This solution was particularly vital during the transition to UEFI firmware in the late 2000s, as it facilitated hybrid setups allowing legacy BIOS compatibility with GPT disks, avoiding the need to revert to MBR for older hardware.[1] Adoption accelerated in the 2010s as partitioning tools gained dedicated support; GNU Parted, which added GPT handling in version 1.8 (2006), and gdisk (part of the GPT fdisk suite, released in 2009), introduced flags and types like EF02 for BIOS boot partitions. By 2012, major Linux installers, including those for Ubuntu and Fedora, routinely prompted for or created BIOS boot partitions in BIOS-GPT configurations, solidifying its role as a standard for large-disk setups.[6] This timeline reflected broader GPT proliferation, driven by affordable multi-terabyte drives and the push for robust, scalable partitioning beyond MBR's constraints. This trend continued, with Fedora adopting GPT as the default partitioning scheme even for BIOS systems starting with Fedora 37 in 2022.[6]

Technical Specifications

Partition GUID and Structure

The BIOS boot partition is identified in GPT disk layouts by the unique partition type GUID 21686148-6449-6E6F-744E-656564454649, which corresponds to the hexadecimal code EF02 used by partitioning tools such as gdisk.[1][7] This GUID designates the partition specifically for storing GRUB's second-stage boot loader on BIOS-based systems with GPT partitioning, distinguishing it from other partition types like the EFI System Partition.[8] In terms of structure, the BIOS boot partition contains no filesystem, such as ext2 or FAT, and is formatted as raw disk space to directly hold embedded boot code without the overhead or risks associated with filesystem management.[1] The partition must be located within the first 2 TiB of the disk to ensure accessibility by legacy BIOS firmware.[8] It typically occupies unallocated sectors immediately after the GPT header, starting from sector 34 (the first usable sector post-header) and extending to around sector 2047, ensuring compatibility with the protective MBR at the disk's beginning and leaving room for the first aligned data partition.[9] GRUB embeds its core image (core.img) directly into this raw space during installation, overwriting the partition contents as needed for boot sector functionality.[1] To maintain integrity, the partition must remain unmounted and excluded from any filesystem operations, scans, or mounts to prevent accidental corruption of the embedded GRUB code.[1] Partitioning tools like GNU Parted apply the "bios_grub" flag to mark it appropriately, signaling its dedicated role without altering its raw nature.[10] For optimal performance on modern drives, including those with Advanced Format sectors, the partition is recommended to align on 1 MiB boundaries, avoiding overlap with GPT protective elements and ensuring efficient access patterns.[7]

Size and Contents

The BIOS boot partition has a minimum size requirement of 31 KiB to accommodate the basic GRUB core image on GPT-partitioned disks.[1] This minimal allocation ensures sufficient space for the essential bootloader components without a filesystem, as the partition is unformatted and dedicated solely to GRUB's embedding needs.[1] However, a recommended size of 1 MiB is advised to allow for growth in GRUB modules and future updates, providing ample room while minimizing waste on smaller storage devices.[1] The actual size required depends on the specific GRUB configuration, but it rarely exceeds 32 MiB even in complex setups with additional embedded drivers.[11] The primary content of the BIOS boot partition is the core.img file, which serves as GRUB's core image and embeds critical booting functionality.[11] This image is dynamically generated using grub-mkimage and combines the GRUB kernel—providing basic runtime facilities such as device and file handling, environment variables, and rescue mode—with a selection of modules necessary for accessing the /boot/grub directory.[11] It incorporates stage 1.5-like capabilities from GRUB Legacy, including code for loading additional modules at runtime via the insmod command and pointers to the /boot filesystem for locating configuration files and kernels.[11] Embedded filesystem drivers within core.img enable support for advanced disk layouts, such as LVM or RAID, allowing GRUB to read from the root partition without relying on an external filesystem in the boot partition itself.[11] Larger partition sizes permit the inclusion of extra GRUB components, such as trusted boot modules for digital signature verification, enhancing security in environments requiring enforced boot integrity.[12] Nonetheless, excessive sizing beyond 2 MiB is generally unnecessary and can inefficiently consume space, particularly on compact disks where every sector counts.[1] After installation, the partition's contents can be verified using tools like dd to extract the raw data and hexdump to inspect it for the presence of the GRUB binary, confirming the core.img embedding without mounting or formatting.[13] This method reveals identifiable strings, such as "GRUB," in the binary data, validating the bootloader's placement.[13]

Creation and Management

Partitioning Tools and Methods

Creating a BIOS boot partition requires partitioning tools that support GPT disk labels, as the partition is specifically designed for GPT-based setups in BIOS mode. Common command-line tools include gdisk, fdisk (with GPT support), and parted, each offering ways to allocate space, set the appropriate partition type, and apply necessary flags without formatting the partition. These tools ensure the partition is unformatted and usually created as the first partition, aligned to 1 MiB boundaries (starting at sector 2048), with a recommended size of 1 MiB to accommodate GRUB's second-stage code.[14][15] With gdisk, a GPT-specific utility, users start by launching it on the target disk (e.g., gdisk /dev/sda), then use the n command to create a new partition, accepting the default first sector, and specifying the last sector as +1M; afterward, the t command sets the type to EF02 (BIOS boot partition). Verification is done via the p command to print the partition table and confirm the type.[15][16] The fdisk tool allows creation of a GPT label by running fdisk /dev/sda, then using g inside the prompt, followed by n for a new partition of 1 MiB (default first sector, last sector +1M), and t with type EF02 to designate it as BIOS boot; the p command prints details for confirmation.[17][18] For parted, users select the disk (e.g., parted /dev/sda), create the partition with mkpart primary 1MiB 2MiB (unformatted, no filesystem), and set the bios_grub flag using set 1 bios_grub on; the print command verifies the flag and structure. This flag signals GRUB that the partition holds boot code.[10][19] In Linux distribution installers, the process is often automated when GPT partitioning and BIOS boot mode are selected. For Ubuntu's Ubiquity installer, it detects the GPT setup in legacy BIOS mode and creates the unformatted BIOS boot partition (typically 1 MiB) before the /boot partition during guided or manual partitioning. Similarly, Fedora's Anaconda installer automatically provisions a BIOS boot partition of about 1 MiB when installing on a GPT disk in BIOS mode, ensuring compatibility without user intervention in standard setups.[20][21][22] Best practices include backing up all data on the disk prior to partitioning to prevent loss, as operations are destructive; always verify the partition table after creation using the respective tool's print function to confirm the type (EF02) or flag (bios_grub) and position before the /boot partition; and for custom setups, ensure the partition remains unmounted and unformatted to avoid interference with GRUB installation.[14][23]

GRUB Installation Process

The installation of the GRUB bootloader into a BIOS boot partition requires specific prerequisites to ensure proper embedding and functionality on BIOS systems using a GUID Partition Table (GPT). The BIOS boot partition must already exist with the correct type GUID of 21686148-6449-6e6f-744e-656564454649 (EF02) and the bios_grub flag set, typically using tools like parted or gdisk, and it should be unformatted and empty as GRUB will overwrite its contents.[1] Additionally, the root filesystem must be mounted, with the /boot directory accessible and containing necessary GRUB configuration files such as grub.cfg, which is generated via grub-mkconfig.[8] If performing the installation post-operating system setup from a live environment, a chroot into the target system is required to access the mounted filesystems.[24] The core installation process begins with the grub-install command, executed as root: grub-install --target=i386-pc /dev/sdX, where /dev/sdX represents the target disk (not a specific partition) and i386-pc specifies the BIOS platform.[8] This command prompts GRUB to scan the disk for the BIOS boot partition identified by its EF02 GUID, locate the /boot/grub directory for modules, and embed the core.img file directly into the partition.[1] The core.img includes embedded paths to essential modules like normal.mod, enabling GRUB to load the full bootloader without relying on a filesystem in the post-MBR gap, which is unavailable in GPT layouts.[8] If BIOS drive mapping is required for legacy hardware compatibility, GRUB may generate or update a device.map file during configuration generation with grub-mkconfig -o /boot/grub/grub.cfg. In a chrooted live environment scenario, the process involves first mounting the root partition (e.g., mount /dev/sdXY /mnt), binding essential virtual filesystems (e.g., /dev, /proc, /sys), entering chroot (chroot /mnt), and then running grub-install followed by update-grub (or grub-mkconfig) to finalize the configuration.[24] This ensures GRUB's stage 1.5 (core.img) is correctly placed for BIOS chainloading to the /boot/grub stages.[1] Verification of the installation can be performed without committing changes by using the --dry-run option: grub-install --target=i386-pc /dev/sdX --dry-run, which simulates the embedding process and reports any issues like missing partitions.[8] Additionally, grub-probe can confirm device recognition: grub-probe --target=device /boot, ensuring GRUB correctly identifies the boot filesystem and partition layout. Successful installation results in GRUB being ready to boot the system upon BIOS initialization.[24]

Compatibility and Usage

Supported Systems and Scenarios

The BIOS boot partition is primarily supported on hardware featuring legacy BIOS firmware, which was the standard on personal computers manufactured before approximately 2012, when UEFI began to supplant it as the dominant boot interface.[25] This setup is essential for systems using GUID Partition Table (GPT) disks, particularly those exceeding 2 TB in capacity or requiring more than four primary partitions, as legacy BIOS cannot natively boot from GPT without dedicated boot code storage.[1] In such configurations, the partition reserves space for the GRUB core image, enabling compatibility with larger or more complex disk layouts that surpass the limitations of the Master Boot Record (MBR) scheme.[26] On the software side, the BIOS boot partition is predominantly utilized by GNU GRUB 2, the default bootloader in major Linux distributions such as Ubuntu, Debian, and Arch Linux, where it facilitates booting in legacy BIOS mode on GPT-partitioned drives.[27][26][8] Its adoption is rare in Windows environments, which traditionally favor MBR partitioning under legacy BIOS to maintain compatibility with the operating system's boot mechanisms, avoiding the need for a GRUB-specific partition.[28] Common scenarios for employing the BIOS boot partition include dual-boot configurations on GPT disks, where Linux coexists with another operating system without converting to UEFI; migrations from MBR to GPT partitioning on existing legacy BIOS systems to accommodate expanded storage needs; and server environments with large RAID arrays formatted as GPT to support capacities beyond 2 TB.[1][8] However, it is unnecessary for MBR disks under legacy BIOS, which rely on the post-MBR gap for boot code, or for any UEFI-based systems, which instead use an EFI System Partition.[1] While optional in some cases, it is strongly recommended for BIOS-GPT combinations to prevent boot failures due to insufficient space for the bootloader core.[27]

Common Issues and Troubleshooting

One common issue encountered with BIOS boot partitions is the "No BIOS boot partition" error during GRUB installation on GPT-partitioned disks in BIOS mode, where GRUB cannot embed its core image due to the absence of a dedicated partition for the initial boot code.[1] This error arises because GPT lacks space in the header for boot code, requiring a separate unformatted partition.[1] To resolve it, use gdisk to create a new partition of type EF02 with a recommended size of 1 MiB (absolute minimum 31 KiB; typically sectors 34-2047 for alignment), ensuring it contains no filesystem, then retry the grub-install command targeting the disk.[1] Boot failures due to partition misalignment can also occur, particularly if the BIOS boot partition is not aligned to 1 MiB boundaries (2048 sectors), leading to performance issues or GRUB's inability to locate the core image properly on modern drives. The resolution involves using parted to recreate or adjust the partition with the 'mkpart' command specifying alignment to 1 MiB, such as 'mkpart biosboot 1MiB 2MiB' and setting the 'bios_grub' flag, followed by regenerating the GRUB configuration with grub-mkconfig -o /boot/grub/grub.cfg. If the BIOS boot partition is overwritten or corrupted, such as during disk repartitioning or hardware failures, the system may fail to boot as GRUB cannot access its embedded components.[1] Recovery starts by booting from a live USB environment, then using TestDisk to scan and restore the partition table by selecting the disk, choosing "Analyse" to list lost partitions, and writing the recovered structure back.[29] Once recovered, reinstall GRUB with grub-install /dev/sdX (replacing sdX with the correct disk) to embed the core image into the restored EF02 partition.[1] Insufficient space within the BIOS boot partition for GRUB modules can cause installation failures or incomplete embedding, especially if the partition is smaller than recommended or if additional modules are loaded.[1] To address this, resize the partition to larger than recommended (e.g., 2 MiB) using gdisk or parted, then reinstall GRUB to embed the core image. Reduce the embedded modules in the core image by setting GRUB_MODULES in /etc/default/grub to essential ones (e.g., 'GRUB_MODULES="ext2 part_gpt"'), then regenerate with update-grub. For diagnostics across these issues, run fdisk -l to verify the presence and type of the EF02 partition (displayed as "BIOS boot" under GPT types), ensuring the bios_grub flag is set if using parted. Additionally, execute grub-install --verbose /dev/sdX to generate detailed logs revealing embedding errors or missing partitions during the process.[30]

Comparisons and Alternatives

Versus MBR Boot Methods

The Master Boot Record (MBR) partitioning scheme relies on a 512-byte boot sector at the disk's beginning to store the initial stage 1 boot code for the BIOS firmware, which loads subsequent stages of the bootloader such as GRUB. This approach limits disk support to a maximum of 2 terabytes and restricts the number of primary partitions to four (or three primary plus one extended partition for logical partitions). In traditional MBR setups with GRUB, the stage 1.5 code is embedded in the post-MBR gap—a reserved space of typically 1 MiB (1024 kibibytes) between the MBR and the first partition—to bridge the initial boot and the filesystem-based stage 2, though GRUB recommends at least 1000 kibibytes and the minimum for the core image is about 31 kibibytes.[1][14] In contrast, the BIOS boot partition addresses MBR's constraints by providing a dedicated, unformatted partition on GPT disks specifically for embedding the full GRUB core image (core.img), which the BIOS loads directly after the protective MBR. This setup eliminates reliance on the limited 512-byte sector and post-MBR gap, enabling GRUB to access partition data across the entire disk and supporting volumes exceeding 2 terabytes without requiring data repartitioning or loss. The BIOS boot partition uses the GUID 21686148-6449-6E6F-744E-656564454649 and a minimum size of 31 kibibytes, though 1 mebibyte is recommended to accommodate GRUB updates.[1][14] The primary advantage of the BIOS boot partition is its facilitation of GPT's scalability on legacy BIOS hardware, allowing systems to leverage larger disks and up to 128 partitions while maintaining compatibility without transitioning to UEFI. However, it introduces disadvantages, including the need for an additional partition that consumes disk space (typically 1 mebibyte) and a more involved installation process compared to the straightforward MBR method, where no extra partition is required.[1][14] Migrating from an MBR to a GPT layout with a BIOS boot partition can be achieved nondestructively using gdisk, but requires careful steps to avoid data loss—always back up data first. Boot from a live environment and launch gdisk on the target disk. Enter recovery mode with 'r', convert to GPT with 'g' (creating a protective MBR), then write changes with 'w'. If the first partition starts immediately after the MBR (lacking space for the BIOS boot partition), exit gdisk, use a tool like GParted to resize and move the first partition to create approximately 1 MiB of unallocated space immediately after the MBR (e.g., starting the first partition at sector 2048). Re-launch gdisk, use 'n' to create a new partition in this space (size 1 mebibyte, first sector after the MBR), set its type to ef02 with 't', then write changes with 'w'. Due to potential misalignment or the need for additional adjustments, consult the gdisk documentation for detailed guidance.[31]

Versus UEFI EFI System Partition

The EFI System Partition (ESP) is a dedicated partition required for UEFI-based systems, formatted with the FAT32 filesystem and identified by the GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B.[2] It typically ranges from 100 to 500 MiB in size to accommodate boot loaders, drivers, and UEFI applications, and is commonly mounted at /boot/efi in Linux environments.[32][33] The ESP stores executable EFI binaries (such as .efi files) that the UEFI firmware directly loads during boot.[2] In contrast, the BIOS boot partition serves legacy BIOS systems using GPT disk layouts and is unformatted raw space identified by the GUID 21686148-6449-6E6F-744E-656564454649 (type code EF02).[1][14] It provides a fixed location for embedding the GRUB core image without relying on a filesystem, typically sized at 1 MiB to prevent overwrites or disruptions from filesystem operations.[1] The BIOS boot partition is irrelevant in UEFI mode, where the firmware ignores it and relies solely on the ESP, while the ESP plays no role in pure legacy BIOS booting.[14] Hybrid configurations on a single GPT disk can include both the BIOS boot partition and the ESP to support dual-booting across BIOS and UEFI firmware modes, allowing installers to detect the active firmware and select the appropriate partition for GRUB installation.[14] In such setups, GRUB for UEFI installs its EFI binary to the ESP, whereas the BIOS variant embeds directly into the BIOS boot partition.[1] The BIOS boot partition facilitates transitional use of GPT layouts on legacy systems during upgrades to UEFI, providing a bridge until full conversion to an ESP-based setup, which is essential for features like Secure Boot that require filesystem access for larger EFI applications.[14][2]
User Avatar
No comments yet.