The GRUB bootloader is broken down into different stages. The code contained on the master boot record (MBR) is considered GRUB stage 1. It loads GRUB stage 1.5, which tries to identify the file system type (optional), or it can call GRUB stage 2 directly. Stage 2 is what calls the kernel and loads it into memory. GRUB has its own format for looking through hard disks. The syntax of this format is:
(xdn[,m]) where xd is the drive, n is the number of the disk, and m denotes the partition number.
This syntax is very useful when troubleshooting issues with GRUB because you need to know how GRUB searches for disk drives when trying to find the primary partition. When the primary partition is found, GRUB loads the kernel, which is where you move on to stage 2. Stage 2 is the place where you will tend to spend the most time troubleshooting boot issues with the system.
Grub Boot Options:
e Edit the commands before booting
a Modify or append the kernel arguments before booting
c Open the GRUB command line
Editing a GRUB kernel entry
You can use the a option to modify any parameters you want to pass to the kernel. Here are the different modes that you can boot into:
Single-User Mode Used to perform maintenance tasks or if you forget the root password
Runlevel 2 or 3 Used to load only partial services during the boot process
Emergency Mode Used to perform tasks on an unbootable system
Rescue Mode Used to fix boot issues or reinstall GRUB
The Config File
GRUB has only a single config file,
/boot/grub/grub.conf. Two other files actually have soft links to this main config file as well:
/boot/grub/menu.lst and
/etc/grub.conf. When GRUB starts, it reads its configuration from the main config file.
After the system has booted, you can view the config file, but there is one area where RHEL6 has changed. Let’s take a look at the new version of
grub.conf:
Notice that almost everything is the same except for the line containing the kernel boot parameters. This new version defines additional options such as
encryption,
RAID, and use of the
/dev/mapper for
LVM management.
If you want to create one more title in boot menu such as Recovery Mode or Windows, just edit the file
grub.conf. Moreover, you can change the waiting time as well.
In recovery mode, you don’t need to put your username and password. Keep the following in mind about Recovery Runlevel.
+ You can reset or change the root user’s password
+ You can adjust system files or partitions that are normally locked when system in use.
+ You can repair system files by replacing them with working copies from a backup or the Red Hat installation DVD.
The GRUB Command Line
One task that is common in the real world is how to repair a broken MBR. For this to happen, you need to make use of "command-line". When you are in the Grub command-line mode, you can repair your broken MBR.
Now that your MBR is fixed, you should be able to boot into the system once again!