[lug] SW Raid question

dio2002 at indra.com dio2002 at indra.com
Tue Jul 24 20:26:00 MDT 2007


> Hugh Brown wrote:
>> 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 guess I'm confused. It seems that you are saying that the block
> addresses
> that get written into the mbr have some kind of device specifier. I have
> moved
> a disk from sdb to sda where sdb was prepped using root (hd1,0) in grub.
> Booted the former sdb in the sda position just fine with only the one
> disk.
> Didn't even appear to look for an sdb device. I did adjust the root
> statement
> in grub.conf to (hd0,0), but did nothing to any device lines.

i think that's what i'm saying ;-).. and i think your test proves it.

note, i'm only extrapolating my hypothesis of how this works by walking
backwards from different examples on the net that supposedly create the
same end result and by looking at the grub manual.  and i'm taking the
word of users that post examples that the end results ARE actually the
same.

if so, when i logically reconstruct the examples working backwards, for
them to produce the same results means someone has been providing less
than accurate info about "why" it works or "what" it's doing.  now it gets
propagated across the net, kind of like an urban legend and gets assumed
as fact.  i'm prepared for you to prove me entirely wrong.  because i was
confused after a days search on the web by the differing methods all
producing the same results.




More information about the LUG mailing list