In this tutorial, I am going to provide some understanding of Linux boot loader GRUB (Grand Unified Boot loader). If you have an understanding of the working pattern of GRUB then it can help you to know how the operating system works much better. If you really want to gain confidence in working on Linux then you should master the GRUB boot loader. GRUB can easily work with DOS, Windows, Linux or any BSD operating system.
Grub boot loader can be configured dynamically, which means a user has an option to make changes while booting. Even users can also easily alter the current boot entries, they can add new entries, select multiple kernels or even they can modify initrd. GRUB has also got the support of Logical Block Address. GRUB can be installed and executed from any type of device like hard disk, CD and USB. GRUB and GRUB2 are two different versions.
GRUB2 is considered as default boot loader of Ubuntu whereas GRUB is generally used in RHEL older versions. When started, GRUB2 mainly presents a menu and waits for some input from users. It generally transfers control to our operating system kernel. GRUB2 is mainly designed to provide flexibility and performance to today’s operating systems.
GRUB vs GRUB2
The default menu for GRUB2 looks very similar to GRUB but there are some changes made in this.
- Grub has two configuration files namely
grub.confwhereas, Grub2 has only one main configuration file namely grub.cfg and it looks very close to a full scripting language. And this configuration file is overwritten by certain Grub 2 package updates, whenever a kernel is added or removed, or when the user runs update-grub. For any configuration changes, we need to run update-grub to make the changes effective.
- In Grub, it is really hard for the normal user to modify the configuration. But Grub2 is more user-friendly, Grub-mkconfig will automatically changes the configuration.
- In Grub, partition number starts from 0, whereas in Grub2 it starts with 1. The first device is still identified with hd0. These changes can be altered if needed by making some changes to device.map file of the '/etc/grub' folder.
- Grub uses physical and logical addresses to address the disk, it can't even read from new paritions whereas, Grub2 uses UUID to identify a disk thus is more reliable. It supports LVM and RAID devices.
- In today’s Linux Distros including (Ubuntu 16.04 and RHEL 7), GRUB2 will now directly show a login prompt and no menu is displayed now.
- If you want to see the menu during boot you need to hold down SHIFT key. Even sometimes by pressing ESC you can also display the menu.
- Users have also now choice of creating custom files in which they can place their own menu entries. You can make use of a file called 40_custom which is available in '/etc/grub.d' folder.
- Even users can now change the menu display settings. This is done through a file called grub located in /etc/default folder.