Need Help Editing Grub

kitepilot at kitepilot.com kitepilot at kitepilot.com
Mon Jan 25 07:53:02 MST 2010


Man, what a stir...   :)
After I (sort-of) did read all the posts, I want to try to clear up some 
things.
Now, I am not GRUB expert, DON'T SUE ME! 

Grub sees the drives in the order they are reported by the BIOS.
When you install Grub, it doesn't register which drive (as reported by the 
BIOS) it was installed on. 

All Grub cares about, is that menu.lst (not validated by Grub) and the 
appropriate "stage files" are present at installation time, because somehow 
(not sure of this) the location of the "stage files" will be written into 
the boot record. 

When you run Grub, all it does is:
root (hd?,?)
learn about which partition of which drive to write the boot record to. 

setup(hd?)
AHA!, go see if menu.lst and the "stage files" are present and write me a 
boot record. 

quit (without period  :)
Done... 

Now, at boot time the BIOS will follow up its boot sequence until it happens 
to find a bootable MBR. 

If than MBR happens to be the one we created previously, Grub will find 
menu.lst and the "stage files" on the partition specified beforehand (above) 
and load them.
I'm not sure how Grub finds menu.lst, but I know that Grub has to have 
built-in support for whatever filesystem you are booting from. 

menu.lst has to match its directives (hd?,?) to whatever hd? matches the 
current BIOS table, and '?' to whatever partition holds the kernel and/or 
initrd to boot from, or they won't be found. 

Now, as someone said, there some 20 dozens of ways to create the boot 
record, all of them are variants of the previous procedure, the result is 
the same, and Grub couldn't care less at boot time about how the MBR it is 
using was created.
In other words, the boot sequence will be the same regardless of how you got 
the MBR to be written. 

In Mike's case, as someone said, we had to either create a boot record to 
hd1 (the HD we will boot from after butchering the puter) or butch the puter 
and boot from a CD to install Grub to a new (and un-bootable hd0)
Clear as mud?   :)
Again, YMMV...
ET 

PS: On the lighter side, some unwanted wisdom:
The bad part of getting married is the honeymoon.
The worst comes later... 

 


kitepilot at kitepilot.com writes: 

>>> is there perhaps, a typo?
> No, it's not a typo!
> The drive is still hd1 until you pull the old one.
> Grub doesn't know about which drive, the BIOS tell it to.
> Once you pull the M$ drive and flip the cables, GRUB will see it as hd0.
> ET  
> 
>   
> 
> Mark Phillips writes:  
> 
>> I understand the flow....shouldn't I tell grub somehow that the new boot
>> drive is hd0,0? In your steps below, is there perhaps, a typo?  
>> 
>> Thanks!  
>> 
>> Mark  
>> 
>> On Sun, Jan 24, 2010 at 3:58 PM, kitepilot at kitepilot.com <
>> kitepilot at kitepilot.com> wrote:  
>> 
>>> >> 1. How do I change grub on the Linux drive (hdb) to say "the ...
>>> If you are running GRUB 0.XX (GRUB 1.XX is different):
>>> Boot your Debian machine and as root run:
>>> grub
>>> root (hd1,0)
>>> root (hd1)
>>> It should answer that it found the stages, verify that there are no errors.
>>> quit  
>>>
>>>
>>> Then take a backup of /boot/grub/menu.lst and and make sure that everything
>>> is either using UUID(s) or labels or every reference to hd1,0 is converted
>>> to hd0,0  
>>>
>>> Verify your /etc/fstab likewise.  
>>>
>>>
>>> > 2. Do I move the second drive to the first ide port, or leave it as ...
>>> Shutdown, pull the cable from the windoze drive and plug it to Linux drive.
>>> Turn on and pray...   :)
>>> Free advice, you can't sue me   ;-)
>>> YMMV
>>> ET  
>>>
>>>  
>>>
>>>
>>> Mark Phillips writes:  
>>>
>>> > I have two ide drives in one machine - drive 1 is a Windows drive and
>>> drive
>>> > 2 is a Linux drive. Using grub, I can boot into either windows or debian.
>>> I
>>> > want to remove the windows drive and replace it with a larger, blank
>>> drive
>>> > for backup storage. I have a feeling if I just remove the first drive and
>>> > put the new one there, the machine will not boot, since the MBR is
>>> probably
>>> > on the first drive (it came with the machine, and I just added the second
>>> > drive for Linux). My questions:
>>> >
>>> > 1. How do I change grub on the Linux drive (hdb) to say "the windows
>>> drive
>>> > is dead, boot here instead, long live linux"?
>>> >
>>> > 2. Do I move the second drive to the first ide port, or leave it as the
>>> > second ide drive and put the new drive in the fist ide port?
>>> >
>>> > Thanks!
>>> >
>>> > Mark
>>> ---------------------------------------------------
>>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
>>> To subscribe, unsubscribe, or to change your mail settings:
>>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss  
>>>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list