Installing OpenBSD 5.3 i386 / amd64 using softraid (also works on OpenBSD 5.1 and 5.2)

Please note currently only the i386 and amd64 kernels allow booting directly from a softraid array.  Other supported architectures require the kernel to be located on a small (100MB) non-softraid partition.

I recently purchased a HP Proliant MicroServer N40L, and a couple of Western Digital RE4 enterprise drives to use in a RAID 1 array.  The process of configuring the softraid RAID array was as simple as follows:

Boot off the 5.3 media as per usual, but choose (S)hell instead of (I)nstall.

(I)nstall, (U)pgrade or (S)hell? s
# cd /dev
# sh /dev/MAKEDEV sd1 sd2
# fdisk -iy sd0
Writing MBR at offset 0.
# fdisk -iy sd1
Writing MBR at offset 0.
# disklabel -E sd0
Label editor (enter ‘?’ for help at any prompt)
> a a
offset: [64] [ENTER]
size: [976768001] [ENTER]
FS type: [4.2 BSD] RAID
> q
Write new label?: [y] y
# cd /tmp
# disklabel sd0 > protofile
# disklabel -R sd1 protofile
# bioctl -c 1 -l /dev/sd0a,/dev/sd1a softraid0
sd2 at scscibus2 targ 1 lun 0: <OPENBSD, SR RAID 1, 005> SCSI2 0/direct fixed
sd2: 476937MB, 512 bytes/sector, 976767473 sectors
softraid0: SR RAID 1 volume attached as sd2
# dd if=/dev/zero of=/dev/rsd2c bs=1m count=1
1+0 records in
1+0 recours out
1048576 bytes transferred in 0.031 secs (32996916 bytes/sec)
# exit

That will place you back at the (I)nstall, (U)pgrade or (S)hell? prompt and you can install as per normal.  Just be sure to  install to the newly created sd2 array.  Partitions on the array can be configured as per usual, using 4.2 BSD/swap FS types.  Once you’re done reboot as per usual and you’ll be up and running with softraid.  To make sure you can check your array status with the bioctl command.

# bioctl softraid0
Volume        Status                             Size  Device

#

It’s also worth noting that softraid can handle RAID 0, 5 and more.  To configure a RAID 0 stripe you would follow the guide for RAID 1 but change the bioctl command:

# bioctl -c 0 -l /dev/sd0a,/dev/sd1a softraid0

A quick example for configuring 3 drives in RAID 5 would be as follows:

(I)nstall, (U)pgrade or (S)hell? s
# cd /dev
# sh /dev/MAKEDEV sd1 sd2 sd3
# fdisk -iy sd0
# fdisk -iy sd1
# fdisk -iy sd2
# disklabel -E sd0
> a a
offset: [64] [ENTER]
size: [976768001] [ENTER]
FS type: [4.2 BSD] RAID
> q
Write new label?: [y] y
# cd /tmp
# disklabel sd0 > protofile
# disklabel -R sd1 protofile
# disklabel -R sd2 protofile
# bioctl -c 5 -l /dev/sd0a,/dev/sd1a,/dev/sd2a softraid0
# dd if=/dev/zero of=/dev/rsd3c bs=1m count=1
# exit

You would then install to the newly created sd3 array.

As always be sure to check the man pages if you’re not sure what a command does.

softraid (4)
bioctl (8)
fdisk (8)
disklabel (8)

This entry was posted in OpenBSD and tagged , , , , , . Bookmark the permalink.

3 Responses to Installing OpenBSD 5.3 i386 / amd64 using softraid (also works on OpenBSD 5.1 and 5.2)

  1. luis says:

    great !

  2. thanos says:

    Are you using the original BIOS or the modded one? If the latter, can you really hotswap your drives and have bioctl rebuild/etc.?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s