h1

How to: Installing GRUB

June 24, 2007

GRUB is one of the most important OS loader. I think it’s very simply and useful, but we must know some tricks to install and configure in our hard drive.

In GRUB the drives are called hd0, hd1, hd2, … For example, if have a single disk, their name will be “hd0”.

To install it, first, we go to GRUB 2 download page and download it (In a floppy disk or pendrive, for example). After this, and our directory /boot its on a independent partition, we type this (With root rights):

/sbin/grub-install –root-directory=/boot /dev/hda 

If we’ve all directories in / (Or something like / and /home partitions), we must type:

/sbin/grub-install /dev/hda

It’s very simply! 😀

If we want configure our GRUB, we need edit the file “/boot/grub/menu.lst”. In this file we’ve some examples of GRUB configuration. Usally, we can use something like this:

title           Debian GNU/Linux, kernel 2.4.27-2-386
root            (hd0,1)
kernel          /boot/vmlinuz-2.4.27-2-386 root=/dev/hda2 ro
initrd          /boot/initrd.img-2.4.27-2-386
savedefault
boot

Title = Only a title to know the OS which will load in that option.

root = Show the partition wich is installed. In this example, Debian are installed in the first drive of the system (hd0), and the second partition (1).

kernel = Have the path of the kernel of the OS.  The first parameter have the path of the kernel file in the disk. The second parameter have the partition disk which is installed the kernel, and the third (“ro”)  means,”read only”.

initrd = Shows the kernel image path. Usally have the same path than the kernel line.

boot = When GRUB read this, it launch the OS according the kernel path and parameters we put.

On more thing. To load a Windows system we must type this in  “/boot/grub/menu.lst”:

title           Microsoft Windows OS
root            (hd0,0)
savedefault
makeactive
chainloader     +1

Supposing you’ve the Windows partition in the first drive (hd0), and the first partition (0).

See you.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: