Subject: Re: RAIDframe bootability
To: Chris Jones <chris@cjones.org>
From: Luke Mewburn <lukem@wasabisystems.com>
List: current-users
Date: 01/18/2001 09:34:18
On Wed, Jan 17, 2001 at 02:31:10PM -0700, Chris Jones wrote:
> Do our kernels understand having the root filesystem on a raid device?
> I know the raid(4) man page says it only works on alpha and pmax, but
> various things are making me start to question if that's true.  Like
> the article on configuring RAIDframe which is mentioned in the gallery
> on the web site.

As Greg mentioned, a few platforms support booting off RAID-1 mirrored
sets:
	alpha
	i386	(see below)
	pmax
	vax (?)

In all cases, the bootblocks have been modified to check if the
partition in the NetBSD disklabel is of type `RAID', and if so,
look another 64 sectors (?) into the partition and see if you can
find a valid partition of a supported type (e.g, `4.2BSD', `lfs',
...).  This is probably a 2 line change.

Then the bootblocks load the kernel from the partition as per normal.
Once the kernel initialises everything, it needs to load its root
partition. Now, the booted partition is of type `RAID', so this won't
work unless you either hack the kernel's mountroot, or take the easier
solution of using the RAID_AUTOCONFIG kernel option, and running
	raidctl -A root
on your root partition.

i386 is a special case. The bootblocks (the primary boot in the master
boot record (MBR), and the `/boot' secondary loader) support the
trick described above regarding taking into account the 64 sectors
that a `RAID' disklabel entry has, to find the real partition.

HOWEVER, installboot(8) currently doesn't know how to install the
secondary boot loader /boot on to raid0a, and then modify the block
offsets in the primary boot loader in the MBR on the underlying
device (e.g, wd0c). So you need a workaround.

My current workaround is to partition my underlying disks something
like this:

	#        size   offset     fstype   [fsize bsize   cpg]
	  a: 59935680   100800       RAID
	  c: 60036417       63     unused        0     0
	  d: 60036480        0     unused        0     0
	  h:   100737       63     4.2BSD     1024  8192    32

My raid config consists of something like:
	START array
	1 2 0

	START disks
	/dev/wd0a
	/dev/wd1a

	START layout
	128 1 1 1

	START queue
	fifo 100

And raid0 disklabel looks something like:
	#        size   offset     fstype   [fsize bsize   cpg]
	  a: 59935616        0     4.2BSD     1024  8192    64
	  d: 59935616        0     unused        0     0

As you can see, raid0a is at the start of the raid set, which means
it's 64 sectors offset from the start of wd0a.

So, now you copy NetBSD onto the raid set, and to install the
boot blocks you'd use:
	installboot /usr/mdec/biosboot.sym /dev/wd0h
and it should DTRT.


Luke.

(I've been intending to write an article for a while on how to
setup a raidframe mirror to boot from. More on this later...)