xref: /freebsd/share/man/man4/ccd.4 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1.\"	$NetBSD: ccd.4,v 1.5 1995/10/09 06:09:09 thorpej Exp $
2.\"
3.\" Copyright (c) 1994 Jason Downs.
4.\" Copyright (c) 1994, 1995 Jason R. Thorpe.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed for the NetBSD Project
18.\"	by Jason Downs and Jason R. Thorpe.
19.\" 4. Neither the name of the author nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.Dd August 9, 1995
36.Dt CCD 4
37.Os
38.Sh NAME
39.Nm ccd
40.Nd Concatenated Disk driver
41.Sh SYNOPSIS
42.Cd "device ccd"
43.Sh DESCRIPTION
44The
45.Nm
46driver provides the capability of combining one or more disks/partitions
47into one virtual disk.
48.Pp
49This document assumes that you are familiar with how to generate kernels,
50how to properly configure disks and devices in a kernel
51configuration file, and how to partition disks.
52.Pp
53In order to compile in support for the
54.Nm ,
55you must add a line similar
56to the following to your kernel configuration file:
57.Pp
58.Dl "device	ccd		# concatenated disk devices"
59.Pp
60As of the
61.Fx 3.0
62release, you do not need to
63configure your kernel with
64.Nm
65but may instead use it as a kernel loadable
66module.
67Simply running
68.Xr ccdconfig 8
69will load the module into the kernel.
70.Pp
71A
72.Nm
73may be either serially concatenated or interleaved.
74To serially
75concatenate the partitions, specify the interleave factor of 0.
76Note that mirroring may not be used with an interleave factor of 0.
77.Pp
78There is a run-time utility that is used for configuring
79.Nm Ns s .
80See
81.Xr ccdconfig 8
82for more information.
83.Ss The Interleave Factor
84If a
85.Nm
86is interleaved correctly, a
87.Dq striping
88effect is achieved, which can increase sequential read/write
89performance.
90The interleave factor is expressed in units of
91.Dv DEV_BSIZE
92(usually 512 bytes).
93For large writes, the optimum interleave factor
94is typically the size of a track, while for large reads, it is about a
95quarter of a track.
96(Note that this changes greatly depending on the
97number and speed of disks.)
98For instance, with eight 7,200 RPM drives
99on two Fast-Wide SCSI buses, this translates to about 128 for writes
100and 32 for reads.
101A larger interleave tends to work better when the
102disk is taking a multitasking load by localizing the file I/O from
103any given process onto a single disk.
104You lose sequential performance when
105you do this, but sequential performance is not usually an issue with a
106multitasking load.
107.Pp
108An interleave factor must be specified when using a mirroring configuration,
109even when you have only two disks (i.e., the layout winds up being the same
110no matter what the interleave factor).
111The interleave factor will determine
112how I/O is broken up, however, and a value 128 or greater is recommended.
113.Pp
114.Nm
115has an option for a parity disk, but does not currently implement it.
116.Pp
117The best performance is achieved if all component disks have the same
118geometry and size.
119Optimum striping cannot occur with different
120disk types.
121.Pp
122For random-access oriented workloads, such as news servers, a larger
123interleave factor (e.g., 65,536) is more desirable.
124Note that there
125is not much
126.Nm
127can do to speed up applications that are seek-time limited.
128Larger
129interleave factors will at least reduce the chance of having to seek
130two disk-heads to read one directory or a file.
131.Ss Disk Mirroring
132You can configure the
133.Nm
134to
135.Dq mirror
136any even number of disks.
137See
138.Xr ccdconfig 8
139for how to specify the necessary flags.
140For example, if you have a
141.Nm
142configuration specifying four disks, the first two disks will be mirrored with
143the second two disks.
144A write will be run to both sides of
145the mirror.
146A read will be run to either side of the mirror depending
147on what the driver believes to be most optimal.
148If the read fails,
149the driver will automatically attempt to read the same sector from the
150other side of the mirror.
151Currently
152.Nm
153uses a dual seek zone model to optimize reads for a multi-tasking load
154rather than a sequential load.
155.Pp
156In an event of a disk
157failure, you can use
158.Xr dd 1
159to recover the failed disk.
160.Pp
161Note that a one-disk
162.Nm
163is not the same as the original partition.
164In particular, this means
165if you have a file system on a two-disk mirrored
166.Nm
167and one of the disks fail, you cannot mount and use the remaining
168partition as itself; you have to configure it as a one-disk
169.Nm .
170You cannot replace a disk in a mirrored
171.Nm
172partition without first backing up the partition, then replacing the disk,
173then restoring the partition.
174.Ss Linux Compatibility
175The
176.Tn Linux
177compatibility mode does not try to read the label that
178.Tn Linux Ns '
179.Xr md 4
180driver leaves on the raw devices.
181You will have to give the order
182of devices and the interleave factor on your own.
183When in
184.Tn Linux
185compatibility mode,
186.Nm
187will convert the interleave factor from
188.Tn Linux
189terminology.
190That means you give the same interleave factor that you
191gave as chunk size in
192.Tn Linux .
193.Pp
194If you have a
195.Tn Linux
196.Xr md 4
197device in
198.Dq legacy
199mode, do not use the
200.Dv CCDF_LINUX
201flag in
202.Xr ccdconfig 8 .
203Use the
204.Dv CCDF_NO_OFFSET
205flag instead.
206In that case you have to convert
207the interleave factor on your own, usually it is
208.Tn Linux Ns '
209chunk size multiplied by two.
210.Pp
211Using a
212.Tn Linux
213RAID this way is potentially dangerous and can destroy
214the data in there.
215Since
216.Fx
217does not read the label used by
218.Tn Linux ,
219changes in
220.Tn Linux
221might invalidate the compatibility layer.
222.Pp
223However, using this is reasonably safe if you test the compatibility
224before mounting a RAID read-write for the first time.
225Just using
226.Xr ccdconfig 8
227without mounting does not write anything to the
228.Tn Linux
229RAID.
230Then you do a
231.Nm fsck.ext2fs Pq Pa ports/sysutils/e2fsprogs
232on the
233.Nm
234device using the
235.Fl n
236flag.
237You can mount the file system read-only to check files in there.
238If all this works, it is unlikely that there is a problem with
239.Nm .
240Keep in mind that even when the
241.Tn Linux
242compatibility mode in
243.Nm
244is working correctly, bugs in
245.Fx Ap s
246.Nm ex2fs
247implementation would still destroy
248your data.
249.Sh WARNINGS
250If just one (or more) of the disks in a
251.Nm
252fails, the entire
253file system will be lost unless you are mirroring the disks.
254.Pp
255If one of the disks in a mirror is lost, you should still
256be able to back up your data.
257If a write error occurs, however, data
258read from that sector may be non-deterministic.
259It may return the data
260prior to the write or it may return the data that was written.
261When a
262write error occurs, you should recover and regenerate the data as soon
263as possible.
264.Pp
265Changing the interleave or other parameters for a
266.Nm
267disk usually destroys whatever data previously existed on that disk.
268.Sh FILES
269.Bl -tag -width ".Pa /dev/ccd*"
270.It Pa /dev/ccd*
271.Nm
272device special files
273.El
274.Sh SEE ALSO
275.Xr dd 1 ,
276.Xr ccdconfig 8 ,
277.Xr config 8 ,
278.Xr disklabel 8 ,
279.Xr fsck 8 ,
280.Xr gvinum 8 ,
281.Xr mount 8 ,
282.Xr newfs 8
283.Sh HISTORY
284The concatenated disk driver was originally written at the University of
285Utah.
286