All of lore.kernel.org
 help / color / mirror / Atom feed
* software raid1
@ 2006-03-22  0:43 Carl Karsten
  2006-03-22  2:56 ` [OFFTOPIC] " Tomáš Ebenlendr
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Carl Karsten @ 2006-03-22  0:43 UTC (permalink / raw)
  To: grub-devel

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [OFFTOPIC] Re: software raid1
  2006-03-22  0:43 software raid1 Carl Karsten
@ 2006-03-22  2:56 ` Tomáš Ebenlendr
  2006-03-22  8:49 ` Marco Gerards
  2006-03-22 16:16 ` Peter Jones
  2 siblings, 0 replies; 12+ messages in thread
From: Tomáš Ebenlendr @ 2006-03-22  2:56 UTC (permalink / raw)
  To: The development of GRUB 2

I marked this offtopic, as this has nothing to do with grub2 development...

On 22 Březen 2006, 1:43, Carl Karsten napsal(a):
> 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 think so. (You must instruct grub that your (hd0) is /dev/md0, and
then do everything like there was only one drive.)


> 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

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)

-- 
                                            Tomas 'Ebi' Ebenlendr
                                            http://get.to/ebik




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-22  0:43 software raid1 Carl Karsten
  2006-03-22  2:56 ` [OFFTOPIC] " Tomáš Ebenlendr
@ 2006-03-22  8:49 ` Marco Gerards
  2006-03-28  2:11   ` Carl Karsten
  2006-03-22 16:16 ` Peter Jones
  2 siblings, 1 reply; 12+ messages in thread
From: Marco Gerards @ 2006-03-22  8:49 UTC (permalink / raw)
  To: The development of GRUB 2

Carl Karsten <carl@personnelware.com> 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.

> 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




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-22  0:43 software raid1 Carl Karsten
  2006-03-22  2:56 ` [OFFTOPIC] " Tomáš Ebenlendr
  2006-03-22  8:49 ` Marco Gerards
@ 2006-03-22 16:16 ` Peter Jones
  2006-03-28 20:53   ` software raid1 grub patches Carl Karsten
  2 siblings, 1 reply; 12+ messages in thread
From: Peter Jones @ 2006-03-22 16:16 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, 2006-03-21 at 18:43 -0600, Carl Karsten wrote:
> 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.

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.

> 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.)

-- 
  Peter




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-22  8:49 ` Marco Gerards
@ 2006-03-28  2:11   ` Carl Karsten
  2006-03-28  5:20     ` Carl Karsten
  0 siblings, 1 reply; 12+ messages in thread
From: Carl Karsten @ 2006-03-28  2:11 UTC (permalink / raw)
  To: The development of GRUB 2

Marco Gerards wrote:
> Carl Karsten <carl@personnelware.com> 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)
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



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-28  2:11   ` Carl Karsten
@ 2006-03-28  5:20     ` Carl Karsten
  2006-03-28 11:29       ` Tomáš Ebenlendr
  0 siblings, 1 reply; 12+ messages in thread
From: Carl Karsten @ 2006-03-28  5:20 UTC (permalink / raw)
  To: The development of GRUB 2

Carl Karsten wrote:
> Marco Gerards wrote:
>> Carl Karsten <carl@personnelware.com> 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)
> EOF
> 
> This 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



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-28  5:20     ` Carl Karsten
@ 2006-03-28 11:29       ` Tomáš Ebenlendr
  2006-03-28 22:47         ` Peter Jones
  0 siblings, 1 reply; 12+ messages in thread
From: Tomáš Ebenlendr @ 2006-03-28 11:29 UTC (permalink / raw)
  To: The development of GRUB 2


> 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

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.

-- 
                                            Tomas 'Ebi' Ebenlendr
                                            http://get.to/ebik




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1 grub patches
  2006-03-22 16:16 ` Peter Jones
@ 2006-03-28 20:53   ` Carl Karsten
  2006-03-28 22:45     ` Peter Jones
  0 siblings, 1 reply; 12+ messages in thread
From: Carl Karsten @ 2006-03-28 20:53 UTC (permalink / raw)
  To: The development of GRUB 2

> 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 <jason@debian.org>  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



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1 grub patches
  2006-03-28 20:53   ` software raid1 grub patches Carl Karsten
@ 2006-03-28 22:45     ` Peter Jones
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Jones @ 2006-03-28 22:45 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, 2006-03-28 at 14:53 -0600, Carl Karsten wrote:
> > 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 <jason@debian.org>  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?

-- 
  Peter




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-28 11:29       ` Tomáš Ebenlendr
@ 2006-03-28 22:47         ` Peter Jones
  2006-03-29  5:48           ` Tomáš Ebenlendr
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Jones @ 2006-03-28 22:47 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, 2006-03-28 at 13:29 +0200, Tomáš Ebenlendr wrote:
> > 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
> 
> 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.

-- 
  Peter




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-28 22:47         ` Peter Jones
@ 2006-03-29  5:48           ` Tomáš Ebenlendr
  2006-03-31  9:54             ` Marco Gerards
  0 siblings, 1 reply; 12+ messages in thread
From: Tomáš Ebenlendr @ 2006-03-29  5:48 UTC (permalink / raw)
  To: The development of GRUB 2


> ... 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...

-- 
                                            Tomas 'Ebi' Ebenlendr
                                            http://get.to/ebik




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: software raid1
  2006-03-29  5:48           ` Tomáš Ebenlendr
@ 2006-03-31  9:54             ` Marco Gerards
  0 siblings, 0 replies; 12+ messages in thread
From: Marco Gerards @ 2006-03-31  9:54 UTC (permalink / raw)
  To: The development of GRUB 2

Tomáš Ebenlendr <ebik@drak.ucw.cz> writes:

>> ... 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...

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




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-03-31  9:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-22  0:43 software raid1 Carl Karsten
2006-03-22  2:56 ` [OFFTOPIC] " Tomáš Ebenlendr
2006-03-22  8:49 ` Marco Gerards
2006-03-28  2:11   ` Carl Karsten
2006-03-28  5:20     ` Carl Karsten
2006-03-28 11:29       ` Tomáš Ebenlendr
2006-03-28 22:47         ` Peter Jones
2006-03-29  5:48           ` Tomáš Ebenlendr
2006-03-31  9:54             ` Marco Gerards
2006-03-22 16:16 ` Peter Jones
2006-03-28 20:53   ` software raid1 grub patches Carl Karsten
2006-03-28 22:45     ` Peter Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.