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