The Grub Boot Loader
GRUB stands for Grand Unified Bootloader, is a program distributed under the GNU in charge of loading and the start of operating systems.
GRUB residing on disk, and is widely used and installed by default in almost all major versions of Linux, as well as in those of FreeBSD and OpenSolaris.
Than its inner workings, actually very complex, it is interesting to know the basic architecture, the system configuration (managed by the configuration file menu.lst) and the main text commands.
Grub allows to rewrite from scratch commands needed to boot a kernel, GRUB boot loader is a universal, supports all major operating systems, including even those with proprietary license as Windows.
It occurs when the computer interface with a menu like the one presented by the following example:
GRUB bootable grub from the command in a standard way, and is distributed along with some accessory programs, which are reported with a brief description of the most commonly used:
-
grub-install: install grub on a disk;
-
grub-set-default: assign the default menu item starts the timeout expires;
-
grub-probe: offers information on the device corresponding to a given path (or a device via the-d option);
-
grub-reboot: reboot the computer with the operating system corresponding to the menu item specified as argument;
-
grub-md5-crypt: calculate the MD5 hash of a password required by the program itself.
Architecture of GRUB
GRUB consists of two parts called stages.
-
stage1 is resident in the Master Boot Record (MBR, boot sector used by the bios to complete the system boot) and deals to upload the second part;
-
stage2 residing on the hard path to / boot / grub and contains the actual program, the same path the configuration files are stored.
This architecture allows the stage1 to always be unchanged and the only change is the stage2, the act of changing a configuration file, which determines the behavior of the boot loader and menu structure.
From this operating system comes a flexibility and ease of use incredibly high when seen in conjunction with the power of the tool.
Notations for identification of disks and partitions.
Before discussing in detail the operation and structure of the configuration file can be useful to recall how they are called disks and partitions to grub and operating systems.
-
The DOS / Windows assigns to each partition any disk placed on a symbolic value consists of a progressive letter and a colon (default is A: and B: for removable disks, C: and below for hard disks and other units );
-
unix notation names the disk in the form hda, hdb, hdc etc. ..
and for each disk drive and define a value that identifies each sequence of partitions (ie hda1, hda5, hdb3).
The numbers from 1 to 4 are reserved for the four possible primary partitions, while using values greater than 5 to name the logical partitions.
-
GRUB uses its own notation, different from the previous two, which gives each hard drive the prefix 'hd' followed by the identifier of the disk and the partition:
hd (<numero_disco>, <numero_partizione>)
Here is a diagram summarizing an example that may clarify things: