John Piasetzki's Blog

My Thoughts

Software RAID on OpenBSD Using Softraid

A step-by-step guide to installing softraid with OpenBSD

I found that there wasn’t a lot of documentation for how to install softraid (most of it still referenced RAIDframe). Here is my step by step guide to install softraid. This guide is very similiar to Installing OpenBSD 4.6 and references it at few points.

Follow the steps on getting OpenBSD boot up until it says:

(I)nstall, (U)pgrade or (S)hell? **S(RETURN)**

At this point we’re going to drop into a Shell to setup the raid data recovery disk first. You should end up with a prompt, where you are going to initialize the disks.

# cd /dev && sh /dev/MAKEDEV wd1 && cd /
# for i in wd0 wd1; do fdisk -yi $i; done
Writing MBR at offset 0.
Writing MBR at offset 0.
# disklabel -E wd0
Label editor (enter ? for help at any prompt
> a a
offset: [63] **(RETURN)**
size: [2097152] **(RETURN)**
FS type: [4.2BSD] **(RETURN)**
> a b
offset: [2097215] **(RETURN)**
size: [2598016] **(RETURN)**
FS type: [swap] **(RETURN)**
> a d
offset: [2097215] **(RETURN)**
size: [2097215] **(RETURN)**
FS type: [4.2BSD] **RAID(RETURN)**
> q
Write new label?: [y] **(RETURN)****disklabel wd0 > disklabel.wd1**
# **disklabel -R wd1 disklabel.wd1**

At this point your disklabels are properly setup and it’s now time to start the raid.

# **bioctl -C force -c 1 -l /dev/wd0d,/dev/wd1d softraid0**
# **dd if=/dev/zero of=/dev/rsd0c bs=1m count=1**

Now you have the raid all setup on sd0 and it’s time to get back to the installation.

# **exit**  
(I)nstall, (U)pgrade or (S)hell? **I(RETURN)**

Continue with the install as normal up until the disk setup section.

Available disks are: wd0 wd1 sd0.
Which one is the root disk? (or ‘done’) [wd0] **(RETURN)**
Disk: wd0       geometry: 121601/255/63 [1953525168 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 - 121600 254  63 [          63:  1953520002 ] OpenBSD
Use (W)hole disk, use the (O)penBSD area, or (E)dit the MBR? [OpenBSD] **W(return)**
Setting OpenBSD MBR partition to whole wd0…done.
OpenBSD area: 63-1953520065; size: 931.5G; free: 606.3G
#                size           offset  fstype [fsize bsize  cpg]
  a:             1.0G               63  4.2BSD   2048 16384    1 # /
  b:             1.2G          2097215    swap                   
  c:           931.5G                0  unused                   
  d:             4.0G          4695231  4.2BSD   2048 16384    1 # /tmp
  e:             6.0G         13083839  4.2BSD   2048 16384    1 # /var
  f:             2.0G         25619903  4.2BSD   2048 16384    1 # /usr
  g:             1.0G         29814207  4.2BSD   2048 16384    1 # /usr/X11R6
  h:             6.0G         31911359  4.2BSD   2048 16384    1 # /usr/local
  i:             2.0G         44494271  4.2BSD   2048 16384    1 # /usr/src
  j:             2.0G         48688575  4.2BSD   2048 16384    1 # /usr/obj
  k:           300.0G         52882879  4.2BSD   2048 16384    1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] **C(RETURN)**

You will now create an OpenBSD disklabel inside the OpenBSD MBR
partition. The disklabel defines how OpenBSD splits up the MBR partition
into OpenBSD partitions in which filesystems and swap space are created.
You must provide each filesystems mountpoint in this program.

The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
start of the disk, NOT the start of the OpenBSD MBR partition.

Label editor (enter ? for help at any prompt)
> **m a**
offset: [63] **(RETURN)**
size: [2097152] **(RETURN)**
FS type: [4.2BSD] **(RETURN)**
mount point: [none] **/(RETURN)**
> **q**
No label changes.
Available disks are: sd0 wd1.
Which one do you wish to initialize? (or ‘done’) [done] **sd0(RETURN)**
MBR has invalid signature; not showing it.
Use (W)hole disk, use the (O)penBSD area, or (E)dit the MBR? [whole] **(return)**
Setting OpenBSD MBR partition to whole sd0...done.

You will now create an OpenBSD disklabel inside the OpenBSD MBR
partition. The disklabel defines how OpenBSD splits up the MBR partition
into OpenBSD partitions in which filesystems and swap space are created.
You must provide each filesystems mountpoint in this program.

The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
start of the disk, NOT the start of the OpenBSD MBR partition.

Label editor (enter ? for help at any prompt)
> **A**
> **m a**
offset: [63] **(RETURN)**
size: [2097152] **(RETURN)**
FS type: [4.2BSD] **(RETURN)**
mount point: [/] **/altroot(RETURN)**
> **d b(RETURN)**
> **q**
Write new label?: [y] **(RETURN)**

From here just continue through the setup as normal. There are is one final step before rebooting. That is to copy whats on the first drive to the second:

dd if=/dev/wd0a of=/dev/wd1a

Reboot and make the second drive bootable.

/usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot wd1

Errata

  • The second drive does not have it’s root update with these instructions. I will update it when I figure out a fix.