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.\" 37.Dd February 15, 2013 38.Dt CCD 4 39.Os 40.Sh NAME 41.Nm ccd 42.Nd Concatenated Disk driver 43.Sh SYNOPSIS 44To compile this driver into the kernel, 45place the following lines in your 46kernel configuration file (for 4 instances): 47.Bd -ragged -offset indent 48.Cd "pseudo-device ccd 4" 49.Ed 50.Pp 51Alternatively, to load the driver as a 52module at boot time, place the following line in 53.Xr loader.conf 5 : 54.Bd -literal -offset indent 55ccd_load="YES" 56.Ed 57.Sh DESCRIPTION 58The 59.Nm 60driver provides the capability of combining one or more disks/partitions 61into one virtual disk. 62.Pp 63This document assumes that you're familiar with how to generate kernels, 64how to properly configure disks and pseudo-devices in a kernel 65configuration file, and how to partition disks. 66.Pp 67Note that the 68.Sq raw 69partitions of the disks 70.Em should not 71be combined. 72The kernel will only allow component partitions of type FS_CCD (type 73.Dq ccd 74as shown by 75.Xr disklabel 8 ) . 76.Pp 77A 78.Nm 79may be either serially concatenated or interleaved. 80To serially concatenate the partitions, specify the interleave factor of 0. 81Note that mirroring may not be used with an interleave factor of 0. 82.Pp 83.Xr ccdconfig 8 84is a run-time utility that is used for configuring 85.Nm Ns s . 86Running it will load the 87.Nm 88module if it is not already loaded or 89.Nm 90is compiled into the kernel. 91.Ss The Interleave Factor 92If a 93.Nm 94is interleaved correctly, a 95.Dq striping 96effect is achieved, which can increase sequential read/write 97performance. 98The interleave factor is expressed in units of DEV_BSIZE (usually 512 bytes). 99For large writes, the optimum interleave factor 100is typically the size of a track, while for large reads, it is about a 101quarter of a track. 102(Note that this changes greatly depending on the 103number and speed of disks.) For instance, with eight 7,200 RPM drives 104on two Fast-Wide SCSI buses, this translates to about 128 for writes 105and 32 for reads. 106A larger interleave tends to work better when the 107disk is taking a multitasking load by localizing the file I/O from 108any given process onto a single disk. 109You 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). 116The 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. 123Optimum striping cannot occur with different disk types. 124.Pp 125For random-access oriented workloads, such as news servers, a larger 126interleave factor (e.g., 65,536) is more desirable. 127Note that there isn't much 128.Nm 129can do to speed up applications that are seek-time limited. 130Larger 131interleave factors will at least reduce the chance of having to seek 132two disk-heads to read one directory or a file. 133.Ss Disk Mirroring 134You can configure the 135.Nm 136to 137.Dq mirror 138any even number of disks. 139See 140.Xr ccdconfig 8 141for how to specify the necessary flags. 142For example, if you have a ccd 143configuration specifying four disks, the first two disks will be mirrored with 144the second two disks. 145A write will be run to both sides of the 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 if you have a filesystem on a two-disk mirrored 165.Nm 166and one of the disks fail, you cannot mount and use the remaining 167partition as itself; you have to configure it as a one-disk 168.Nm . 169You cannot replace a disk in a mirrored 170.Nm 171partition without first backing up the partition, then replacing the disk, 172then restoring the partition. 173.Sh WARNINGS 174If just one (or more) of the disks in a 175.Nm 176fails, the entire 177file system will be lost unless you are mirroring the disks. 178.Pp 179If one of the disks in a mirror is lost, you should still 180be able to backup your data. 181If a write error occurs, however, data 182read from that sector may be non-deterministic. 183It may return the data 184prior to the write or it may return the data that was written. 185When a 186write error occurs, you should recover and regenerate the data as soon 187as possible. 188.Pp 189Changing the interleave or other parameters for a 190.Nm 191disk usually destroys whatever data previously existed on that disk. 192.Sh FILES 193.Bl -tag -width ".Pa /dev/ccd*" 194.It Pa /dev/ccd* 195.Nm 196device special files 197.El 198.Sh SEE ALSO 199.Xr dd 1 , 200.Xr ccdconfig 8 , 201.Xr config 8 , 202.Xr disklabel 8 , 203.Xr fsck 8 , 204.Xr mount 8 , 205.Xr newfs 8 , 206.Xr vinum 8 207.Sh HISTORY 208The concatenated disk driver was originally written at the University of 209Utah. 210