GRUB Basics – How grub works (linux) – Dual boot with grub

April 17th, 2009 by Giridhar | Posted under Howtos.

gnu grub Grub is a smart boot loader program which loads a variety of operating systems . Grub understands the file system and kernel executable formats. so loads OS as we wish regardless of physical location of the kernel on disk.

For those who are very new about computer booting process

Once computers is switched on , BIOS execute its function of checking basic input and output devices then, checks for master book record (MBR) and if GRUB/LILO or any boot loader is found it will load.

Grub can be used in command line interface as well as menu interface.
In command line interface we need to provide the drive and file name of kernel.
In menu mode we need to select the OS from the menu.
grub

Naming pattern

(hd0,1)

The first integer `0‘ indicates the drive number, that is, the first hard disk(which is counted from zero), while the second integer, `1‘, indicates the partition number

Command line mode

grub> root (hd0,a)           (for FreeBSD)
grub> kernel /boot/loader    (for FreeBSD)
grub> boot

Menu interface

#This boots GNU/Hurd from the second hard disk, first partition.

# For booting GNU/Linux
title  GNU/Linux
kernel (hd1,0)/vmlinuz root=/dev/hdb1

# For booting Windows NT or Windows95 from first hard disk, first partition.
title Windows NT / Windows 95 boot menu
root        (hd0,0)
makeactive
chainloader +1

# For loading DOS if Windows NT is installed
# chainload /bootsect.dos

# For installing GRUB into the hard disk
title Install GRUB into the hard disk
root    (hd0,0)
setup   (hd0)

Common GRUB commands

* boot: Start up your operating system
* chainloader: Chain-load another boot loader
* configfile: Load a configuration file
* debug: Toggle the debug flag
* find: Find a file
* help: Show help messages
* initrd: Load an initrd
* install: Install GRUB
* kernel: Load a kernel
* makeactive: Make a partition active
* map: Map a drive to another
* module: Load a module
* pause: Wait for a key press
* quit: Exit from the grub shell
* reboot: Reboot your computer
* read: Read data from memory
* root: Set GRUB’s root device
* rootnoverify: Set GRUB’s root device without mounting
* savedefault: Save current entry as the default entry
* setup: Set up GRUB’s installation automatically
* testload: Load a file for testing a filesystem

Reference
http://www.gnu.org/software/grub/manual/grub.html

Need more info ?


Is this article useful ?, please comment (why should I comment ?)

Comments

One Response to “GRUB Basics – How grub works (linux) – Dual boot with grub”

Have any comments?