This document should show the long process for setting up a kernel-based software RAID system on OpenBSD 3.2 with the root partition / on a raid0a device, swap and /tmp on raid1b and raid1d, and /var and /usr on raid2e and raid2f. This project utilizes raidctl.
From the man raidctl(8):
raidctl is the user-land control program for raid(4), the RAIDframe disk device. raidctl is primarily used to dynamically configure and unconfigure RAIDframe disk devices. For more information about the RAIDframe disk device, see raid(4).
This document assumes the reader has at least rudimentary knowledge of RAID and RAID concepts.
The sample system has sd0(18gb), sd1(18gb), and sd2. I made a complete install of OpenBSD 3.2 on sd2. References:
raidctl(8)
installboot(8)
http://marc.theaimsgroup.com/?l=openbsd-misc&m=103635776223483&w=2
http://marc.theaimsgroup.com/?l=openbsd-misc&m=102839903925282&w=2
http://archives.neohapsis.com/archives/openbsd/2001-10/0142.html
http://www.blackant.net/other/docs/howto-full-system-mfs.php
-- modify the kernel:
# add option RAID_AUTOCONFIG option NMBCLUSTERS=8192 option BUFCACHEPERCENT=15 # default is 5 option DUMMY_NOPS # speed hack; recommended pseudo-device raid 4 # RAIDframe disk driver -- make partitions RAID %disklabel -E sd0 # /dev/rsd0c: type: SCSI disk: SCSI disk label: DK32DJ-18MC flags: bytes/sector: 512 sectors/track: 447 tracks/cylinder: 3 sectors/cylinder: 1341 cylinders: 26866 total sectors: 36102720 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 307026 63 4.2BSD 1024 8192 16 # (Cyl. 0*- 228) c: 36102720 0 unused 0 0 # (Cyl. 0 - 26922*) d: 409005 307089 RAID # (Cyl. 229 - 533) e: 5767641 716094 RAID # (Cyl. 534 - 4834) f: 29614320 6483735 RAID # (Cyl. 4835 - 26918*) % disklabel -E sd1 # /dev/rsd1c: type: SCSI disk: SCSI disk label: DK32DJ-18MC flags: bytes/sector: 512 sectors/track: 447 tracks/cylinder: 3 sectors/cylinder: 1341 cylinders: 26866 total sectors: 36102720 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 307026 63 4.2BSD 1024 8192 16 # (Cyl. 0*- 228) c: 36102720 0 unused 0 0 # (Cyl. 0 - 26922*) d: 409005 307089 RAID # (Cyl. 229 - 533) e: 5767641 716094 RAID # (Cyl. 534 - 4834) f: 29614320 6483735 RAID # (Cyl. 4835 - 26918*) -- create /etc/raid0.conf: START array 1 2 0 START disks /dev/sd0d /dev/sd1d START layout 128 1 1 1 START queue fifo 100 -- create /etc/raid1.conf: START array 1 2 0 START disks /dev/sd0e /dev/sd1e START layout 64 1 1 0 START queue fifo 100 -- create /etc/raid2.conf: START array 1 2 0 START disks /dev/sd0f /dev/sd1f START layout 128 1 1 1 START queue fifo 100 -- configure raid arrays raidctl -C /etc/raid0.conf raid0 raid -I 135790 raid0 raid -i raid0 disklabel -E raid0 # /dev/rraid0c: type: RAID disk: raid label: fictitious flags: bytes/sector: 512 sectors/track: 128 tracks/cylinder: 8 sectors/cylinder: 1024 cylinders: 399 total sectors: 408832 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 408832 0 4.2BSD 8192 65536 32 # (Cyl. 0 - 399*) c: 408832 0 unused 0 0 # (Cyl. 0 - 399*) newfs /dev/rraid0a mkdir /mnt/kernel0 mkdir /mnt/kernel1 mount /dev/raid0a /mnt mkdir /mnt/etc mkdir /mnt/dev mkdir /mnt/bin mkdir /mnt/sbin cd /etc tar cXf - . | tar -xpf - -C /mnt/etc cd /bin tar cXf - . | tar -xpf - -C /mnt/bin cd /sbin tar cXf - . | tar -xpf - -C /mnt/sbin cd /dev tar cXf - . | tar -xpf - -C /mnt/dev mkdir /mnt/tmp mkdir /mnt/usr mkdir /mnt/var cp -r .cshrc .profile bsd bsd.old boot stand altroot root /mnt newfs /dev/rsd0a newfs /dev/rsd1a mount /dev/sd0a /mnt/kernel0 mount /dev/sd1a /mnt/kernel1 cp /bsd /bsd.old /boot /mnt/kernel0 cp /bsd /bsd.old /boot /mnt/kernel1 raidctl -C /etc/raid1.conf raid1 raid -I 246810 raid1 raid -i raid1 disklabel -E raid1 # /dev/rraid1c: type: RAID disk: raid label: fictitious flags: bytes/sector: 512 sectors/track: 128 tracks/cylinder: 8 sectors/cylinder: 1024 cylinders: 11264 total sectors: 11535104 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] b: 8388608 0 swap # (Cyl. 0 - 8191) c: 11535104 0 unused 0 0 # (Cyl. 0 - 11264*) d: 3146496 8388608 4.2BSD 8192 65536 32 # (Cyl. 8192 - 11264*) newfs /dev/rraid1d raidctl -C /etc/raid2.conf raid2 raid -I 123456 raid2 raid -i raid2 disklabel -E raid2 # /dev/rraid2c: type: RAID disk: raid label: fictitious flags: bytes/sector: 512 sectors/track: 128 tracks/cylinder: 8 sectors/cylinder: 1024 cylinders: 28920 total sectors: 29614208 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] c: 29614208 0 unused 0 0 # (Cyl. 0 - 28920*) e: 25165824 0 4.2BSD 8192 65536 32 # (Cyl. 0 - 24575) f: 4448384 25165824 4.2BSD 8192 65536 32 # (Cyl. 24576 - 28920*) newfs /dev/rraid2e newfs /dev/rraid2f mkdir /mnt2 mount /dev/raid2e /mnt2 mkdir /mnt2 cd /var tar -cXf - . | tar -xpf - -C /mnt2 mkdir /mnt3 mount /dev/raid2f /mnt3 mkdir /mnt3 cd /usr tar -cXf - . | tar -xpf - -C /mnt3 cd /usr/mdec ./installboot -v /mnt/kernel0/boot ./biosboot sd0 ./installboot -v /mnt/kernel1/boot ./biosboot sd1 raidctl -A root raid0 raidctl -A yes raid1 raidctl -A yes raid2 -- modify /mnt/etc/fstab /dev/raid0a / ffs rw 1 1 /dev/raid1b none swap sw 0 0 /dev/sd2h /home ffs rw,nodev,nosuid,softdep 1 2 /dev/raid1d /tmp ffs rw,nodev,nosuid,softdep 1 2 /dev/raid2f /usr ffs rw,nodev,softdep 1 2 /dev/raid2e /var ffs rw,nodev,nosuid,softdep 1 2
After you reboot, be sure to delete the raid config files from /etc because you'll get "Device already configured!" errors otherwise. The errors don't hurt anything, but they definately aren't needed. The raidctl -A yes raid1 lines eliminate the necessity of having the raid configuration files in /etc.