1.\"	$OpenBSD: ccd.4,v 1.18 2004/03/21 19:47:59 miod Exp $
2.\"	$NetBSD: ccd.4,v 1.5 1995/10/09 06:09:09 thorpej Exp $
3.\"
4.\" Copyright (c) 1994 Jason Downs.
5.\" Copyright (c) 1994, 1995 Jason R. Thorpe.
6.\" All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. All advertising materials mentioning features or use of this software
17.\"    must display the following acknowledgement:
18.\"	This product includes software developed for the NetBSD Project
19.\"	by Jason Downs and Jason R. Thorpe.
20.\" 4. Neither the name of the author nor the names of its contributors
21.\"    may be used to endorse or promote products derived from this software
22.\"    without specific prior written permission.
23.\"
24.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE.
35.\"
36.Dd August 9, 1995
37.Dt CCD 4
38.Os
39.Sh NAME
40.Nm ccd
41.Nd concatenated disk driver
42.Sh SYNOPSIS
43.Cd "pseudo-device ccd" Op Ar count
44.Sh DESCRIPTION
45The
46.Nm
47driver provides the capability of combining one or more disks/partitions
48into one virtual disk.
49.Pp
50This document assumes that you're familiar with how to generate kernels,
51how to properly configure disks and pseudo-devices in a kernel
52configuration file, and how to partition disks.
53.Pp
54Note that the
55.Sq raw
56partitions of the disks
57.Em should not
58be combined.
59Each component partition should be offset at least one
60cylinder from the beginning of the component disk.
61This avoids potential conflicts between the component disk's disklabel and the
62.Nm ccd Ns 's
63disklabel.
64The kernel wants to only allow component partitions of type
65.Dv FS_CCD ,
66but due to disklabel restrictions on some architectures will also accept
67component partitions of
68.Dv FS_BSDFFS .
69.Pp
70In order to compile in support for the ccd, you must add a line similar
71to the following to your kernel configuration file:
72.Bd -unfilled -offset indent
73pseudo-device	ccd	4	# concatenated disk devices
74.Ed
75.Pp
76The count argument is how many
77.Nm ccd Ns 's
78memory is allocated for at boot time.
79In this example, no more than 4
80.Nm ccd Ns 's
81may be configured.
82.Pp
83A
84.Nm
85may be either serially concatenated or interleaved.
86To serially concatenate partitions specify an interleave factor of 0.
87.Pp
88If a
89.Nm
90is interleaved correctly, a
91.Dq striping
92effect is achieved, which can increase performance.
93Finding the optimum interleave factor is a hard problem.
94Some things to think about are the number of disks in the ccd,
95the typical read-ahead opportunities, the filesystem blocksize, and if
96it's possible to use the optimized ccd I/O protocol.
97The optimized protocol allows smaller interleave factors for a
98comparably cheap price but requires that the factor be a multiple of the
99software page size
100.Pf ( Dv CLBYTES ) ,
101and that mirroring is not requested.
102So far the best policy is to test with different interleaves and
103benchmark typical uses.
104A rule of thumb might be to use the software pagesize with the optimized
105I/O protocol (the default, unless the requirements mentioned above are not
106fulfilled) or
107.Dv MAXBSIZE /
108#components with the unoptimized protocol.
109Since the interleave factor is expressed in units of
110.Dv DEV_BSIZE ,
111one must account for sector sizes other than
112.Dv DEV_BSIZE
113in order to calculate the correct interleave.
114The kernel will not allow an interleave factor less than the size
115of the largest component sector divided by
116.Dv DEV_BSIZE .
117.Pp
118Note that best performance is achieved if all component disks have the same
119geometry and size.
120Optimum striping cannot occur with different disk types.
121.Pp
122There is a run-time utility that is used for configuring
123.Nm ccd Ns 's .
124See
125.Xr ccdconfig 8
126for more information.
127.Sh WARNINGS
128If just one (or more) of the disks in a
129.Nm
130fails, the entire
131file system will be lost.
132.Sh FILES
133.Bl -tag -width tenletters+five -compact
134.It Pa /dev/{,r}ccd*
135ccd device special files
136.El
137.Sh SEE ALSO
138.Xr MAKEDEV 8 ,
139.Xr ccdconfig 8 ,
140.Xr config 8 ,
141.Xr fsck 8 ,
142.Xr mount 8 ,
143.Xr newfs 8
144.Sh HISTORY
145The concatenated disk driver was originally written at the University of
146Utah.
147