Inside Grub in RHEL 6
Lets understand once again the internals of GRUB and how it helps in booting your machine.
GRUB consists of different parts. Two actually.
The first part is installed in the master boot record (MBR) of your hard disk or in the boot sector of the active partition.
By default, Red Hat Enterprise Linux installs it in the MBR. This part is very small, just 446 bytes, and it is called the GRUB stage 1 boot loader. But, you should remember that, a mere, 446 bytes in the MBR are not enough to start an entire operating system.
This is the reason we have stage 2 part of GRUB.
This part is in the first megabyte of your hard disk—an area used to store metadata needed to start the computer. With the use of the stage 2, GRUB is capable of reading files directly from the file system, as long as the file system is supported. You can find a list of supported file systems in the /boot/grub directory. The minimal file system drivers in this directory all have a name that ends with stage1_5.
An important file also used by GRUB is /boot/grub/device.map. This file contains the mapping between kernel device names and BIOS device names. If you’re ever having a problem recognizing the boot disk correctly, the reason might be a mis-configuration of this file.
On a server that experiences severe problems with GRUB, it can be useful to check whether GRUB is still present in the MBR.
To do this, the tool xxd can be useful. xxd is a hexadecimal viewer, and if you use xxd -l 512 /dev/sda on your computer, it will show you the contents of the MBR.
Even if the contents are completely hexadecimal, you’ll easily recognize the GRUB error message, which indicates that a GRUB boot loader has been installed.
Apart from the GRUB error message that is shown. in the lines that start with 1c0 and 1d0, you can also recognize the partition table. The second columns of these lines clearly mark the existence of a partition of type 83 and 8e.