Note: This was imported from my old blog. This "tutorial" may be stale. Be prepared for differences in newer version of OpenBSD. This was made from 4.6
So I've been messing around recently with the softraid implementation in OpenBSD.. I've done this once before configured for RAID 0, but one of the drives went bad..
In case you aren't aware(as I wasn't without a bit of thinking) you can do softraid experiments with only 1 drive(though it's a bit silly) by creating multiple RAID disklabels or do something useful with 2 drives. I'll use RAID1 as an example. Also, you can install OpenBSD (4.6 at least) straight onto the RAID psuedo-drive..
I'll assume you have wd0 and wd1 for drives.
Boot up the OpenBSD CD and then at the install prompt, goto the shell.
fdisk the disks
# fdisk -iy wd0 # fdisk -iy wd1
Now do the disk label. Here, you have make a decision for how much space you want in / I personally went a bit over and used 100M because I plan on putting some emergency software there in case a RAID chunk goes down.
Do the following replacing X with each drive number. (so do this multiple times)
# disklabel -E wdX > z > a partition: [a] <enter> offset: [<some number>] <enter> size: [<some number>] 100M FS type: [4.2 BSD] <enter> > a partition [b] d offset: [<some number>] <enter> size: [<some number>] <enter> FS type: [4.2 bSD] RAID > w > q
Now for the actual RAID configuration..
# bioctl -c 1 -l /dev/wd0d,/dev/wd1d softraid0 <blue dmesg text outputted>
Make sure to note what
sd device is created as told by the blue text.
Note the number after -c is the RAID level, so you can try one of the other RAID levels if you wish.
Now we need to go back to the install..
Do all the install stuff, and then when you get to "choose the root disk" choose wd0.
when configuring the disklabel all you have to do is
> n a mount point: / > w > q
So now you got your root disk. Now time to use RAID for everything else. When it asks you if you want to initialize other disks, choose the sd device that bioctl created. Usually it should be the highest number of sd device.
You'll have to write a new MBR for the device, so just choose Use Whole Disk and then at disk label, just label everything as normal except for partition-a doesn't get configured as / .
Now you should be able to run everything as normal and you'll be using whatever RAID level you chose.. Have fun! Maybe in the future OpenBSD will get support for automated recovery of failed RAID 1, 4, and 5 levels... There is RAIDFrame, but I haven't bothered myself enough to check into it.. If I do I'll probably write up something here.. 12010-03-14 04:02:11.123145