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