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