Skip header content and main navigation Binghamton University, State University of New York - News
Binghamton University Newsroom
Binghamton University Newsroom

Asked by: Samuel Breese
School: St. James Middle School
Grade: 7
Teacher: Mrs. Hantsch

Virtualization, Operating Systems, Computer Networks

Career Interest: Programmer


Answered by: Kartik Gopalan
Title: Associate Professor, Binghamton University
Department: Computer Science, Watson School of Engineering
About Scientist:


Date: 01-26-2010

Question: Please explain the process in which the GRUB boot loader works??


GRUB stands for "GRand Unified Boot loader". For now let\'s safely ignore the "GRU" part of GRUB and focus only on the B -- the boot loader. The most basic function of a boot loader is to find the location where the Operating System (OS) is installed in the computer, load the OS code into main memory, and hand over the control of the processor (CPU) to the OS code. But let\'s start at the beginning.

When you power on a computer, the very first piece of software (or rather "firmware") to run on the CPU is the BIOS (Basic Input/Output System), which is stored in a flash memory chip on the motherboard. The BIOS transfers control of the processor to the first boot device, which is usually the hard disk, but it can also be a CDROM, floppy disk, USB flash drive etc. For simplicity, let\'s assume its the hard disk.

In the hard disk, the very first sector (storage unit of a hard disk) is called the Master Boot Record (MBR). The MBR is very small – only 512 bytes. Of these, 64 bytes is used to store the partition table of the hard disk and remaining 446 bytes store a small piece of code called the "boot loader". Now different partitions on the hard disk can have different OSes installed in them. The default code in the MBR (one that comes pre-installed in the hard disk) searches for the first partition marked as "active" and loads the OS installed in that active partition.

But this basic boot loader is not very useful for people who want more advanced control over the boot procedure. For example, when the computer is powered on, someone might want to select which OS to boot from (Windows or Linux), instead of the default OS in the first active partition. So people have developed various boot loaders, such as Linux Loader (LILO), GRUB, GRUB-2, and so on, which differ in the features they offer. We will focus on GRUB, which was your original question. Other boot loaders also operate very similarly.

GRUB overwrites the default boot loader in the MBR with its own

instructions. In fact, GRUB consists of multiple stages of code. Stage 1 is very small and is located in the MBR. It simply tells the processor where Stage 2 is located. Stage 2 can be placed anywhere on the hard disk, allowing it to be much more complex and larger than Stage 1. Stage 2 provides an interface thorough which the user can configure various boot options, such as selecting which OS to boot from, changing the boot parameters, performing administrative tasks, and so on. Depending on what the user selects, Stage 2 then loads the user-specified OS (with user-specified parameters) into main memory and lets the OS take over the control of the CPU.

GRUB has been recently superseded by GRUB-2, which provides a lot more features such as scripting, graphical interface, extensibility, internationalization, etc. You can find much more information on GRUB at the following website:



Ask a Scientist appears Thursdays. Questions are answered by faculty at Binghamton University.  Teachers in the greater Binghamton area who wish to participate in the program are asked to write to Ask A Scientist, c/o Binghamton University, Office of Communications and Marketing, PO Box 6000, Binghamton, NY 13902-6000 or e-mail Check out the Ask a Scientist Web site at To submit a question, download the submission form(.pdf, 460kb).

Connect with Binghamton:
Twitter icon links to Binghamton University's Twitter page YouTube icon links to Binghamton University's YouTube page Facebook icon links to Binghamton University's Facebook page Instagram

Last Updated: 6/22/10