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