Use .Cd for kernel configuration options.
[dragonfly.git] / share / man / man4 / ccd.4
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 .\" $FreeBSD: src/share/man/man4/ccd.4,v 1.11.2.8 2001/12/17 11:30:11 ru Exp $
36 .\" $DragonFly: src/share/man/man4/ccd.4,v 1.4 2006/07/22 23:52:23 swildner Exp $
37 .\"
38 .Dd August 9, 1995
39 .Dt CCD 4
40 .Os
41 .Sh NAME
42 .Nm ccd
43 .Nd Concatenated Disk driver
44 .Sh SYNOPSIS
45 .Cd "pseudo-device ccd 4"
46 .Sh DESCRIPTION
47 The
48 .Nm
49 driver provides the capability of combining one or more disks/partitions
50 into one virtual disk.
51 .Pp
52 This document assumes that you're familiar with how to generate kernels,
53 how to properly configure disks and pseudo-devices in a kernel
54 configuration file, and how to partition disks.
55 .Pp
56 Note that the
57 .Sq raw
58 partitions of the disks
59 .Pa should not
60 be combined.  The kernel will only allow component partitions of type
61 FS_BSDFFS (type
62 .Dq Bx 4.2
63 as shown as
64 .Xr disklabel 8 ) .
65 .Pp
66 In order to compile in support for the ccd, you must add a line similar
67 to the following to your kernel configuration file:
68 .Pp
69 .D1 Cd "pseudo-device ccd 4     # concatenated disk devices"
70 .Pp
71 The count argument is how many
72 .Nm Ns 's
73 memory is allocated for a boot time.  In this example, no more than 4
74 .Nm Ns s
75 may be configured.  As of the
76 .Fx 3.0
77 release, you do not need to
78 configure your kernel with ccd but may instead use it as a kernel loadable
79 module.  Simply running
80 .Nm ccdconfig
81 will load the module into the kernel.
82 .Pp
83 A
84 .Nm
85 may be either serially concatenated or interleaved.  To serially
86 concatenate the partitions, specify the interleave factor of 0.
87 Note that mirroring may not be used with an interleave factor of 0.
88 .Pp
89 There is a run-time utility that is used for configuring
90 .Nm Ns s .
91 See
92 .Xr ccdconfig 8
93 for more information.
94 .Ss The Interleave Factor
95 If a
96 .Nm
97 is interleaved correctly, a
98 .Dq striping
99 effect is achieved, which can increase sequential read/write
100 performance.  The interleave factor is expressed in units of DEV_BSIZE
101 (usually 512 bytes).  For large writes, the optimum interleave factor
102 is typically the size of a track, while for large reads, it is about a
103 quarter of a track.
104 (Note that this changes greatly depending on the
105 number and speed of disks.)  For instance, with eight 7,200 RPM drives
106 on two Fast-Wide SCSI buses, this translates to about 128 for writes
107 and 32 for reads.  A larger interleave tends to work better when the
108 disk is taking a multitasking load by localizing the file I/O from
109 any given process onto a single disk.  You lose sequential performance when
110 you do this, but sequential performance is not usually an issue with a
111 multitasking load.
112 .Pp
113 An interleave factor must be specified when using a mirroring configuration,
114 even when you have only two disks (i.e. the layout winds up being the same
115 no matter what the interleave factor).  The interleave factor will determine
116 how I/O is broken up, however, and a value 128 or greater is recommended.
117 .Pp
118 CCD has an option for a parity disk, but does not currently implement it.
119 .Pp
120 The best performance is achieved if all component disks have the same
121 geometry and size.  Optimum striping cannot occur with different
122 disk types.
123 .Pp
124 For random-access oriented workloads, such as news servers, a larger
125 interleave factor (e.g., 65,536) is more desirable.  Note that there
126 isn't much
127 .Nm
128 can do to speed up applications that are seek-time limited.  Larger
129 interleave factors will at least reduce the chance of having to seek
130 two disk-heads to read one directory or a file.
131 .Ss Disk Mirroring
132 You can configure the
133 .Nm
134 to
135 .Dq mirror
136 any even number of disks.  See
137 .Xr ccdconfig 8
138 for how to specify the necessary flags.   For example, if you have a ccd
139 configuration specifying four disks, the first two disks will be mirrored with
140 the second two disks.  A write will be run to both sides of
141 the mirror.  A read will be run to either side of the mirror depending
142 on what the driver believes to be most optimal.  If the read fails,
143 the driver will automatically attempt to read the same sector from the
144 other side of the mirror.  Currently
145 .Nm
146 uses a duel seek zone model to optimize reads for a multi-tasking load
147 rather then a sequential load.
148 .Pp
149 In an event of a disk
150 failure, you can use
151 .Xr dd 1
152 to recover the failed disk.
153 .Pp
154 Note that a one-disk
155 .Nm
156 is not the same as the original partition.  In particular, this means
157 if you have a filesystem on a two-disk mirrored
158 .Nm
159 and one of the disks fail, you cannot mount and use the remaining
160 partition as itself; you have to configure it as a one-disk
161 .Nm .
162 You cannot replace a disk in a mirrored
163 .Nm
164 partition without first backing up the partition, then replacing the disk,
165 then restoring the partition.
166 .Sh WARNINGS
167 If just one (or more) of the disks in a
168 .Nm
169 fails, the entire
170 file system will be lost unless you are mirroring the disks.
171 .Pp
172 If one of the disks in a mirror is lost, you should still
173 be able to backup your data.  If a write error occurs, however, data
174 read from that sector may be non-deterministic.  It may return the data
175 prior to the write or it may return the data that was written.  When a
176 write error occurs, you should recover and regenerate the data as soon
177 as possible.
178 .Pp
179 Changing the interleave or other parameters for a
180 .Nm
181 disk usually destroys whatever data previously existed on that disk.
182 .Sh FILES
183 .Bl -tag -width ".Pa /dev/ccd*"
184 .It Pa /dev/ccd*
185 .Nm
186 device special files
187 .El
188 .Sh SEE ALSO
189 .Xr dd 1 ,
190 .Xr ccdconfig 8 ,
191 .Xr config 8 ,
192 .Xr disklabel 8 ,
193 .Xr fsck 8 ,
194 .Xr MAKEDEV 8 ,
195 .Xr mount 8 ,
196 .Xr newfs 8 ,
197 .Xr vinum 8
198 .Sh HISTORY
199 The concatenated disk driver was originally written at the University of
200 Utah.