Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sbin / ccdconfig / ccdconfig.8
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: src/sbin/ccdconfig/ccdconfig.8,v 1.9.2.10 2003/01/26 03:38:39 keramida Exp $
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 Fl M Ar core
65 .Op Fl N Ar system
66 .Op Ar ccd Op Ar ...
67 .Sh DESCRIPTION
68 The
69 .Nm
70 utility is used to dynamically configure and unconfigure concatenated disk
71 devices, or ccds.  For more information about the ccd, see
72 .Xr ccd 4 .
73 .Pp
74 The options are as follows:
75 .Bl -tag -width indent
76 .It Fl c
77 Configure a ccd.  This is the default behavior of
78 .Nm .
79 .It Fl C
80 Configure all ccd devices listed in the ccd configuration file.
81 .It Fl f Ar config_file
82 When configuring or unconfiguring all devices, read the file
83 .Pa config_file
84 instead of the default
85 .Pa /etc/ccd.conf .
86 .It Fl g
87 Dump the current ccd configuration in a format suitable for use as the
88 ccd configuration file.  If no arguments are specified, every configured
89 ccd is dumped.  Otherwise, the configuration of each listed ccd is dumped.
90 .It Fl M Ar core
91 Extract values associated with the name list from
92 .Pa core
93 instead of the default
94 .Pa /dev/mem .
95 .It Fl N Ar system
96 Use
97 .Ar system
98 as the kernel instead of the running kernel (as determined from
99 .Xr getbootfile 3 ) .
100 .It Fl u
101 Unconfigure a ccd.
102 .It Fl U
103 Unconfigure all ccd devices listed the ccd configuration file.
104 .It Fl v
105 Cause
106 .Nm
107 to be verbose.
108 .El
109 .Pp
110 A ccd is described on the command line and in the ccd configuration
111 file by the name of the ccd, the interleave factor, the ccd configuration
112 flags, and a list of one or more devices.  The flags may be represented
113 as a decimal number, a hexadecimal number, a comma-separated list
114 of strings, or the word
115 .Dq none .
116 The flags are as follows:
117 .Bd -unfilled -offset indent
118 CCDF_SWAP               0x01            Interleave should be dmmax
119 CCDF_UNIFORM    0x02            Use uniform interleave
120 CCDF_MIRROR     0x04            Support mirroring
121 CCDF_PARITY     0x08            Support parity (not implemented yet)
122 .Ed
123 .Pp
124 The format in the
125 configuration file appears exactly as if it were entered on the command line.
126 Note that on the command line and in the configuration file, the
127 .Pa flags
128 argument is optional.
129 .Bd -unfilled -offset indent
130 #
131 # /etc/ccd.conf
132 # Configuration file for concatenated disk devices
133 #
134 .Pp
135 # ccd           ileave  flags   component devices
136 ccd0            16      none    /dev/da2e /dev/da3e
137 .Ed
138 .Pp
139 The component devices need to name partitions of type
140 .Li FS_BSDFFS
141 (or
142 .Dq 4.2BSD
143 as shown by
144 .Xr disklabel 8 ) .
145 .Sh EXAMPLES
146 A number of
147 .Nm
148 examples are shown below.  The arguments passed
149 to
150 .Nm
151 are exactly the same as you might place in the
152 .Pa /etc/ccd.conf
153 configuration file.  The first example creates a 4-disk stripe out of
154 four scsi disk partitions.  The stripe uses a 64 sector interleave.
155 The second example is an example of a complex stripe/mirror combination.
156 It reads as a two disk stripe of da2e and da3e which is mirrored
157 to a two disk stripe of da4e and da5e.  The last example is a simple
158 mirror.  /dev/da2e is mirrored with /dev/da4e and assigned to ccd0.
159 .Pp
160 .Bd -unfilled -offset
161 # ccdconfig ccd0 64 none /dev/da2e /dev/da3e /dev/da4e /dev/da5e
162 # ccdconfig ccd0 128 CCDF_MIRROR /dev/da2e /dev/da3e /dev/da4e /dev/da5e
163 # ccdconfig ccd0 128 CCDF_MIRROR /dev/da2e /dev/da4e
164 .Ed
165 .Pp
166 When you create a new ccd disk you generally want to
167 .Xr disklabel 8
168 it before doing anything else.  Once you create the initial label you can
169 edit it, adding additional partitions.  The label itself takes up the first
170 16 sectors of the ccd disk.  If all you are doing is creating file systems
171 with newfs, you do not have to worry about this as newfs will skip the
172 label area.  However, if you intend to
173 .Xr dd 1
174 to or from a ccd partition it is usually a good idea to construct the
175 partition such that it does not overlap the label area.  For example, if
176 you have A ccd disk with 10000 sectors you might create a 'd' partition
177 with offset 16 and size 9984.
178 .Pp
179 .Bd -unfilled -offset
180 # disklabel -r -w ccd0c auto
181 # disklabel -e ccd0c
182 .Ed
183 .Pp
184 The disklabeling of a ccd disk is usually a one-time affair.  Unlike other
185 devices, ccd currently requires that you specify partition 'c' when
186 running disklabel.  If you reboot the machine and reconfigure the ccd disk,
187 the disklabel you
188 had created before will still be there and not require reinitialization.
189 Beware that changing any ccd parameters: interleave, flags, or the
190 device list making up the ccd disk, will usually destroy any prior
191 data on that ccd disk.  If this occurs it is usually a good idea to
192 reinitialize the label before [re]constructing your ccd disk.
193 .Sh RECOVERY
194 An error on a ccd disk is usually unrecoverable unless you are using the
195 mirroring option.  But mirroring has its own perils:  It assumes that
196 both copies of the data at any given sector are the same.  This holds true
197 until a write error occurs or until you replace either side of the mirror.
198 This is a poor-man's mirroring implementation.  It works well enough that if
199 you begin to get disk errors you should be able to backup the ccd disk,
200 replace the broken hardware, and then regenerate the ccd disk.  If you need
201 more than this you should look into external hardware RAID SCSI boxes,
202 RAID controllers such as the
203 .Xr dpt 4
204 controller, or software RAID systems such as
205 .Xr vinum 8 .
206 .Sh FILES
207 .Bl -tag -width /etc/ccd.conf -compact
208 .It Pa /etc/ccd.conf
209 default ccd configuration file
210 .El
211 .Sh SEE ALSO
212 .Xr dd 1 ,
213 .Xr ccd 4 ,
214 .Xr dpt 4 ,
215 .Xr disklabel 8 ,
216 .Xr rc 8 ,
217 .Xr vinum 8
218 .Sh HISTORY
219 The
220 .Nm
221 utility first appeared in
222 .Nx 1.0a .