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