Fixin’ Grub

A new kernel was pushed out today for FC3, so I figured I should look at fixing my system so that it uses GRUB from my FC3 partition, instead of my JDS partition. Turns out that it’s real easy to have the GRUB utility put the correct bootload on the MBR. It just a matter of running grub with root permission, and doing the following:

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if “/boot/grub/stage1” exists… no
Checking if “/grub/stage1” exists… yes
Checking if “/grub/stage2” exists… yes
Checking if “/grub/e2fs_stage1_5” exists… yes
Running “embed /grub/e2fs_stage1_5 (hd0)”… 16 sectors are embedded. succeeded
Running “install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 grub/grub.conf”…succeeded

grub> quit

The root (hd0,0) command tells GRUB to look on the first partition on my primary hard drive for its configuration files. GRUB doesn’t use the regular Linux hard drive device identifiers (hda1, hda2, etc.). Instead, GRUB identifies disks via a string of the form (hdx,y), where x is the physical disk number, and y is the partition number. Both of these identifiers begin numbering with 0. For example, my FC3 installation uses /dev/hda1, which is (hd0,0), and my JDS installation uses /dev/hda5, which is (hda0,4).

The setup (hd0) command tells GRUB to install the boot loader code on my primary drives MBR. And that’s all I needed to do. Sweet.


Leave a Reply

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

You are commenting using your 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: