Weblog entry #1 for martijnvanb
- shutdown
- replace crashed harddisk
- boot machine
- sfdisk -d /dev/sda | sfdisk /dev/sdb
- mdadm --detail /dev/md0
- check partitions
- rebuild partitions with mdadm --add /dev/md0 /dev/sdb1
- check for other raid partitions
- check status with watch "cat /proc/mdstats"
After that it is finished I am ready for the next harddisk crash
Comments on this Entry
i presume you are replacing sdb (since you are mirroring the partition layout of sda onto sdb with sfdisk), but then you are adding sdc1, not sdb1, to the md0 raid array.
and why are you shutting down the machine? can't you hotswap? ;-) (i can't wait to build a new computer with a sata driver that supports hotswapping, as my last build was 4 years old and was before everybody standardized on AHCI; http://linux-ata.org/driver-status.html#matrix.)
[ Parent | Reply to this comment ]
I had a crash of sdb, and the disk was not hot swapable
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
that's the configuration i have: three partitions (sd[ab]1, sd[ab]5, sd[ab]6 => md0, md1, md2) for /boot, swap, and lvm. i've tried to think through how to configure grub to support booting off either drive, but i see a few problems (and haven't had time to experiment and work through it). since moving to this configuration 3 years ago, i've not had a boot disk failure, so i have no practical experience.
how do you configure grub to accommodate this?
grub stage1 config
1. i presume a standard "grub-install" won't be sufficient to write a unique stage1 on each drive so that it is instructed to look for the stage2 on the same drive (ie sda1 on sda & sdb1 on sdb). what's a working example for the grub shell?
grub stage2 config
2. don't forget to configure menu.lst to use "fallback", but how well does a "fallback" config integrate with "update-grub"?
and this is assuming that your drive fails in such a way that the disk controller totally ignores it or eventually gives up on it (instead of getting hung up trying to access it) and the BIOS boots from the remaining drive (not getting confused by potential disk renumbering).
i've had PATA drives fail in a variety of ways and i've had BIOSes react in a variety of ways. i have no experience with SATA drives failing and how SATA disk controllers respond. with PATA controllers i've always had the drive name (either "hd0,0" for grub or "hda" for linux) assigned according to the port it was plugged into (but that's because each physical port was directly associated with a specific controller, ie primary or secondary). i don't have enough experience with SATA to know how it should and/or does work in failure modes.
[ Parent | Reply to this comment ]
"i presume you mean that /boot is on raid1 (eg md0), which is still accessible as a normal partition (eg sda1), to grub's benefit."
More than just that, there's the actual MBR code that sits in the first sector of the "primary" disk ("primary" according to the BIOS).
"that's the configuration i have: three partitions (sd[ab]1, sd[ab]5, sd[ab]6 => md0, md1, md2) for /boot, swap, and lvm. i've tried to think through how to configure grub to support booting off either drive, but i see a few problems (and haven't had time to experiment and work through it). since moving to this configuration 3 years ago, i've not had a boot disk failure, so i have no practical experience.
how do you configure grub to accommodate this?"
AFAICT you can't use any of the automated grub tools, you have to do it from the grub command shell, but it's pretty straight forward. If you had your /boot on /dev/sda1 and /dev/sdb1 (both of which are in a RAID 1 array as something like /dev/md0), then you could type this in the grub shell:
device (hd0) /dev/sda
root (hd0,0)
setup (hd0)
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)If your disk is so borked that grub would be using the "redundant" copy of the MBR, grub will think that that disk is (hd0), which is why you need the device intructions, to fool the bootloader setup/installation routines into thinking that (at least while setting things up) each drives MBR is on "(hd0)". The rest should be pretty straight forward for anyone who's familiar with a grub menu.lst.
Cheers:wq
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]