|
From: | Carl Karsten |
Subject: | Re: software raid1 |
Date: | Mon, 27 Mar 2006 20:11:35 -0600 |
User-agent: | Thunderbird 2.0a1 (Windows/20060326) |
Marco Gerards wrote:
Carl Karsten <address@hidden> writes:I have been messing around with software raid1 - mirroring 2 drives - including the boot sectors. The goal is to be able to remove either drive and still have a functioning system. I realize that this is "not supported" given that "Add support for software RAID" is on the http://grub.enbug.org/TodoList but I have heard it can be done with some trickery: install grub on both drives and rely on the fact that /dev/hda1 and /dev/hda2 and /dev/md0 are all "the same thing" as long as md0 is the only one that gets written to.RAID is more than just mirroring. You can have striping, a RAID setup with striping and a parity disk, etc. And besides that, even mirroring can do more advanced stuff. Like speeding up loading of kernels by loading from both disks and being more robust against broken disks. But I do not know if this can be realized.
Having everything would be great - but I think just achieving the simplest case of fault tolerance would be a very good return on investment.
I think I have achieved it by doing (search web again...) what someone did last year: http://www.linuxsa.org.au/mailing-list/2003-07/1270.html
My short version: 1. Basic Linux install: / and everything (therefor /boot) on hda1 (no raid) boot a live CD and run this script: #mkraid.sh # Change the partition type of hda1 to fd (raid autodetect) echo ,,fd,|sfdisk --force /dev/hda -N1 # Copy the partition table from hda to hdc: sfdisk --no-reread -d /dev/hda | sfdisk --no-reread --force /dev/hdc # Set up md device mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/hda1 /dev/hdc1 # Make hdc bootable: grub << EOF root (hd1,0) setup (hd1) EOFThis runs. I think it even works. I have installed Ubuntu-server 3 times today. I lost count of how many times I have run various versions of the script. I currently boot a live CD - I haven't figured out how to do it on a 'running hda' even though it should let me. I also need a scipt line to change hda1 to md0.
grub Q: is the grub << EOF... the 'normal/best' way?Also, is there some way to display how grub has been configured? doing something like that and then rebooting the box to see if it worked doesn't seem 'best' - it is good to verify it works, but I would like something a bit more like: here is what is setup on hda and hdc: grub-display-setup-command
So I do all this, and now I can update md0/boot and the /boot on both /hda and hdc gets updated because of the raid, so normal booting of hda keeps working. if hda fails, I can just yank the cable and the box will boot from hdc. To replace the failed hda, move the hdc to hda, add a new hdc and run the script.
The "yank the cable" step is not quite as elegant as a raid card (which I am assuming will take hda off line if it start erroring) but given how easy it is to recover, seems worth the trouble.
Carl k
[Prev in Thread] | Current Thread | [Next in Thread] |