Subject: Re: Raid sollution wanted
To: None <port-i386@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: port-i386
Date: 04/09/2002 10:35:03
On Mon, 08 Apr 2002, Matthias Scheler wrote:
> can somebody recomment me a reasonable priced RAID 1 sollution for
> NetBSD-i386? I want to setup a system with a single mirrored disks.
> I would like to avoid raid(4) because booting from a mirrored disk
> is still not supported properly there (e.g. in "installboot").

Is installboot support for booting from raid really that important?
Even without it, you can set up a system with the following properties:

  * Two identical IDE disks on a cheap IDE controller.
  * Boots automatically from the first disk if both disks are working.
  * Boots automatically from the second disk if the first disk is
    missing.
  * Can boot from either disk via menu in mbr_bootsel.
  * Ordinarily boots to a setup with root, swap and everything else on raid
    partitions (via RAID_AUTOCONFIG).
  * Can boot to a non-raid disaster recovery system on either disk (via
    "boot -as").

Perhaps that would be good enough for you?

Here's approximately how to set it up:

  1) At the fdisk level, partition both disks to have identical
     NetBSD partitions.
  2) At the disklabel level, partition both disks to have a small "a"
     partition of type 4.2BSD, and a large "e" partiion of type RAID,
     as well as the usual "c" and "d" partitions.  The "a" partitions
     will each contain boot blocks and kernels used for booting to the
     normal root-on-raid system, and will also contain a complete NetBSD
     system for disaster recovery.  The "e" partitions will be mirrored
     via radiframe and will contain everything except bootblocks for the
     normal running system.
  3) Install identical NetBSD systems on both "a" partitions, use installboot
     to make them both bootable, use "fdisk -B" to install menu entries
     for mbr_bootsel.
  4) Use raidctl to mirror the two "e" partitions on the raw disks,
     creating a raid0 virtual disk.  Use "raidctl -A root raid0"
     to mark raid0 as being eligible for booting with root-on-raid.
  5) Disklabel raid0 appropriately.  In normal use, raid0a will be
     the root partition and raid0b will be the swap partition.
  6) Install a complete NetBSD system that will run with root on raid0a.
  7) Ensure that you have identical kernels in these three places:
     root directories of "a" partitions of both raw disks (used during
     normal boot and for disaster recovery), and root directory of
     raid0a (not used during boot, but used by kmem grovellers during
     normal operation).

And to use it:

  * For normal use, everything is automatic.  The BIOS finds both raw
    disks, and boots mbr_bootsel from the first disk. mbr_bootsel
    displays a menu, and soon times out and takes the default (which is
    to boot NetBSD). mbr_bootsel loads the boot blocks from wd0a.  The
    boot blocks display a menu and soon time out and take the default
    action, which is to boot the kernel named "netbsd" from wd0a.  The
    boot blocks load teh kernel from wd0a.  The kernel autoconfigures
    the raid mirror and sets root on raid0a.

  * For disaster recovery, you can do one or more of the following:
    Disconnect one of the physical drives (and let the BIOS load
    mbr_botosel from the other drive); Ask mbr_bootsel on the first
    drive to load mbr_bootsel from the second drive (and then ask
    mbr_bootsel from the second drive to load the bootblocks from the
    second drive); Ask the bootblocks to boot with the "-as" flags (and
    then when the kernel pronpts for a root partition, tell it wd0a
    instead of raid0a).

--apb (Alan Barrett)