September 23, 2014
 
 
RSSRSS feed

Getting Some GRUB For Linux - page 2

Preparation

  • April 26, 2004
  • By Carla Schroder

First, install GRUB. Build from sources, install from packages, I care not, just install it however you choose. So far, you are not fully committed — just installing it to your system does not install it to the MBR.

Next, find out where in the heck your particular Linux parked the GRUB boot image files. The official location is /usr/lib/grub/$ARCH. Red Hat does /usr/share/grub/$ARCH. Like herding cats, is Linux. This is where you find all those stage1, stage1_5, and stage2 thingies.

Installation From A GRUB Floppy

This is the way to install GRUB to the MBR, and create a boot floppy at the same time. Change to your /grub/$ARCH directory, and copy the stage1 and stage2 boot images to a floppy disk:
# dd if=stage1 of=/dev/fd0 bs=512 count=1
# dd if=stage2 of=/dev/fd0 bs=512 seek=1

Now reboot to the floppy disk. You should be greeted by the nice blue GRUB screen:

 GRUB version 0.93  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename. ]

 grub>

First, find the location of the boot files:

grub> find /boot/grub/stage1
(hd0,0)

Now set the root device:

grub> root (hd0,0)

A Digression Into Partition Numbering

GRUB uses its own unique partition numbering scheme; it starts from 0. hd0,0 means the first partition of the first drive, or hda1. Both SCSI and IDE drives are represented by hd. GRUB numbers sequentially, from zero:

hda2�� ��hd0,1
hda3�� ��hd0,2
hda4�� ��hd0,3

But that's not all. Remember, the standard Linux partition table is like this:

1-4�� �� primary partitions
5-up�� �� extended partitions

In GRUB, it's like this:

0-3�� �� primary partitions
4-up�� �� extended partitions

Additional drives are hd1, hd2, etc.

Sitemap | Contact Us