Understanding the GRUB Bootloader: Course

by Mike on September 6, 2009 · 3 comments

in Server Management

GRUB stands for Grand Unified Bootloader and was created in 1995 by Erich Boleyn as he wanted to have a multiboot option .   Intel based motherboards must be started with a 16-bit operating system because of a limitation to 640 kilobytes of RAM at startup.  GRUB is used to facilitate the 16-bit requirement and load the 32-bit Linux kernel.  The AMD CMOS is 64-bit so it can load the 64-bit kernel for Linux.  In order for GRUB to work it must use a three step process  on CentOS.    The first step loads and executes the Master Boot record,  this is the IPL or initial program loader for GRUB.  The first stage of GRUB  also starts  stage1.5 which is able to understand the filesystem and acts as a bridge to stage2.  Then stage1.5 will start stage2 which reads the file in /boot/grub/grub.conf and starts the kernel.

This course provide a basic understanding of GRUB and give you some illustrations on how to secure it and to fix several common problems.

Course Difficulty

The course level is for an Experienced Linux Administrator.  Please note that any changes you make to GRUB could lead to a system that does not boot if you make a mistake so learn on a test system.
Course Outline
Configure GRUB
GRUB Commands
GRUB Protection
GRUB Error Messages
Fix GRUB Config
Fix Boot


Course Support
The course author, among others, will be available for questions in the Forum.

The quizzes are there to help you focus on the key points made about each distro. So before you take the quiz be sure you understand all of the features that you will be tested on.

Start The Course

Here is a summary of the boot process and where GRUB is positioned.  If you are looking for a Live CentOS Server Course CLICK HERE.

Power On
BIOS Starts
–Hardware Probe
–Select boot Device
–Load and execute MBR
–Load/execute first stage of GRUB
–Load/execute stage1.5 of GRUB
–Load/execute second stage of GRUB
Kernel Initialization
–Load/execute kernel
–Hardware probe
–Mount Initial RAM disks
–Initialize Devices
–Mount root System
init Starts
–Load/execute /sbin/init
–Select runlevel
–run the rc command
–run rc?.d/K* stop
–run rc?.d/S* start
–run kudzu
–run daemons
–text based logins
start XWindow

GRUB is a boot loader, which is the first piece of software that runs when the server starts.  GRUB loads and transfers control to the operating system, specifically the kernel.  GRUB is flexible enough to understand different filesystems and kernel executable formats.

GRUB has a fistful of options, including the most important to be able  multiboot.  In the design, the primary goals beyond multiboot were easy to use aspect for users, generous functionality to support both the experts and designer and backward compatibility.  The other features which exist are multiple executable formats, support for non-multiboot kernels, ability to load multiple modules, ability to load a configuration file, create a menu interface, flexible command line, support for multiple filesystem types, automatic decompression using gzip, ability to access data on any installed device, independent of drive geometry translations, detect all the installed RAM, support for LBA mode, support for network booting and support for remote terminals.  Yep, lots of features.

Naming Convention
When you name devices with grub it must be placed within “( )”.  So if you are naming a hard drive it would look like this:


“hd” is the hard drive, “0″ means that it is the first hard drive detected, and “0″ is the first partition on the hard drive.  Note, that if you were using the /boot partition for grub, which is typical, the Linux file system lists this drive differently.

/dev/sda1 = (hd0,0)

Grub always lists drives and partitions from “0″ while the Linux file system lists them from “1″.  The other item of note is that GRUB only uses the “hd” convention, in other words it does not distinguish IDE, SATA or SCSI.  GRUB only counts the drive numbers starting with zero.


Here is an example output from df, note the /boot directory is hda1 or according to GRUB, (hd0,0) because it is the first drive, first partition.

/dev/hda2     /
/dev/hda3     /home
/dev/hda1     /boot


Marcus September 7, 2009 at 12:33 am

You say:

“When you name devices with grub it must be placed within “( )”. So if you are naming a hard drive it would look like this:


“hd” is the hard drive, “0″ means that it is the first hard drive detected, and “1″ is the first partition on the”

I guess it should say hd0,0 instad.

Best Regards

mike September 7, 2009 at 2:08 am

Thanks for the notice you are correct and I have fixed it….this just illustrates how easy it can be to make a mistake with the GRUB and the natural way we think.

{ 1 trackback }

Previous post:

Next post: