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