BIOS boot partition: Difference between revisions

Content deleted Content added
top: "BIOS boot partition" really seems to be a GRUB 2 thing -- do we have any sources for any other bootloaders that use it?
Overview: full quote
 
(47 intermediate revisions by 27 users not shown)
Line 1:
{{Short description|Partition used by GNU GRUB on BIOS to boot an operating system with GUID Partition Table}}
{{Refimprove|date=June 2014}}
 
[[GRUB]]'sThe '''BIOS boot partition''' is a [[partitionPartition (computing)|partition]] on a [[data storage device]] that [[GNU GRUB]] uses on legacy [[BIOS]]-based systems[[personal computer]]s in order to [[Booting|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.<ref>{{cite web
| url = https://wiki.archlinux.org/index.php/GUID_Partition_Table
| title = GUID Partition Table
| date = 2015-03-19 | accessdate = 2015-03-05
| website = archlinux.org
}}</ref>
 
A BIOS boot partition is needed on GPT-partitioned storage devices to hold the second stages of GRUB. On traditional [[Master Boot Record|MBR]]-partitioned devices, the [[disk sector]]s 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]].
It must be utilized because there is not enough unused space available for the second stages of [[boot loader]]s on GPT disks. On MBR-partitioned disks, boot loaders are occupying unused [[disk sector|sectors]] immediately following the [[Master Boot Record]] (MBR) for that purpose, while there is no equivalent for those on GPT disks.
 
== Overview ==
[[File:GNU GRUB components.svg|thumb|upright=2|In the example 2 above, [[GRUB&nbsp;2]] stores its {{Mono|core.img}} in a BIOS boot partition.]]
The [[Globally Unique Identifier]] for the BIOS boot partition in the GPT scheme is <tt>21686148-6449-6E6F-744E-656564454649</tt><ref>{{cite web
 
| url = http://www.gnu.org/software/grub/manual/html_node/BIOS-installation.html
When used, the BIOS boot partition contains the second stage of the [[boot loader]] program, such as the [[GRUB&nbsp;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<!-- MBR with disk timestamp, disk signature, AAP and NEWLDR support --> to 446<!-- classic MBR without any extensions --> 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 [[Globallyglobally Uniqueunique Identifieridentifier]] (GUID) for the BIOS boot partition in the GPT scheme is <tt>{{samp|21686148-6449-6E6F-744E-656564454649<sub>16</ttsub>}}<ref>{{cite web
| url = httphttps://www.gnu.org/software/grub/manual/html_node/BIOS-installation.html
| title = GNU GRUB Installation, Section 3.4: BIOS installation
| accessdate = 2014-06-26
| website = gnu.org
}}</ref>
}}</ref> (which, when written to a GPT in the required little endian fields, forms the ASCII string "<tt>Hah!IdontNeedEFI</tt>").<!-- See talk page for some notes on endianness confusion. --> 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 [[Extensible Firmware Interface|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.
<ref>
{{cite web
| url = https://sourceforge.net/p/gptfdisk/code/ci/master/tree/parttypes.cc
| title = parttypes.cc in the gptfdisk source code
| accessdate = 2023-05-03
| website = gptfdisk project on sourceforge.net
}}</ref> (which, when written to a GPT in the required little endian fields, forms the ASCII string "<ttcode>Hah!IdontNeedEFI</ttcode>").<!-- See talk page for some notes on endianness confusion. --> In the context of GPT on a BIOS-based computer, a BIOS boot partition is similar in some respects to the [[EFI Systemsystem partition]], which is used by systems based on [[Extensible Firmware Interface|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 small,low so it can be as small as about 30 &nbsp;KiB.; Thoughhowever, as future boot loaders might require more space, so creating a larger BIOS boot partition is advisable; 1&nbsp;MiB might be a sensiblereasonable BIOS boot partition size. Due to the [[1 MB partition alignment|1 &nbsp;MiB partition alignment]] policies used by most modern disk partitioning tools to provide optimum performance with [[Advanced Format]] disks, [[Solid-state drive|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&ndash;2047 for 512-byte sectors; 6&ndash;255 for 4096-byte sectors). If created by utilizing that free space, the BIOS boot partition would be out of the GPT alignment specification,<ref>See https://uefi.org/specs/UEFI/2.10/05_GUID_Partition_Table_Format.html, "GPT partitions should be aligned to the larger of: GPT partitions should be aligned to the larger of: a – The physical block boundary, if any; b – The optimal transfer length granularity, if any."</ref> but that is not very important since: it(a) the alignment rule is written"should" toand not "must" (b) the rule is based on a performance consideration, which for a very infrequentlysmall partition used only at system boot bears no real consequence.
When used, the BIOS boot partition contains the second stage of the [[boot loader]] program, such as the [[GRUB&nbsp;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<!-- MBR with disk timestamp, disk signature, AAP and NEWLDR support --> to 446<!-- classic MBR without any extensions --> 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 size requirements for a BIOS boot partition are quite small, so it can be as small as about 30 KiB. Though, future boot loaders might require more space, so creating a larger BIOS boot partition is advisable; 1&nbsp;MiB might be a sensible size. Due to the [[1 MB partition alignment|1 MiB partition alignment]] policies used by most modern disk partitioning tools to provide optimum performance with [[Advanced Format]] disks, [[Solid-state drive|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. If created by utilizing that free space, the BIOS boot partition would be out of the GPT alignment specification, but that is not very important since it is written to very infrequently.
 
== Creation ==
The following utilities are known to support BIOS boot partitions:
* [[cfdisk]]
 
* [[fdisk]]
* [[GRUB 2]] (1.97~beta1 or later): when a BIOS boot partition is found during installation, GRUB will embed itself in it.
* [[GNU Parted]] (2.0 or later).
* [[GParted]], the front-end to GNU Parted.
Line 28 ⟶ 43:
== See also ==
* [[Unified Extensible Firmware Interface]] (UEFI)
* [[EFI System partition]] (ESP)
* [[Windows To Go]]
 
Line 35 ⟶ 49:
 
== External links ==
* [httphttps://www.gnu.org/software/grub/manual/html_node/BIOS-installation.html#BIOS-installation BIOS installation], inpart officialof the GRUB2 documentdocumentation
* [http://www.funtoo.org/wiki/GUID_Booting_Guide The Funtoo Linux GUID Booting Guide]
*[http://www.freelists.org/post/haiku-development/Defining-the-Haiku-UUID-for-GPT-and-other-uses haiku-development]
* [http://www.rodsbooks.com/gdisk/booting.html Booting from GPT], part of the GPT fdisk documentation
*[http://www.funtoo.org/wiki/GUID_Booting_Guide The Funtoo Linux GUID Booting Guide]
*The [http://www.rodsbooks.com/gdisk/bootingbios.html BootingLegacy fromBIOS GPTissues pagewith GPT], inFebruary the22, GPT2014, by fdiskRod documentationSmith
 
[[Category:BIOS]]
[[Category:BootingDisk partitions]]