SOFTRAID(4) OpenBSD Programmer's Manual SOFTRAID(4) NAME softraid - Software RAID SYNOPSIS softraid0 at root scsibus* at softraid? DESCRIPTION The softraid device emulates an HBA (host bus adapter) that provides RAID and other IO related services. The idea is to tie chunks together into an IO discipline. A discipline can for example provide a volume that mirrors chunks (RAID 1). Currently softraid only supports a mirroring discipline. A discipline is a collection of functions that provides specific IO func- tionality. This includes IO path, bring-up, failure recovery, statisti- cal information gathering etc. Essentially a discipline is a lower level driver that provides the IO transformation for the softraid device. A volume is a virtual disk device that is made up of a collection of chunks. A chunk is a partition or storage area of the type RAID. EXAMPLES An example to create a 3 chunk RAID 1 from scratch is as follows: Initialize the partition tables of all disks: echo y | fdisk -i wd1 echo y | fdisk -i wd2 echo y | fdisk -i wd3 Now create RAID partitions on all disks: echo "d a\na\n\n\n\nRAID\nw\nq\n" | disklabel -E wd1 echo "d a\na\n\n\n\nRAID\nw\nq\n" | disklabel -E wd2 echo "d a\na\n\n\n\nRAID\nw\nq\n" | disklabel -E wd3 Assemble the RAID volume: bioctl -c 1 -l /dev/wd1a,/dev/wd2a,/dev/wd3a softraid0 The console will give away what device was added to the system: scsibus0 at softraid0: 1 targets sd0 at scsibus0 targ 0 lun 0: <OPENBSD, SR RAID 1, 001> SCSI2 sd0: 1MB, 0 cyl, 255 head, 63 sec, 512 bytes/sec, 3714 sec total It is good practice to wipe the front of the disk before using it: dd if=/dev/zero of=/dev/rsd0c bs=1m count=1 Initialize the partition table and create a filesystem on the new RAID volume: echo y | fdisk -i sd0 echo "d a\na\n\n\n\n4.2BSD\nw\nq\n" | disklabel -E sd0 newfs /dev/rsd0a The RAID volume is now ready to be used as a normal disk device. See bioctl(8) for more information on configuration of RAID sets. All component partitions must be of type RAID. Some platforms, such as SUN, are not capable of using the RAID partition type. The 4.2BSD parti- tion type should be used on such platforms. SEE ALSO sd(4), wd(4), bioctl(8), config(8), fsck(8), MAKEDEV(8), mount(8), newfs(8) HISTORY The softraid driver first appeared in OpenBSD 4.2. AUTHORS Marco Peereboom. CAVEATS The driver relies on underlying hardware to properly fail chunks. Cur- rently the RAID 1 support does not have the ability to recover a failed chunk. The RAID 1 discipline does not initialize the mirror upon creation. Certain RAID levels can protect against some data loss due to component failure. RAID is not a substitute for good backup practices. OpenBSD 4.2 June 2, 2007 2