Sean's Musings as a Service

Sean's Musings as a Service

Using RAID in OpenBSD

  • Published:
  • categories: unix
  • tags: bsd, openbsd, raid, unix

Well anyone who is worth their oats is running raid right?

I guess that depends on your definition of anyone, what a bunch of nub sauces. Ok so it’s my first real attempt at doing it, I only have two disks and most of my media however much I may not think so right now is disposable.

Compile a new kernel since Theo leaves raid out by default:

$ cd /usr/src/sys/arch/amd64/conf/
$ cat /usr/src/sys/arch/amd64/conf/GENERIC.MP.RAID

  # $OpenBSD: GENERIC.MP,v 1.8 2007/01/27 22:48:01 kettenis Exp $
  include "arch/amd64/conf/GENERIC.MP"
  option          RAID_AUTOCONFIG         # Automatically configure RAID at boot
  pseudo-device   raid            4       # RAIDframe disk driver
  
$ config GENERIC.MP.RAID
$ cd ../compile/GENERIC.MP.RAID
Don't forget to run "make depend"
$ make clean && make depend && make
.... magic ....
$ su -
Password:
# make install
rm -f /obsd
ln /bsd /obsd
cp bsd /nbsd
mv /nbsd /bsd

Here is the exceprt from the OpenBSD 4.2 manpage, that brings it home:

Summary
 Despite the length of this man-page, configuring a RAID set is a rela-
 tively straight-forward process.  All that needs to be done is the fol-
 lowing steps:
 
 1.   Use disklabel(8) to create the components (of type RAID).
 2.   Construct a RAID configuration file: e.g. `raid0.conf'
 3.   Configure the RAID set with:
            # raidctl -C raid0.conf raid0
            
 4.   Initialize the component labels with:
            # raidctl -I 123456 raid0
            
 5.   Initialize other important parts of the set with:
            # raidctl -i raid0
            
 6.   Get the default label for the RAID set:
            # disklabel raid0 > /tmp/label
            
 7.   Edit the label:
            # vi /tmp/label
            
 8.   Put the new label on the RAID set:
            # disklabel -R -r raid0 /tmp/label
            
 9.   Create the file system:
            # newfs /dev/rraid0e
            
 10.  Mount the file system:
            # mount /dev/raid0e /mnt
            
 11.  Use:
            # raidctl -c raid0.conf raid0
            
      to re-configure the RAID set the next time it is needed, or put
      raid0.conf into /etc where it will automatically be started by the
      /etc/rc scripts.

Migrated: from simplelog 2014-07-03

Reference: