Linux Grub (I). What is it and how it works?

El GRUB is one of the most important parts of Linux, but it can also be one of the most problematic, so we are going to explain what it consists of and how it works from the simplest perspective.

Linux Grub

The first sector of the hard disk is called the Master Boot Record (MBR). This sector is only 512 bytes long and contains a small piece of code (446 bytes) called the primary bootloader and the partition table (64 bytes), which describes the primary and extended partitions.

By default, the MBR code looks for the partition marked as active and once a partition is found, it loads it from its boot sector into memory and passes control to it. GRUB replaces the default MBR with your own code.

GRUB operation can be classified into several stages.

1 stage. It is located in the MBR and points mainly to stage 2, as the MBR is too small to hold all the necessary data.

2 stage. Points to your configuration file, which contains all the complex user interface and options that are normally known when talking about GRUB. Stage 2 can be located anywhere on the disk. If stage 2 cannot find its configuration table, GRUB will leave the boot sequence and present the user with a command line for manual configuration.

1.5 stage. Can use boot information, which is small enough to fit in the area immediately after MBR.

The architecture of the stage allows GRUB be quite complex and highly configurable, compared to most bootloaders, which are sparse and simple to fit within the boundaries of the partition table.

The content of the article adheres to our principles of editorial ethics. To report an error click here.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.