From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
GRUB in non-graphical mode
GRUB in non-graphical mode
Developer(s)GNU Project
Stable release
1.96 / February 3, 2008; 10 years ago (2008-02-03)
Repository Edit this at Wikidata
LicenseGNU General Public License

GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project. GRUB is the main example of the Multiboot Specification, which allows a user to have more than one operating systems on their computer at once, and to choose which one to run when the computer starts. GRUB can be used to select from different kernel images available on a particular operating system's partitions, as well as to pass boot-time parameters to such kernels.

Functioning[change | change source]

GNU GRUB on MBR-partitioned hard disk drives
GNU GRUB on GPT-partitioned hard disk drives
boot.img has the exact size of 446 Bytes and is written to the MBR (sector 0). core.img is written to the empty sectors between the MBR and the first partition, if available (for legacy reasons the first partition starts at sector 63 instead of sector 1, but this is not mandatory). The /boot/grub-directory can be located on an distinct partition, or on the /-partition.

When a computer is turned on, the computer's BIOS finds the primary bootable device (usually the computer's hard disk) and loads the initial bootstrap program from the master boot record (MBR), the first 512 bytes of the hard disk, and then transfers control to this code.

The MBR contains GRUB stage 1. Because of the small size of the MBR, Stage 1 just loads the next stage of GRUB (which may be physically elsewhere on the disk). Stage 1 can either load Stage 2 directly, or it can load stage 1.5: GRUB Stage 1.5 is located in the first 30 kilobytes of hard disk immediately following the MBR. Stage 1.5 loads Stage 2.

When GRUB Stage 2 receives control, it presents an interface to the user in order to select which operating system to boot. This normally takes the form of a graphical menu, although if this is not available or the user wishes further control, GRUB has its own command prompt, where the user can manually specify the boot parameters. GRUB can also be set to automatically load a particular kernel after a timeout period.

Once boot options have been selected, GRUB loads the selected kernel into memory and passes control on to the kernel, which then continues to start itself. At this stage GRUB can also pass control of the boot process to another loader, using chain loading, for operating systems such as Windows that do not support the Multiboot standard. In this case, copies of the other system's boot programs have been saved by GRUB; instead of a kernel, the other system is loaded as though it had been started from the MBR. This may be yet another boot manager, such as the Microsoft boot menu, allowing further selection of non-Multiboot operating systems. (This behavior is often automatic when modern Linux distributions are installed "on top of" existing Windows systems, allowing the user to retain the original operating system without changes, including systems that contain multiple versions of Windows.)

Related pages[change | change source]

Other websites[change | change source]