Grub question (Ahem....help! Now it just says 'GRUB')

Mark Knecht mknecht at controlnet.com
Wed Sep 29 17:24:38 UTC 2004


Rick Stevens wrote:
> Mark Knecht wrote:
>>
>>
>>
>> I'm unclear whether you think this would have helped my problem. I
>> think not. Using Stuart's info he said grb had two parts. In my case
>> grub said 'GRUB' but didn't say 'GRUB second phase loader' or whatever
>> that language is. I assume grub cannot find fstab on it's own,
>> correct?
> 
> 
> Correct.  /etc/fstab is used by the "mount -a" command in the startup
> scripts.  The MBR part of grub (first stage) needs to know where the
> second stage is located.  That's what the "root=" thing is for in
> grub.conf--it tells grub where /boot is (and hence, where the second
> stage loader and the grub config file are).
> 

<SNIP from Stuart Sear's response>

GRUB is split into two parts, the first and second stages. The first 
stage is a small (446b IIRC) binary file that goes onto the MBR (or 
indeed first sector) of your bootable disc/partition. This is a 
supremely unintelligent binary which simply loads the second stage 
bootloader (by disc sector).

The second stage is the full binary that provides your boot menu, 
allowing you to choose between kernels (and other OSs if configured that 
way). It is the second stage that looks for /boot/grub/grub.conf (well 
actually menu.lst, which is symlinked to grub.conf)

So if you change the location of your root (or indeed /boot) FS you need 
to reinstall your 1st stage BL, which is what the grub-install command does.

<SNIP>

OK then, to finish up from my side (unless I'm incorrect in this 
summary) here's what happened. My /dev/hda7 / (root) partition did not 
change numbers. It has /dev/hd7 before and after the move. My /dev/hda5 
/boot partition also did not change numbers. It was /dev/hda5 before and 
after.

However, when I move /dev/hda7 the sectors that the second stage of grub 
is located on moves. grub is not really smart enough to look somewhere 
within /dev/hda7, but actually has to be given the exact secotr numbers. 
Since this changed grub was hosed.

The fix, odd as it is, is to reinstall grub to my boot partition. In my 
case nothing new would be written onto the boot partition, and nothign 
new would be written onto the / (root) partition, but the act of 
writting /dev/hda7 again causes the grub-install process to figure out 
what the new sector numbers are and set up the portion of grub on the 
/boot partition correctly.

Weird, but I guess it works. Makes me wonder...

Thanks,
Mark




More information about the Redhat-install-list mailing list