Software RAID on OpenBSD 4.8
jpiasetz has a very good recipe on installing with software raid on OpenBSD 4.6, and so far I’ve had good success doing something very similar with OpenBSD 4.8. The biggest thing I changed was using wd1a rather than sd0a for /altroot. Then it’s easy enough to use daily(8)’s integrated altroot sync to keep altroot up-to-date.
Here’s the config for altroot:
% grep altroot /etc/fstab
/dev/wd1a /altroot ffs xx 0 0
% cat /etc/daily.local
It’s working well so far, but I haven’t tested the actual failure scenario yet. I find this method much more satisfying than my earlier attempt at using raidframe for software raid (which I subsequently became afraid to upgrade remotely); this has much more of a “just works” feel to it.
Of course, this configuration won’t survive a primary disk failure without downtime, but for this server I prefer the simple usable solution over the complex available one.
I created a VM to test a primary disk failure, and OpenBSD booted so smoothly that I think I might want to add some explicit monitoring for disk failure.
To test, I created a VM with two virtual disks, and installed using jpiasetz’s recipe with the following adjustments:
- Removed the unnecessary -C force flag from bioctl
- Use a mount point of none for sd0a
- Removed the dd if=/dev/wd0a of=/dev/wd1a step
After rebooting, the steps to set up daily altroot sync are:
- Add altroot to fstab according to daily(8):
# echo "/dev/wd1a /altroot ffs xx 0 0" >> /etc/fstab
- Enable root backup option in /etc/daily.local:
# echo "ROOTBACKUP=1" >> /etc/daily.local
- Add root e-mail alias to catch the e-mailed /etc/daily output. (optional)
- Run the daily script, which will use dd to copy wd0a to wd1a:
- Install the boot block on wd1 so it can be used to boot the system in the absence of wd1:
mount /dev/wd1a /altroot
/usr/mdec/installboot -v /altroot/boot /usr/mdec/biosboot wd1
Then I powered down the VM and removed the wd0 disk entirely. When I booted, the VM came up with softraid0 in the degraded state (of course), but fully functional.
Important things to realize about this configuration:
- / is not using RAID. The / partition is on wd0a and is copied byte-for-byte to wd1a every night by daily(8). Disk failure will not be handled transparently, but should be easily recoverable.
- All other partitions (except swap) use Software RAID
- By default, OpenBSD will attempt to use both swap partitions on wd0b and wd1b, which may not be what you want.
- installboot hard codes inode and block numbers and will need to be re-run if the file /boot changes — after an upgrade, for example.
Updated step-by-step guide here.