Compare and Contrast GRUB Legacy and GRUB 2 boot loaders


Grub is the boot loader which is using in Linux base operating systems. We can describe GRUB as some sort of software which is using in initial process met in the computer boot up. We are allowed install a new GRUB by neglecting our default boot loader. Normally Ubuntu is using GRUB as their boot loader. LILO is another boot loader which can use in Linux base operating systems. GRUB 2 is the latest version of the GRUB, and after then oldest version is named as Legacy GRUB. I describe few differences among these two versions under few topics.

• File locations
This is the main different between the Legacy GRUB and GRUB 2.

In legacy GRUB, GRUB files is located under /boot/grub/, and there is a menu.lst file that is reading during boot and which contents is displayed to the user in the GRUB menu.

But in GRUB 2 it is distributed through three core locations. There is a file grub.cfg in privies location (/boot/grub/) which replaces the menu.lst file and this is the main configuration file. Beyond that another two files are there located in two different places.

  • /etc/grub.d/GRUB scripts are contained here and those scripts create grub.cfg file when the relevant grub command is execute.
  • /etc/grub.d/ Here is the place contains grub settings. Grub scripts are looking here before create the grub.cfg file when the relevant grub command is execute.

Install/re-install GRUB

In Legacy GRUB we are opening GRUB shell by typing sudo grub as a super user. Then we can use it to install or reinstall to MBL (master boot loader) or a particular partition boot sector. But at GRUB 2 this is partially different. In this case the command is sudo grub-install. We can use this command at the BASH (SHELL) as a supper user to do the same process.

Partition numbering has been changed

So, In GRUB 2, first hard driver and first partition instance is numbering as (hd0, 1).

Replaces the geometry command.

In Legacy GRUB, there is command called geometry, is used for list down the devices as GRUB sees them on our PC. But in GRUB 2 introduce ls command for the same purpose.

GRUB Legacy uses stages is replaced

In GRUB 2 uses boot.img and core.img files for instead stage 1 and stage 2 which are using legacy GRUB. Normally Legacy GRUB has three stages, stage 1, stage 1.5 and stage 2. Stage 1.5 has been neglected here or stage 1.5 and stage 2 both are replaced with stage 2 by core.img file.

And those are some of differences which are found out by me in this session. Finally I have to say GRUB 2 is more efficient, powerful in many ways than Legacy GRUB.

How to customize GRUB menu..


warning: plz make a backup of grub.cfg file before test this.

There is a configuration file it is named as grub.cfg and stored in /boot/grub.

We can edit this file for customize the GRUB menu. But normal user is restricted to edit this file and they have permission for read only. Therefor you must login as supper user for edit this configuration file.

  • Open terminal and type command given bellow for login as supper user.

sudo su

  • Then terminal will ask the root password and you must enter your password. Then you can go to particular file by using command given bellow.

cd /boot/grub

  • Now you must open the grub.cfg file in a text editer. Every linux base OS are using a desktop environment. Ubuntu OS is using gnome desktop environment. Gedit is the text editor which is using in gnome desktop environments. So you can open grub.cfg file in gedit by using command given bellow.

gedit grub.cfg

Now grub.cfg opens in gedit. You can use this file for customize following three things.

  1. Grub menu oder.

  2. Grub menu time out.

  3. Grub menu background color and font color.

I will explain here how to change the grub menu oder and you can test rest of those. And those tasks are very simple to do.

And this is a screen shot of grub.cfg file. Now look at the code which is highlighted here.

part of the cord which is relevant to windows 7 in my pc is highlighted here. And you can check your code and identify how to code distributes among the menu items which are exist in your grub menu.

Assume you need to move a menu item from bottom to top of the the menu. You can cut the relevant part and past it before part of first menu item. Now save your file and restart your computer.