Subject: grub vs. raidframe
To: None <>
From: Jeff Rizzo <>
List: port-xen
Date: 11/02/2005 14:34:18
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I recently had occasion to want to run Xen on a system with mirrored
root disks (mmm, RAIDframe), and whereas a message from around a year
ago hinted at how to do it, the details were left as an exercise to
the reader.  Since I've just gone and done it, I thought I'd share
the recipe here for the enlightenment of others in the same boat.
(and also because I'm likely to forget details myself!)

I started with a NetBSD system with two disks, wd0 and wd1, in a RAID1
configuration.  (for details how to set this up, see the NetBSD guide)
The RAID partition on each disk was the 'a' partition:

 a:  39102273        63       RAID                     # (Cyl.      0*-  38=

=46rom the message last year, I knew that I'd need to create an overlapping
partition offset by 63 plus RF_PROTECTED_SECTORS (64), for GRUB to look at.
I did this on partition 'f':

 f:  37005056       127     4.2BSD   1024  1024 46608  # (Cyl.      0*-  36=

(f is the same size as my raid0a partiton, offset by 127 sectors from the
beginnning of the disk)

The tricky part was figuring out how to actually _install_ grub - as Thor
noted in his message, grub-install _insists_ on trying to use raid0a,
even when given rwd0d, so I had to use the grub shell by hand.  First,
I created /grub , and populated it with the various stage* files.  Then,
I created /grub/menu.lst with enough to chainload a netbsd kernel:

# menu.lst
serial --unit=3D0 --speed=3D9600 --word=3D8 --parity=3Dno --stop=3D1
terminal --timeout=3D10 serial console
# for now, just chainload NetBSD
title NetBSD chain
  root          (hd0,0)
  chainloader +1
# GRUB native netbsd
title NetBSD GRUB
  root          (hd0,f)
  kernel --type=3Dnetbsd /netbsd

(I added the "GRUB native" because in one of my iterations, I accidentally
overwrote the NetBSD bootblock in wd0f with GRUB, so chainloading was
a bit... circular)

Then, I used the grub "shell" to install the bootblocks:

# grub --no-floppy

grub> root (hd0,f)
 Filesystem type is ffs, partition type 0xa9

grub> setup --stage2=3D/grub/stage2 --prefix=3D/grub (hd0)
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/ffs_stage1_5" exists... yes
 Running "embed /grub/ffs_stage1_5 (hd0)"...  14 sectors are embedded.
 Running "install --stage2=3D/grub/stage2 /grub/stage1 (hd0) (hd0)1+14 p (h=

)/grub/stage2 /grub/menu.lst"... succeeded

grub> quit


Once this is done, you should be able to boot /netbsd from the raid with
grub!  From there, it's simple enough to set up grub for Xen usage, as
per the Xen howto..

I hope this helps somebody else -=20


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.1 (NetBSD)