software raid1
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.
I did run into one problem: if you have ide master and slave, and you pull the master, the slave dissapears and the box/bios won't see it so it won't boot from it. so I am guessing I have to make each drive the master on a seperate ide bus so that pulling one won't take out the other.
Before I spend too much time trying to make this work, anyone know of a HowTo that outlines this?
CarlFK
I marked this offtopic, as this has nothing to do with grub2 development...
On 22 Březen 2006, 1:43, Carl Karsten napsal(a):
Quoted 6 lines
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.
Quoted 8 lines
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/hda1and/dev/hda2and/dev/md0are all "the same thing" as long as md0 is
the only one that gets written to.
I think so. (You must instruct grub that your (hd0) is /dev/md0, and then do everything like there was only one drive.)
Quoted 8 lines
I did run into one problem: if you have ide master and slave, and you pull the
master, the slave dissapears and the box/bios won't see it so it won't boot from
it. so I am guessing I have to make each drive the master on a seperate ide bus
so that pulling one won't take out the other.
Quoted 5 lines
Before I spend too much time trying to make this work, anyone know of a HowTo
that outlines this?CarlFK
As the RAID HOWTO says: if you have 2 IDE discs in raid on one IDE bus, it is likely the fault of master drive causes data fault of slave. So you should use 2 IDE buses anyway. (Otherwise you have same fault-tolerancy as with one drive and no RAID.)
(here are hw issues: http://www.tldp.org/HOWTO/Software-RAID-HOWTO-4.html)
Signature · 2 lines
Tomas 'Ebi' Ebenlendr
http://get.to/ebikQuoted 10 lines · Carl Karsten
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/hda1and/dev/hda2and/dev/md0are all "the same thing" as long as md0 is the only one that gets written to.
Quoted 4 lines
I did run into one problem: if you have ide master and slave, and you pull the master, the slave dissapears and the box/bios won't see it so it won't boot from it. so I am guessing I have to make each drive the master on a seperate ide bus so that pulling one won't take out the other.
If you swap the drives, you can boot the second one. Sometimes this is possible with only a BIOS change, sometimes you have to re-cable them. Depends on your BIOS.
It should be possible, if they're both bootable in the BIOS, to install grub on the MBR of each half, and then swapping the drives shouldn't be required, you'd just have to make BIOS boot the second (or, rather, non-failed) disk.
Quoted 2 lines
Before I spend too much time trying to make this work, anyone know of a HowTo that outlines this?
Not exactly -- I've got patches for GRUB Legacy's grub-install if you're interested in looking at them. They're in the Fedora grub package, or I can mail them to you if you need.
(Also, if Marco or Yoshinori are interested in such a patch for Legacy, I could prepare it for submission upstream.)
Signature · 1 line
Peter
Quoted 9 lines · Carl Karsten
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/hda1and/dev/hda2and/dev/md0are 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.
Quoted 8 lines
I did run into one problem: if you have ide master and slave, and you pull the master, the slave dissapears and the box/bios won't see it so it won't boot from it. so I am guessing I have to make each drive the master on a seperate ide bus so that pulling one won't take out the other.
Before I spend too much time trying to make this work, anyone know of a HowTo that outlines this?
Just do not use GRUB 2. :)
--
Marco
Quoted 12 lines · Marco Gerards
Quoted 9 lines · Carl Karsten
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/hda1and/dev/hda2and/dev/md0are all "the same thing" as long as md0 is the only one that gets written to.
Quoted 7 lines
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)
EOF
This 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
Quoted 42 lines · Carl Karsten
Quoted 12 lines · Marco Gerards
Quoted 9 lines · Carl Karsten
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/hda1and/dev/hda2and/dev/md0are all "the same thing" as long as md0 is the only one that gets written to.Quoted 7 lines
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
Quoted 7 lines
# Make hdc bootable:
grub << EOF
root (hd1,0)
setup (hd1)
EOFThis runs. I think it even works.
I was wrong.
md0 is hda1 + hdc1, but even after changing boot/grub/menu.lst and fstab entries from hda1 to md0, hda1 still gets mounted on /, but RO and then nothing works. when I boot to a live CD, it looks like md0 should go, but I am missing somehting.
btw - "I also need a scipt line to change hda1 to md0." is for manu.lst and fstab. suggestions welcome.
I am starting on step 1 once again.
Carl
Quoted 7 lines
I was wrong.
md0 is hda1 + hdc1, but even after changing boot/grub/menu.lst and fstab entries from hda1 to md0, hda1 still gets mounted on /, but RO and then nothing works. when I boot to a live CD, it looks like md0 should go, but I am missing somehting.
Quoted 6 lines
btw - "I also need a scipt line to change hda1 to md0." is for manu.lst and fstab. suggestions welcome.
I am starting on step 1 once again.
Carl
Hmm, I think that software raid should be setuped before it is used. If it is so, you need initramdisk. Search for "RAID root", there should be some howto.
Signature · 2 lines
Tomas 'Ebi' Ebenlendr
http://get.to/ebikRe: software raid1 grub patches
In reply to Peter JonesQuoted 3 lines
Not exactly -- I've got patches for GRUB Legacy's grub-install if you're interested in looking at them. They're in the Fedora grub package, or I can mail them to you if you need.
looks like I have it:
http://changelogs.ubuntu.com/changelogs/pool/main/g/grub/grub_0.97-1ubuntu8/changelog
grub (0.95+cvs20040624-14) unstable; urgency=low
* update-grub: add support for raid1
(closes: #292274)
-- Jason Thomas <[email protected]> Fri, 4 Feb 2005 13:28:53 +1100
Any idea how I tell if that is your patch?
juser@yate1:~/yate$ grub --version grub (GNU GRUB 0.97)
Carl K
Re: software raid1 grub patches
Quoted 10 lines · Carl Karsten
Quoted 3 lines
Not exactly -- I've got patches for GRUB Legacy's grub-install if you're interested in looking at them. They're in the Fedora grub package, or I can mail them to you if you need.
looks like I have it:
http://changelogs.ubuntu.com/changelogs/pool/main/g/grub/grub_0.97-1ubuntu8/changelog
grub (0.95+cvs20040624-14) unstable; urgency=low
Quoted 8 lines
* update-grub: add support for raid1
(closes: #292274)-- Jason Thomas <[email protected]> Fri, 4 Feb 2005 13:28:53 +1100
Any idea how I tell if that is your patch?
Pull it apart and see if it's the same code?
Signature · 1 line
Peter
Quoted 9 lines · Tomáš Ebenlendr
Quoted 9 lines
I was wrong.
md0 is hda1 + hdc1, but even after changing boot/grub/menu.lst and fstab entries from hda1 to md0, hda1 still gets mounted on /, but RO and then nothing works. when I boot to a live CD, it looks like md0 should go, but I am missing somehting.btw - "I also need a scipt line to change hda1 to md0." is for manu.lst and fstab. suggestions welcome.
Quoted 7 lines
Quoted 3 lines
I am starting on step 1 once again.
Carl
Hmm, I think that software raid should be setuped before it is used. If it is so, you need initramdisk. Search for "RAID root", there should be some howto.
... but grub loads the kernel and the ramdisk, and then the kernel executes the ramdisk. The RAID has to work (for reads, anyway) before then.
Signature · 1 line
Peter
Quoted 7 lines
... but grub loads the kernel and the ramdisk, and then the kernel executes the ramdisk. The RAID has to work (for reads, anyway) before then.
--
Peter
What do you mean work? Grub will read from one disk ignoring it is in RAID1, in this case. And I don't know current implementation of raid now, but there was implementation where one must say to kernel by script (in ramdisk) which partition is joint whith wich... But now there might be some autodetection...
Signature · 2 lines
Tomas 'Ebi' Ebenlendr
http://get.to/ebikQuoted 4 lines · Tomáš Ebenlendr
Quoted 4 lines
... but grub loads the kernel and the ramdisk, and then the kernel executes the ramdisk. The RAID has to work (for reads, anyway) before then.
Quoted 8 lines
Quoted 2 lines
--
PeterWhat do you mean work? Grub will read from one disk ignoring it is in RAID1, in this case. And I don't know current implementation of raid now, but there was implementation where one must say to kernel by script (in ramdisk) which partition is joint whith wich... But now there might be some autodetection...
RAID is more than just RAID1. Actually RAID1 is not that used that much in practise I think. Most setups I have seen are either RAID0 or RAID5.
--
Marco