Booting OpenBSD on a Flash CardEric M. Johnston
4 June 2007
In building a pair of OpenBSD firewalls, I wanted to minimize points of failure. Hard drives are one of the most failure-prone components of a server, and since a dedicated firewall doesn't need gigabytes of storage, I went with Compact Flash storage with an IDE-to-CF adapter. This vignette quickly explains how to prepare a flash card to boot OpenBSD. I plan to address the larger issue of building dedicated, redundant OpenBSD firewalls in a separate article.
The OpenBSD boot process can be a bit daunting to the newcomer. Though there's plenty of detailed documentation that explains how things work, piecing it together for an embedded application such as this can take a while unless you know what you're doing. Though I give a little recipe of sorts here, I'll add the disclaimer that every system configuration is a little different and blindly entering commands without some understanding and verification of what they do can only get you into trouble!
There are basically four things that need to happen to prepare a disk for booting a kernel:
First, some background about the hardware. I've got an old laptop I'm using to stage the flash cards before installing them in the firewalls. The cards are 256 meg SanDisk Compact Flash cards, though these instructions should apply to just about any size or flavor of card. (I did run into trouble on my firewall machines with newer cards that support direct memory access (DMA): though they worked fine with both the PCMCIA adapter and a USB reader, some IDE-to-CF adapters don't support DMA and, unless the motherboard's BIOS can be configured to disable DMA, they will either run very slowly or won't work at all.)
Compact Flash card.
For accessing the card on my staging laptop, I'm using a SanDisk Compact Flash PC Card adapter, which slides right into the laptop. USB adapters will also work, but note that disk device name may be slightly different than the example here.
Compact Flash PC Card (PCMCIA) adapter.
Next, a few handy reference links that will explain the below commands in much more detail. If you run into problems, or you don't understand what's going on, these should help (somewhat specific to the i386 platform):
You need to take note of the device name, which will probably start with either wd or sd. For example, if you're doing this on a laptop with a single IDE hard drive using a PCMCIA adapter, the device is going to be wd1 (since wd0 is already taken by your hard drive). On the other hand, if you're using a USB adapter, the device is going to be sd0 (since you don't have any other SCSI disks). Of course, your particular mix of drives and devices is going to determine the device name: make certain that the device name you use in the below commands is indeed the flash card! I'll be using wd1 in the example.
All of the below commands must be run as root (or under sudo). Be sure to replace wd1 with your card's device name!
Again, it's sometimes handy to print the label both before and after your changes to see what's going on.
|« Return to Home|
|© 2007 Ętherwide, LLC. All rights reserved.|