I came across a puzzling dilemma today as I was provisioning some Sun Fire V120 servers for some tests. Although somewhat old now, a 650MHz Sun Fire V120 with 3GB of memory does just fine for a lot of tasks like DNS, some basic mail processing, and static web content. One of the dilemmas I have faced in the past was running two disks in a RAID mirror. OpenBSD has had softraid(4) for quite a while but OpenBSD 5.1 adds support for the root filesystem on softraid(4) for amd64, i386, and sparc64 systems. There was only one problem.
I found some excellent documentation for amd64 and i386 in the form of Josh Grosse’s Provisioning Root on Softraid article at the OpenBSD Journal. This except from the article shows how you would do the installboot “magic” needed for root on softraid(4) to work.
1 2 3 4 5 6 7 8 9 10 11 12 13
The only problem is that sparc64 is a single-stage boot environment whereas amd64 and i386 are two-stage boot environments. As Josh Grosse stated, “I never tested root-on-softraid on single-stage booting architectures. I don’t have any handy. You’ll have to test that yourself!”
Unfortunately, there was no follow-up to this mailing list post. Since OpenBSD is known for its excellent man pages, I thought looking there might be a good idea. The installboot(8) man page for sparc64 gave the following example.
The problem was, rather than using the hardware device name like sd0, sparc64 uses a partition name, in this case sd0a. This goes back to sparc64 being a single-stage boot environment rather than a two-stage boot environment like amd64 and i386. After trying various incarnations of this command with sd0a and sd2a, I finally figured out the right command. You really will want to use the -v flag for installboot to see what’s going on. Otherwise, you will be in the dark.
1 2 3 4 5 6 7
Of course the device names such as sd2 will vary based on your system. My Sun Fire V120 has two 36GB SCSI disks which show up as sd0 and sd1 so when I created my softraid(4) volume it shows up as sd2. If you have two IDE disks like a Sun Fire V120 I have, then sd0 will likely be your softraid(4) volume and wd0 and wd1 will be your two disks.
The Install Process
What I did to actually create the softraid(4) came straight out of Provisioning Root on Softraid. I booted up using the bsd.rd RAMDISK kernel and select s for (S)hell at the installation prompt. In the shell, I followed a little different sequence since this is a sparc64 system, not amd64 or i386.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
Your numbers will likely be somewhat different but this is the main idea. The second p prints out what your disklabel should look like with an a partition to load your kernels from, b for swap, and d for softraid(4).
After this, type exit to get back to the installation menu and select I for (I)nstall. Continue through the installation and select sd2 or whatever your softraid(4) disk is called when partitioning. Leave sd0 and sd1 alone in the installer. When the install finishes, format sd0a and sd1a
By default, the installer ramdisk has /mnt and /mnt2 mount points. You will need a third mount point.
1 2 3
As long as sd2a, your softraid(4) root, is still mounted on /mnt, you need to do a couple of steps.
1 2 3 4 5
For OpenBSD/sparc64 to boot, it is essential that ofwboot be in your sd0a and sd1a filesystems. I found this out the hard way as well. With all of this done, use installboot to finish your install.
1 2 3 4 5 6 7
With that, you’re done with the basic install. One other note, you will want to add your swap partitions to your fstab since they will not be automatically picked up. With that done, my fstab looks like this.
1 2 3 4
As you can see, I am using DUIDs rather than disk references like sd2a. The first entry is my softraid(4) root partition, sd2a on this system. The second two entries are the sd0b and sd1b swap partitions. If you’re wondering how to find the DUIDs, this will get you the information for sd0.
With the install fully done and booting to root on softraid(4), it’s time to start installing the other software I need.