[lug] SW Raid question

Hugh Brown hugh at math.byu.edu
Tue Jul 24 21:23:03 MDT 2007


So I learned a bit more.  device (hd0) /dev/sdb really seems to mean, 
"while in this grub session anytime I say hd0 write it to /dev/sdb 
instead of whatever you thought hd0 was before"  So, you both were right.

Here are the notes of the steps/results from my experiment.

------------------------------------------
CentOS4.4 Minimal install
Two vmdk's (vmware disks) SCSI 0:0 (sda) and SCSI 0:1 (sdb)
grub is version 0.95

/boot on /dev/md0 (comprised of /dev/sda1 /dev/sdb1)
/dev/md1 is LVM Volume00 with swap and / (comprised of /dev/sda2 /dev/sdb2)

dd if=/dev/sda bs=512 count=1 of=disk1-mbr.postinstall
dd if=/dev/sdb bs=512 count=1 of=disk2-mbr.postinstall
diff disk*
Binary files differ

shutdown, removed SCSI 0:0 (sda), it still booted

Added SCSI 0:0 back
mdadm --add /dev/md0 /dev/sda1

grub
grub>device (hd0) /dev/sdb
grub>root (hd0,0)
grub>setup (hd0)

dd if=/dev/sdb bs=512 count=1 of=disk2-mbr.device-hd0

diff disk2-mbr.postinstall disk2-mbr.device-hd0
Binary files differ

shutdown
remove SCSI 0:0
it still boots, sees SCSI 0:1 as sda

shutdown
add back SCSI 0:0
mdadm --add /dev/md0 /dev/sda1

grub
grub> root (hd1,0)
grub> setup (hd1)

dd if=/dev/sdb bs=512 count=1 of=disk2-mbr.root-hd1

diff disk2-mbr.root-hd1 disk2-mbr.device-hd0
no difference

diff disk2-mbr.root-hd1 disk2-mbr.postinstall
Binary files differ

shutdown
remove SCSI 0:0
boots fine sees SCSI 0:1 as sda

488637815ba18402bf7730e37ecc1b72  disk1-mbr.postinstall
488637815ba18402bf7730e37ecc1b72  disk2-mbr.device-hd0
662b4a33df175a60d9ed4c16b5f1eba0  disk2-mbr.postinstall
488637815ba18402bf7730e37ecc1b72  disk2-mbr.root-hd1

So the disk2 mbr post install is the only one that's different.

Difference at offsets 0x01b8 0x01b9 and 0x01ba

24 25 07 for the disk2 postinstall
23 b0 06 for the others

-----------------------------------
Conclusions:  If you set up sw raid outside of the installer, make sure 
grub bits get installed to the mbr of all drives used.  If you do set up 
your machine with sw raid at install time, the drive will have the right 
grub bits.  If a disk fails, as part of adding it back in, make sure you 
put the grub bits back.

I have no idea what is going on at those three offsets.

Hugh



More information about the LUG mailing list