1.\" $NetBSD: ccdconfig.8,v 1.1.2.1 1995/11/11 02:43:33 thorpej Exp $ 2.\" 3.\" Copyright (c) 1995 Jason R. Thorpe. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgment: 16.\" This product includes software developed for the NetBSD Project 17.\" by Jason R. Thorpe. 18.\" 4. The name of the author may not be used to endorse or promote products 19.\" derived from this software without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.\" $FreeBSD$ 34.\" 35.Dd July 17, 1995 36.Dt CCDCONFIG 8 37.Os 38.Sh NAME 39.Nm ccdconfig 40.Nd configuration utility for the concatenated disk driver 41.Sh SYNOPSIS 42.Nm 43.Op Fl cv 44.Ar ccd 45.Ar ileave 46.Op Ar flags 47.Ar dev 48.Op Ar 49.Nm 50.Fl C 51.Op Fl v 52.Op Fl f Ar config_file 53.Nm 54.Fl u 55.Op Fl v 56.Ar ccd 57.Op Ar 58.Nm 59.Fl U 60.Op Fl v 61.Op Fl f Ar config_file 62.Nm 63.Fl g 64.Op Ar ccd Op Ar ... 65.Sh DESCRIPTION 66The 67.Nm 68utility is used to dynamically configure and unconfigure concatenated disk 69devices, or ccds. For more information about the ccd, see 70.Xr ccd 4 . 71.Pp 72The options are as follows: 73.Bl -tag -width indent 74.It Fl c 75Configure a ccd. This is the default behavior of 76.Nm . 77.It Fl C 78Configure all ccd devices listed in the ccd configuration file. 79.It Fl f Ar config_file 80When configuring or unconfiguring all devices, read the file 81.Pa config_file 82instead of the default 83.Pa /etc/ccd.conf . 84.It Fl g 85Dump the current ccd configuration in a format suitable for use as the 86ccd configuration file. If no arguments are specified, every configured 87ccd is dumped. Otherwise, the configuration of each listed ccd is dumped. 88.It Fl u 89Unconfigure a ccd. 90.It Fl U 91Unconfigure all ccd devices listed the ccd configuration file. 92.It Fl v 93Cause 94.Nm 95to be verbose. 96.El 97.Pp 98A ccd is described on the command line and in the ccd configuration 99file by the name of the ccd, the interleave factor, the ccd configuration 100flags, and a list of one or more devices. The flags may be represented 101as a decimal number, a hexadecimal number, a comma-separated list 102of strings, or the word 103.Dq none . 104The flags are as follows: 105.Bd -unfilled -offset indent 106CCDF_UNIFORM 0x02 Use uniform interleave 107CCDF_MIRROR 0x04 Support mirroring 108.Ed 109.Pp 110The format in the 111configuration file appears exactly as if it were entered on the command line. 112Note that on the command line and in the configuration file, the 113.Pa flags 114argument is optional. 115.Bd -unfilled -offset indent 116# 117# /etc/ccd.conf 118# Configuration file for concatenated disk devices 119# 120.Pp 121# ccd ileave flags component devices 122ccd0 16 none /dev/da2s1 /dev/da3s1 123.Ed 124.Pp 125The component devices need to name partitions of type 126.Li FS_BSDFFS 127(or 128.Dq 4.2BSD 129as shown by 130.Xr disklabel 8 ) . 131.Sh EXAMPLES 132A number of 133.Nm 134examples are shown below. The arguments passed 135to 136.Nm 137are exactly the same as you might place in the 138.Pa /etc/ccd.conf 139configuration file. The first example creates a 4-disk stripe out of 140four scsi disk partitions. The stripe uses a 64 sector interleave. 141The second example is an example of a complex stripe/mirror combination. 142It reads as a two disk stripe of da4 and da5 which is mirrored 143to a two disk stripe of da6 and da7. The last example is a simple 144mirror. The 2nd slice of /dev/da8 is mirrored with the 3rd slice of /dev/da9 145and assigned to ccd0. 146.Pp 147.Bd -unfilled -offset 148# ccdconfig ccd0 64 none /dev/da0s1 /dev/da1s1 /dev/da2s1 /dev/da3s1 149# ccdconfig ccd0 128 CCDF_MIRROR /dev/da4 /dev/da5 /dev/da6 /dev/da7 150# ccdconfig ccd0 128 CCDF_MIRROR /dev/da8s2 /dev/da9s3 151.Ed 152.Pp 153When you create a new ccd disk you generally want to 154.Xr fdisk 8 155and 156.Xr disklabel 8 157it before doing anything else. Once you create the initial label you can 158edit it, adding additional partitions. The label itself takes up the first 15916 sectors of the ccd disk. If all you are doing is creating file systems 160with newfs, you do not have to worry about this as newfs will skip the 161label area. However, if you intend to 162.Xr dd 1 163to or from a ccd partition it is usually a good idea to construct the 164partition such that it does not overlap the label area. For example, if 165you have A ccd disk with 10000 sectors you might create a 'd' partition 166with offset 16 and size 9984. 167.Pp 168.Bd -unfilled -offset 169# disklabel ccd0 > /tmp/disklabel.ccd0 170# disklabel -Rr ccd0 /tmp/disklabel.ccd0 171# disklabel -e ccd0 172.Ed 173.Pp 174The disklabeling of a ccd disk is usually a one-time affair. 175If you reboot the machine and reconfigure the ccd disk, 176the disklabel you 177had created before will still be there and not require reinitialization. 178Beware that changing any ccd parameters: interleave, flags, or the 179device list making up the ccd disk, will usually destroy any prior 180data on that ccd disk. If this occurs it is usually a good idea to 181reinitialize the label before [re]constructing your ccd disk. 182.Sh RECOVERY 183An error on a ccd disk is usually unrecoverable unless you are using the 184mirroring option. But mirroring has its own perils: It assumes that 185both copies of the data at any given sector are the same. This holds true 186until a write error occurs or until you replace either side of the mirror. 187This is a poor-man's mirroring implementation. It works well enough that if 188you begin to get disk errors you should be able to backup the ccd disk, 189replace the broken hardware, and then regenerate the ccd disk. If you need 190more than this you should look into external hardware RAID SCSI boxes, 191RAID controllers (see GENERIC), 192or software RAID systems such as 193RAIDframe 194.Xr raid 4 195and 196.Xr vinum 8 . 197.Sh FILES 198.Bl -tag -width /etc/ccd.conf -compact 199.It Pa /etc/ccd.conf 200default ccd configuration file 201.El 202.Sh SEE ALSO 203.Xr dd 1 , 204.Xr ccd 4 , 205.Xr raid 4 , 206.Xr disklabel 8 , 207.Xr fdisk 8 , 208.Xr rc 8 , 209.Xr vinum 8 210.Sh BUGS 211The initial disklabel returned by 212.Xr ccd 4 213specifies only 3 partitions. 214One needs to change the number of paritions to 8 using 215.Dq Nm disklabel Fl e 216to get the usual 217.Bx 218expectations. 219.Sh HISTORY 220The 221.Nm 222utility first appeared in 223.Nx 1.0a . 224