xref: /openbsd-src/share/man/man4/softraid.4 (revision d874cce4b1d9fe6b41c9e4f2117a77d8a4a37b92)
1.\"	$OpenBSD: softraid.4,v 1.18 2008/06/14 00:16:38 hshoexer Exp $
2.\"
3.\" Copyright (c) 2007 Todd T. Fries   <todd@OpenBSD.org>
4.\" Copyright (c) 2007 Marco Peereboom <marco@OpenBSD.org>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: June 14 2008 $
19.Dt SOFTRAID 4
20.Os
21.Sh NAME
22.Nm softraid
23.Nd Software RAID
24.Sh SYNOPSIS
25.Cd "softraid0 at root"
26.Cd "scsibus*  at softraid?"
27.Sh DESCRIPTION
28The
29.Nm
30device emulates a Host Bus Adapter (HBA) that provides RAID and other I/O
31related services.
32The
33.Nm
34device provides a scaffold to implement more complex I/O transformation
35disciplines.
36For example, one can tie chunks together into a mirroring discipline.
37There really is no limit on what type of discipline one can write as long
38as it fits the SCSI model.
39.Pp
40.Nm
41supports a number of
42.Em disciplines .
43A discipline is a collection of functions
44that provides specific I/O functionality.
45This includes I/O path, bring-up, failure recovery, statistical
46information gathering etc.\&
47Essentially a discipline is a lower
48level driver that provides the I/O transformation for the softraid
49device.
50.Pp
51Currently
52.Nm
53supports the following disciplines:
54.Bl -ohang -offset indent
55.It RAID 0
56A
57.Em striping
58discipline.
59It segments data over a number of disks to increase performance.
60RAID 0 does not provide for data loss (redundancy).
61.It RAID 1
62A
63.Em mirroring
64discipline.
65It copies data across more than one disk to provide for data loss.
66Read performance is increased,
67though at the cost of write speed.
68Unlike traditional RAID 1,
69.Nm
70supports the use of more than two disks in a RAID 1 setup.
71.It CRYPTO
72An
73.Em encrypting
74discipline.
75It encrypts data on a single disk to provide for data confidentiality.
76CRYPTO does not provide redundancy.
77.El
78.Pp
79A
80.Em volume
81is a virtual disk device that is made up of a collection of chunks.
82.Pp
83A
84.Em chunk
85is a partition or storage area of the type RAID.
86.Sh EXAMPLES
87An example to create a 3 chunk RAID 1 from scratch is as follows:
88.Pp
89Initialize the partition tables of all disks:
90.Bd -literal -offset indent
91# fdisk -iy wd1
92# fdisk -iy wd2
93# fdisk -iy wd3
94.Ed
95.Pp
96Now create RAID partitions on all disks:
97.Bd -literal -offset indent
98# printf "a\en\en\en\enRAID\enw\enq\en\en" | disklabel -E wd1
99# printf "a\en\en\en\enRAID\enw\enq\en\en" | disklabel -E wd2
100# printf "a\en\en\en\enRAID\enw\enq\en\en" | disklabel -E wd3
101.Ed
102.Pp
103Assemble the RAID volume:
104.Bd -literal -offset indent
105# bioctl -c 1 -l /dev/wd1a,/dev/wd2a,/dev/wd3a softraid0
106.Ed
107.Pp
108The console will show what device was added to the system:
109.Bd -literal -offset indent
110scsibus0 at softraid0: 1 targets
111sd0 at scsibus0 targ 0 lun 0: <OPENBSD, SR RAID 1, 001> SCSI2
112sd0: 1MB, 0 cyl, 255 head, 63 sec, 512 bytes/sec, 3714 sec total
113.Ed
114.Pp
115It is good practice to wipe the front of the disk before using it:
116.Bd -literal -offset indent
117# dd if=/dev/zero of=/dev/rsd0c bs=1m count=1
118.Ed
119.Pp
120Initialize the partition table and create a filesystem on the
121new RAID volume:
122.Bd -literal -offset indent
123# fdisk -iy sd0
124# printf "a\en\en\en\en4.2BSD\enw\enq\en\en" | disklabel -E sd0
125# newfs /dev/rsd0a
126.Ed
127.Pp
128The RAID volume is now ready to be used as a normal disk device.
129.Pp
130See
131.Xr bioctl 8
132for more information on configuration of RAID sets.
133.Pp
134All component partitions must be of type
135.Dv RAID .
136Some platforms, such as SUN, are not capable of using the
137.Dv RAID
138partition type.
139The
140.Dv 4.2BSD
141partition type should be used on such platforms.
142.Sh SEE ALSO
143.Xr sd 4 ,
144.Xr wd 4 ,
145.Xr bioctl 8 ,
146.Xr config 8 ,
147.Xr fsck 8 ,
148.Xr MAKEDEV 8 ,
149.Xr mount 8 ,
150.Xr newfs 8
151.Sh HISTORY
152The
153.Nm
154driver first appeared in
155.Ox 4.2 .
156.Sh AUTHORS
157.An Marco Peereboom .
158.Sh CAVEATS
159The driver relies on underlying hardware to properly fail chunks.
160Currently RAID 1 support does not have the ability to recover a
161failed chunk.
162.Pp
163The RAID 1 discipline does not initialize the mirror upon creation.
164This is by design because all sectors that are read are written first.
165There is no point in wasting a lot of time syncing random data.
166.Pp
167Currently there is no automated mechanism to recover from failed disks.
168.Pp
169There is no boot support at this time for any disciplines.
170.Pp
171Certain RAID levels can protect against some data loss
172due to component failure.
173RAID is
174.Em not
175a substitute for good backup practices.
176