Subject: Re: port-i386/28588
To: None <hubertf@NetBSD.org>
From: Havard Eidnes <he@NetBSD.org>
List: netbsd-bugs
Date: 12/15/2006 12:25:44
Hi,

seeing this PR reminded me that the procedure as stated in the
NetBSD guide is horribly complicated -- more so than it needs to
be, with "failing a component" and all that stuff.

Here is the procedure I have used when installing NetBSD/i386 on
a mirrored set of 2 disks, admittedly with 3.0, but I think it
should work for 2.0 as well as long as it has support for booting
from a mirrored raid set.

The procedure I used requires some use of tools outside of
sysinst before sysinst is run, and a bit of manual calculation
(for partition sizes), but is conceptually straight-forward:

1) boot NetBSD from boot media, typically CD-ROM

2) Initialize NetBSD fdisk partitions on the two drives, in my
   case the two drives are wd0 and wd1:

   fdisk -a -i -u -B wd0

   I used "entire drive, save the 63 first sectors, made the
   NetBSD partition the active partition, used mbr_bootsel, and
   used NetBSD-0 as the menu entry, boot from first active
   partition.

   Repeat for wd1, I used NetBSD-1 there.

3) Put a disklabel on both drives:

   Use "disklabel wd0" to get the "default" label and see the
   total size, in my case 156312576 sectors, and initialize +
   edit the label:

   disklabel -I -e wd0

   I used:

   a: 156312513    63     RAID

   and let "c" cover the same area and "d" the entire disk.

   Repeat for wd1.

4) Make a configuration file for raidframe:

   ed /etc/raid.conf
   a
   START array
   # numRow numCol numSpare
   1 2 0

   START disks
   /dev/wd0a
   /dev/wd1a

   START layout
   # sectPerSU SUsPerParityUnit SUsPerReconUnit RAID_level_1
   64 1 1 1

   START fifo
   fifo 100
   .=

   w
   q

   (Indented for readability here.)

5) Configure the raid set, and set it to auto-config and
   root-on-raid:

   raidctl -C /etc/raid.conf raid0
   raidctl -I 4711 raid0
   raidctl -i raid0
   raidctl -A yes raid0
   raidctl -A root raid0

6) Optional, check parity regeneration status:

   raidctl -S raid0

   You may interrupt the display with ^C.

7) Use sysinst to install NetBSD to the newly configured raid0
   raid set in the normal manner.  Sysinst should list raid0 as a
   usable drive.

   sysinst

8) Install the NetBSD boot code on rwd0a and rwd1a.  Sysinst has
   not left any boot code there, only inside raid0, and this is
   required to be able to boot from the raid set:

   installboot -v -o console=3Dcom0,timeout=3D10 /dev/rwd0a /usr/mdec/b=
ootxx_ffsv1
   installboot -v -o console=3Dcom0,timeout=3D10 /dev/rwd1a /usr/mdec/b=
ootxx_ffsv1

9) Remove boot media, reboot the system, and ensure that the
   following is either part of the defaults or is placed in
   rc.conf:

   # Allow clean raid unconfigure on shutdown
   swapoff=3DYES

And you're done.

None of that complicated "artificially fail one component,
restore to new" stuff required.

Ideally, sysinst should be taught to guide the user through this
process.

Best regards,

- H=E5vard