xref: /netbsd-src/share/man/man4/raid.4 (revision bada23909e740596d0a3785a73bd3583a9807fb8)
1.\"     $NetBSD: raid.4,v 1.5 1999/03/16 01:19:17 garbled Exp $
2.\"
3.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Greg Oster
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.\"
38.\" Copyright (c) 1995 Carnegie-Mellon University.
39.\" All rights reserved.
40.\"
41.\" Author: Mark Holland
42.\"
43.\" Permission to use, copy, modify and distribute this software and
44.\" its documentation is hereby granted, provided that both the copyright
45.\" notice and this permission notice appear in all copies of the
46.\" software, derivative works or modified versions, and any portions
47.\" thereof, and that both notices appear in supporting documentation.
48.\"
49.\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
50.\" CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
51.\" FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
52.\"
53.\" Carnegie Mellon requests users of this software to return to
54.\"
55.\"  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
56.\"  School of Computer Science
57.\"  Carnegie Mellon University
58.\"  Pittsburgh PA 15213-3890
59.\"
60.\" any improvements or extensions that they make and grant Carnegie the
61.\" rights to redistribute these changes.
62.\"
63.Dd November 9, 1998
64.Dt RAID 4
65.Os
66.Sh NAME
67.Nm raid
68.Nd RAIDframe Disk Driver
69.Sh SYNOPSIS
70.Cd "pseudo-device raid" Op Ar count
71.Sh DESCRIPTION
72The
73.Nm
74driver provides RAID 0, 1, 4, and 5 (and more!) capabilities to NetBSD.  This
75document assumes that the reader has at least some familiarity with RAID
76and RAID concepts.  The reader is also assumed to know how to configure
77disks and pseudo-devices into kernels, how to generate kernels, and how
78to partition disks.
79.Pp
80RAIDframe provides a number of different RAID levels including:
81.Bl -tag -width indent
82.It RAID 0
83provides simple data striping across the components.
84.It RAID 1
85provides mirroring.
86.It RAID 4
87provides data striping across the components, with parity
88stored on a dedicated drive (in this case, the last component).
89.It RAID 5
90provides data striping across the components, with parity
91distributed across all the components.
92.El
93.Pp
94There are a wide variety of other RAID levels supported by RAIDframe,
95including Even-Odd parity, RAID level 5 with rotated sparing, Chained
96declustering,  and Interleaved declustering.  The reader is referred
97to the RAIDframe documentation mentioned in the
98.Sx HISTORY
99section for more detail on these various RAID configurations.
100.Pp
101Depending on the parity level configured, the device driver can
102support the failure of component drives.  The number of failures
103allowed depends on the parity level selected.  If the driver is able
104to handle drive failures, and a drive does fail, then the system is
105operating in "degraded mode".  In this mode, all missing data must be
106reconstructed from the data and parity present on the other
107components.  This results in much slower data accesses, but
108does mean that a failure need not bring the system to a complete halt.
109.Pp
110The RAID driver supports and enforces the use of
111.Sq component labels .
112A
113.Sq component label
114contains important information about the component, including a
115user-specified serial number, the row and column of that component in the RAID
116set, and whether the data (and parity) on the component is
117.Sq clean .
118If the driver determines that the labels are very inconsistent with
119respect to each other (e.g. two or more serial numbers do not match)
120or that the component label is not consistent with it's assigned place
121in the set (e.g. the component label claims the component should be
122the 3rd one a 6-disk set, but the RAID set has it as the 3rd component
123in a 5-disk set) then the device will fail to configure.  If the
124driver determines that exactly one component label seems to be
125incorrect, and the RAID set is being configured as a set that supports
126a single failure, then the RAID set will be allowed to configure, but
127the incorrectly labeled component will be marked as
128.Sq failed ,
129and the RAID set will begin operation in degraded mode.
130If all of the components are consistent among themselves, the RAID set
131will configure normally.
132.Pp
133The driver supports
134.Sq hot spares ,
135disks which are on-line, but are not
136actively used in an existing filesystem.  Should a disk fail, the
137driver is capable of reconstructing the failed disk onto a hot spare
138or back onto a replacment drive.
139If the components are hot swapable, the failed disk can then be
140removed, a new disk put in it's place, and a copyback operation
141performed.  The copyback operation, as it's name indicates, will copy
142the reconstructed data from the hot spare to the previously failed
143(and now replaced) disk.  Hot spares can also be hot-added using
144.Xr raidctl 8 .
145.Pp
146If a component cannot be detected when the RAID device is configured,
147that component will be simply marked as 'failed'.
148.Pp
149The user-land utility for doing all
150.Nm
151configuration and other operations
152is
153.Xr raidctl 8 .
154For any of the RAID flavours which have parity data,
155.Xr raidctl 8
156must be used with the
157.Fl i
158option to re-write the data when either a) a new RAID device is
159brought up for the first time or b) after an un-clean shutdown of a
160RAID device.  By performing this on-demand recomputation of all parity
161before doing a
162.Xr fsck 8
163or a
164.Xr newfs 8
165filesystem integrity and parity integrity can be ensured.  It bears
166repeating again that parity recomputation is
167.Ar required
168before any filesystems are created or used on the RAID device.  If the
169parity is not correct, then missing data cannot be correctly recovered.
170.Pp
171RAID levels may be combined in a hierarchical fashion.  For example, a RAID 0
172device can be constructed out of a number of RAID 5 devices (which, in turn,
173may be constructed out of the physical disks, or of other RAID devices).
174.Pp
175At the time of this writing, it is
176.Ar imperative
177that drives be
178.Sq nailed down
179at their respective addresses (i.e. not left free-floating, where a
180drive with SCSI ID of 4 can end up as /dev/sd0c).  Consider a system
181with three SCSI drives at SCSI ID's 4, 5, and 6, and which map to
182components /dev/sd0e, /dev/sd1e, and /dev/sd2e.  If the drive with
183SCSI ID 5 fails,
184and the system reboots, the old /dev/sd2e will show up as /dev/sd1e.
185If the RAID driver is automatically configured, it will only detect
186that /dev/sd2e has failed, and will not notice that /dev/sd2e has
187actually become /dev/sd1e.  Hopefully this will change within a few
188days of this writing with the addition of MD5 checksums to each of the
189components.
190.Pp
191The first step to using the
192.Nm
193driver is to ensure that it is suitably configured in the kernel.  This is
194done by adding a line similar to:
195.Bd -unfilled -offset indent
196pseudo-device   raid   4       # RAIDframe disk device
197.Ed
198.Pp
199to the kernel configuration file.  The
200.Sq count
201argument (
202.Sq 4 ,
203in this case), specifies the number of RAIDframe drivers to configure.
204At the time of this writing, 4 is the MAXIMUM of
205.Nm
206devices which are supported.  This will change as soon as kernel threads
207are available.
208.Pp
209In all cases the
210.Sq raw
211partitions of the disks
212.Pa must not
213be combined.  Rather, each component parition should be offset by at least one
214cylinder from the beginning of that component disk.  This ensures that
215the disklabels for the component disks do not conflict with the
216disklabel for the
217.Nm
218device.
219As well, all component paritions must be of the type
220.Dv FS_BSDFFS .
221.Pp
222A more detailed treatment of actually using a
223.Nm
224device is found in
225.Xr raidctl 8 .
226It is highly recommended that the steps to reconstruct, copyback, and
227re-compute parity are well understood by the system administrator(s)
228.Ar before
229a component failure.  Doing the wrong thing when a component fails may
230result in data loss.
231.Pp
232.Sh WARNINGS
233Certain RAID levels (1, 4, 5, 6, and others) can protect against some
234data loss due to component failure.  However the loss of two
235components of a RAID 4 or 5 system, or the loss of a single component
236of a RAID 0 system, will result in the entire filesystems on that RAID
237device being lost.
238RAID is
239.Ar NOT
240a substitute for good backup practices.
241.Pp
242Recomputation of parity
243.Ar MUST
244be performed whenever there is a chance that it may have been
245compromised.  This includes after system crashes, or before a RAID
246device has been used for the first time.  Failure to keep parity
247correct will be catastrophic should a component ever fail -- it is
248better to use RAID 0 and get the additional space and speed, than it
249is to use parity, but not keep the parity correct.  At least with RAID
2500 there is no perception of increased data security.
251.Pp
252.Sh FILES
253.Bl -tag -width /dev/XXrXraidX -compact
254.It Pa /dev/{,r}raid*
255.Nm
256device special files.
257.El
258.Pp
259.Sh SEE ALSO
260.Xr MAKEDEV 8 ,
261.Xr raidctl 8 ,
262.Xr config 8 ,
263.Xr fsck 8 ,
264.Xr mount 8 ,
265.Xr newfs 8
266.Sh HISTORY
267The
268.Nm
269driver in
270.Nx
271is a port of RAIDframe, a framework for rapid prototyping of RAID
272structures developed by the folks at the Parallel Data Laboratory at
273Carnegie Mellon University (CMU).  RAIDframe, as originally distributed
274by CMU, provides a RAID simulator for a number of different
275architectures, and a user-level device driver and a kernel device
276driver for for Digital Unix.  The
277.Nm
278driver is a kernelized version of RAIDframe v1.1.
279.Pp
280A more complete description of the internals and functionality of
281RAIDframe is found in the paper "RAIDframe: A Rapid Prototyping Tool
282for RAID Systems", by William V. Courtright II, Garth Gibson, Mark
283Holland, LeAnn Neal Reilly, and Jim Zelenka, and published by the
284Parallel Data Laboratory of Carnegie Mellon University.
285The
286.Nm
287driver first appeared in
288.Nx 1.4 .
289.Sh COPYRIGHT
290.Bd -unfilled
291
292The RAIDframe Copyright is as follows:
293
294Copyright (c) 1994-1996 Carnegie-Mellon University.
295All rights reserved.
296
297Permission to use, copy, modify and distribute this software and
298its documentation is hereby granted, provided that both the copyright
299notice and this permission notice appear in all copies of the
300software, derivative works or modified versions, and any portions
301thereof, and that both notices appear in supporting documentation.
302
303CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
304CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
305FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
306
307Carnegie Mellon requests users of this software to return to
308
309 Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
310 School of Computer Science
311 Carnegie Mellon University
312 Pittsburgh PA 15213-3890
313
314any improvements or extensions that they make and grant Carnegie the
315rights to redistribute these changes.
316
317.Ed
318