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