[lug] SW Raid question

Hugh Brown hugh at math.byu.edu
Tue Jul 24 17:14:57 MDT 2007


dio2002 at indra.com wrote:
>> Re: grub
>> I don't remember if I had time to test this (short downtime), but these
>> are the notes I had (borrowing from
>> http://deb.riseup.net/storage/software-raid/)
>>
>> ----------------------------------
>> grub> find /grub/stage1
>>
>> # should spit out (hd0,0) (hd1,0)
>>
>> Grub>device (hd0) /dev/sdb (/dev/hdb for ide)
>> Grub>root (hd0,0) and then:
>> Grub>setup (hd0)
>>
>> # Notice that we made the second drive device 0.  Why is that you ask?
>> Because device 0 is going to be the one with mbr on the drive so passing
>> these commands to grub temporarily puts the 2nd mirror drive as 0 and will
>> put a bootable mbr on the drive and when you quit grub you still have the
>> original mbr on sda and will still boot to it till it is missing from the
>> system.
> 
> So here's the alternate method i've found online as well:
> 
> # grub
> grub> root (hd0,0) --> setup first disk
> grub> setup (hd0)
> grub> root (hd1,0) --> setup second disk
> grub> setup (hd1)
> 
> which i think is shorthand for the other method.  if this example is
> correct, that device command in the first example (and many examples i see
> online) is only there to make your life easier on the grub command line
> and serves purely as an alias.  it does NOT have anything to do with how
> the bios looks at the drive on boot.  and in fact, neither does the root
> command if the second example is correct because that second drive would
> become hd0 on reboot!  which means that first example is really misleading
> as to what grub really is doing behind the scenes.  even though the first
> example still works.  i've looked at the grub manual and it looks like
> device is purely an alias as i described above.  but the root which is a
> front end to the grub install command is a little unclear as to how that
> relates to bios ordering if at all.
> 
>> If your first disk fails, however, your second disk will then be the first
>> disk in the system, and so the MBR will be correct.
> 
> where this gets confusing is if you want to configure the boot menu for
> each drive to boot the opposite disk when both mirrors are up.  That's
> kind of silly in a mirrored situation however because it's not likely you
> ever need it if you configure the boot loader to boot each drive upon
> failover as described above.
> 

In the hopes of making this easier to discuss  /dev/sda is disk1 and 
/dev/sdb is disk2.

To my eye, these two examples are different.  In the first example, you 
tell grub, "I know sdb/disk2 looks like hd1, but humor me, I want to 
call it hd0.  Please install all the files as if it were hd0"

In your example, it installs the mbr on disk1 as hd0 and the mbr on 
disk2 as hd1.  As you noted, when disk1 disappears, grub tries to boot 
from mbr on disk2, finds out that it is supposed to look for hd1, can't 
find it and drops you to a grub shell.

I think your example lets you boot from either disk.  My example is 
built for being able to boot from a broken mirror when disk1 disappears 
and disk2 becomes sda/hd0

I think I'll try it out in vmware and see what happens.

Hugh



More information about the LUG mailing list