...a while back, i wrote a tutorial for RAIFRame RAID1 as a root FS on NetBSD. I used the "bootstrap" method. Sometime not soon after, NetBSD added RAIDFrame to the INSTALL* kernels and presumably menus to sysinst, mitigating the need for this approach.

the boostrap process is:

*) do a basic install on component0
*) use the base install to create a RAID set composed of a single member:
   component1
*) copy the system over
*) boot component1 in degraded mode
*) destory the original install on component0 and import it into RAID
*) sync component1 back to component0

...however, this is still the applicable process for OpenBSD, as OpenBSD INSTALL and GENERIC kernels lack RAIDFrame. moreover, the boot blocks lack support for booting RAID volumes, so there are some caveats

here are some notes for adapting the process:


Firstly, per:
http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=4567

  pseudo-device   raid            4       # RAIDframe disk driver
  option RAID_AUTOCONFIG

...must be added to GENERIC. They are not present. Update your src and re-roll your kernel.


16.3.3. Initial Install on Disk0/wd0

  for simplicity in the original tutorial, i recommend "one big slash"
  plus swap

  its important to note that although only a basic system is required on
  wd0/component0, you simplify the system bootstrap process by laying out
  the file system slices/mountpoints the way you plan on the eventual RAID
  volume (*even though* the sizes of slices will be different.)  see below


16.3.3. Initial Install on Disk0/wd0

  apparently /dev/{r,}wd[0-9] behave differently in obsd.  instead of:

# dd if=/dev/zero of=/dev/rwd1d bs=8k count=1

   one would use

# dd if=/dev/zero of=/dev/wd1c bs=8k count=1

   note: use the character device instead of the raw device

   ...or "disklabel -E wd1" and then "D" + "w", but this method won't blow
   away the MBR label.


        Next, instead of:

# fdisk -0ua /dev/rwd1d

        do:

# fdisk -i wd1

   and "y" at the prompt.

   next  instead of:

# disklabel -r -e -I wd1

        do:

# disklabel -E wd1

   or "-e" if you prefer $EDITOR style.  create your file systems as
   as you prefer.

   this is where it the process differs greatly.  in the netbsd tutorial,
   i suggest disklabel'ing each RAID1 component member disk entirely
   a "RAID" slice.

   for a number of reasons, this must differ on openbsd.  i recommend that
   each members "a:" slice be a 128mb 4.2BSD FFS slice.  i recommend "b:"
   be a RAID type slice the size of which the SWAP parition will be.  i
   recommend that "d:" be the remainder of the disk, type "RAID"

   this will be explained later


a d
offset: [1310400]
size: [25389630]
FS type: [4.2BSD] RAID
w
p m
device: /dev/rwd1c
type: ESDI
disk: ESDI/IDE disk
label: IBM-DPTA-371360
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total bytes: 13043.0M
free bytes: 0.0M
rpm: 3600

16 partitions:
#    size        offset  fstype [fsize bsize  cpg]
  a:  127.9M    0.0M 4.2BSD 2048 16384 16 # Cyl 0*- 259
  b:  511.9M    128.0M RAID # Cyl 260 - 1299
  c:  13043.0M  0.0M unused 0 0 # Cyl 0 - 26499
  d:  12397.3M  639.8M RAID # Cyl 1300 - 26488*


16.3.5. Initializing the RAID Device

    this step unchanged, except the magic "absent" keyword trick does not
    exist in raid.conf

    of course, raidctl -C [.conf] and raidctl -I will need to be run for
    raid0 and raid1.  -I should have different serials for each, so
    2005101801 for raid0 and 2005101801 for raid1.


16.3.6. Setting up Filesystems

   unchanged.  when disklabel(8)'ing raid0, "a:" can be offset 0, size of
   the entire meta-disk, type "swap"

   when disklabel(8)'ing raid1, "a:", "b:", "d:" -> "m:" can be your
   optimal slice configuration.  use the disklabel on wd0 as your
   reference.  however theres an offset because b: on wd0 was your
    original swap partition on your inital system, therefore map as so:

   wd0:  raid1:
   a:    a:
   d:    b:
   e:    d:
   f:    e:
   ...


   When newfs(8)'ing, raw devices must be used.  the following would need
   to be newfs(8)'d,  "-0" flag does not apply.

   /dev/rwd1a
   /dev/rraid1a
   /dev/rraid1b
   /dev/rraid1d
   /dev/rraid1e
   ....

   /dev/rraid0a will be swap and does not need to be newfs(8)'d


16.3.8. Migrating System to RAID

   two changes:

   instead of using pax(1) to recursivley copy "/" from the wd0 base
   install to a the FFS/UFS/4.2BSD slices on /dev/raid1, i recommend using
   dump(1)/restore(8) instead (because the work on the file system level)


if the base install looked something like:

# df
Filesystem  1K-blocks      Used     Avail Capacity  Mounted on
/dev/wd0a     1035440     38460    945208     4%    /
/dev/wd0g     2812608        12   2671966     0%    /home
/dev/wd0d     4125138   1285796   2633086    33%    /usr
/dev/wd0e     2062928      8086   1951696     0%    /var
/dev/wd0f     2062928        88   1959694     0%    /var/log

the the steps would be:

# mkdir /mnt/root
# mkdir /mnt/usr
# mkdir /mnt/var
# mkdir /mnt/varlog


# mount /dev/raid1a /mnt/root
# mount /dev/raid1b /mnt/usr
# mount /dev/raid1d /mnt/var
# mount /dev/raid1e /mnt/varlog

# dump -0 -f- / | (cd /mnt/root; restore -r -f-)
  DUMP: Date of this level 0 dump: Thu Oct 20 03:23:44 2005
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rwd0a (/) to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 39458 tape blocks.
  DUMP: Volume 1 started at: Thu Oct 20 03:23:45 2005
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: 39679 tape blocks
  DUMP: Volume 1 completed at: Thu Oct 20 03:23:57 2005
  DUMP: Volume 1 took 0:00:12
  DUMP: Volume 1 transfer rate: 3306 KB/s
  DUMP: Date of this level 0 dump: Thu Oct 20 03:23:44 2005
  DUMP: Date this dump completed:  Thu Oct 20 03:23:57 2005
  DUMP: Average transfer rate: 3306 KB/s
  DUMP: DUMP IS DONE

# dump -0 -f- /usr | (cd /mnt/usr; restore -r -f-)
# dump -0 -f- /var | (cd /mnt/var; restore -r -f-)
# dump -0 -f- /var/log | (cd /mnt/varlog; restore -r -f-)


   secondly, the boot block install process differs greatly. "boot" must
   exist on a file system that resides on the disk onto which it will be
   written, otherwise installboot(8) bombs out on a cross-disk install

# mkdir /antiraid && mount /dev/wd1a /antiraid
# cp /boot /antiraid
# cp /bsd /antiraid
# /usr/mdec/installboot -v ./boot /usr/mdec/biosboot wd1
boot: ./boot
proto: /usr/mdec/biosboot
device: /dev/rwd1c
/usr/mdec/biosboot: entry point 0
proto bootblock size 512
./boot is 3 blocks x 16384 bytes
fs block shift 2; part offset 63; inode block 24, offset 936
using MBR partition 3: type 166 (0xa6) offset 63 (0x3f)

# fdisk wd1
Disk: wd1       geometry: 1662/255/63 [26700030 Sectors]
Offset: 0       Signature: 0xAA55
         Starting       Ending       LBA Info:
 #: id    C   H  S -    C   H  S [       start:      size   ]
------------------------------------------------------------------------
 0: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
 1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
 2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused
*3: A6    0   1  1 - 1661 254 63 [          63:    26699967 ] OpenBSD



--------------------


The rest of the process reads like the tutorial. Except the steps for raid0 must also be taken for raid1.

Note: Because of the bootblock support for booting RAID, it is very important that /antiraid (either /dev/wd1a or /dev/wd0a) be mounted at all times. Both must contain an indentical kernel to that which resides in the "/" on raid1a. When you re-roll your kernel, you must remember to not only make install, but mount and unmount each and cp /bsd /antiraid/bsd


About the file system layout changes:

The basic premis behind this decision is as folllows:

 - openbsd boot blocks lack RAID boot support, so a small UFS/FFS/4.2BSD
   FS must exist on both components to hold [a copy of] /bsd and /boot
   (and optionally /boot.conf)

 - openbsd lacks a "-U" flag to swapctl(8), provided by /etc/rc.d/swap1 in
   netbsd via swap1_stop():

swap1_stop()
{
        if checkyesno swapoff || [ -n "$rc_force" ]; then
                echo "Removing block-type swap devices"
                swapctl -U -t blk
        fi
}

   ...there may be some other work-around to prevent proper swap cleanup
   at shutdown, however, to prevent the entire RAID parity status for
   being flagged as dirty in a non-standard shutdown event, "swap" should
   reside on it's own RAID composed of wd0b and wd1b

   the RAID composed of wd0d and wd1d, which comprise the "remainder" of
   free space, can be for all UFS/4.2BSD/FFS file systems

   this is just a recommendation.  pehaps someone can clarify on "-U".  i
   know for a fact if swapoff isn't called in NetBSD (and hence the need
   for "shutdown [-hp|-r" instead of reboot(8)), the RAID with swap on it
   will be flagged as dirty at every boot

l8r
~lava

Reply via email to