[OpenBSD] Installing OpenBSD on top of software raid

In this tutorial, we will demonstrate how easy it is to install OpenBSD on a software RAID1. The same principles can be applied to create RAID0,5 or more.

We have to drop to the shell since the installer does not have this functionality built in. Select “s” at the installer.

Welcome to the OpenBSD/amd64 6.5 installation program.
(I)nstall, (U)pgrade or (S)hell? s

Check that we actually have more than 1x hdd:

# sysctl hw.disknames
hw.disknames=wd0:7922594e8158ee03,wd1:49129150e28daf19,cd0:,rd0:7c8ac10ea613493f

By default, OpenBSD only creates one hdd. Run the following to manually create the second hdd:

# cd /dev/
# sh MAKEDEV wd1

Now initialize the MBR on both disks:

# fdisk -iy wd0
Writing MBR at offset 0.
# fdisk -iy wd1
Writing MBR at offset 0.

Create a label on both disks called “raid”. Dump it and restore to the second disk. Make sure to select “raid” for the “FS type“. Run the following:

# disklabel -E wd0
Label editor (enter '?' for help at any prompt)
> a a
offset: [64] 
size: [20964761] 
FS type: [4.2BSD] raid
> q
Write new label?: [y] 
# disklabel wd0 > label.dump
# disklabel -R wd1 label.dump

Create the softraid(4) volume using the two “a” partitions. This will create a new drive called “sd0”. Run following:

# bioctl -c 1 -l wd0a,wd1a softraid0 
sd0 at scsibus1 targ 1 lun 0: SCSI2 0/direct fixed
sd0: 10236MB, 512 bytes/sector, 20964233 sectors
softraid0: SR RAID 1 volume attached as sd0 

where “-c” represents the RAID level and “-l” the chunk that will be used to create the RAID. These values can be adjusted to create other types of RAID arrays.

After this is done, exit the shell and proceed with the normal installation (just remember to select the new RAID drive “sd0” as the root disk).

# ^D
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/amd64 6.5 installation program.
(I)nstall, (U)pgrade or (S)hell? i

[...]

Available disks are: wd0 wd1 sd0.
Which one is the root disk? (or 'done') [wd0] sd0

And that’s it! Enjoy your software RAID OpenBSD system!

2 thoughts on “[OpenBSD] Installing OpenBSD on top of software raid

  1. hi there!

    i have a question, im a n00b on openbsd but this guide help me to make a raid with an old pentium-d with 2GB of RAM.

    My question is this, is there a minimum of hardware to make the raid? i have a mac mini g4 with a ppc proccesor of 1.5 ghz and 1GB of RAM, it would support this?

    thanks, and excuse me for my poor english

    Reply

Leave a Reply

Your email address will not be published.