ccdconfig.8 (d5bd01d2136ab3597c686edfa5b63ba33312c4f8) ccdconfig.8 (89a7b2b7140aff11a0c927c44f4c573dcc969434)
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.
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 acknowledgement:
16.\" This product includes software developed for the NetBSD Project
17.\" by Jason R. Thorpe.
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.\"
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.\"
29.\" $FreeBSD$
30.\"
31.Dd July 17, 1995
32.Dt CCDCONFIG 8
33.Dd July 17, 1995
34.Dt CCDCONFIG 8
33.Os
35.Os NetBSD
34.Sh NAME
35.Nm ccdconfig
36.Nd configuration utility for the concatenated disk driver
37.Sh SYNOPSIS
36.Sh NAME
37.Nm ccdconfig
38.Nd configuration utility for the concatenated disk driver
39.Sh SYNOPSIS
38.Nm
40.Nm ccdconfig
39.Op Fl cv
40.Ar ccd
41.Ar ileave
42.Op Ar flags
41.Op Fl cv
42.Ar ccd
43.Ar ileave
44.Op Ar flags
43.Ar dev ...
44.Nm
45.Ar dev
46.Op Ar ...
47.Nm ccdconfig
45.Fl C
46.Op Fl v
47.Op Fl f Ar config_file
48.Fl C
49.Op Fl v
50.Op Fl f Ar config_file
48.Nm
51.Nm ccdconfig
49.Fl u
50.Op Fl v
52.Fl u
53.Op Fl v
51.Ar ccd ...
52.Nm
54.Ar ccd
55.Op Ar ...
56.Nm ccdconfig
53.Fl U
54.Op Fl v
55.Op Fl f Ar config_file
57.Fl U
58.Op Fl v
59.Op Fl f Ar config_file
56.Nm
60.Nm ccdconfig
57.Fl g
61.Fl g
58.Op Ar ccd ...
62.Op Fl M Ar core
63.Op Fl N Ar system
64.Oo
65.Ar ccd Oo ...
66.Oc
67.Oc
59.Sh DESCRIPTION
68.Sh DESCRIPTION
60The
61.Nm
62utility is used to dynamically configure and unconfigure concatenated disk
63devices, or ccds.
64For more information about the ccd, see
69.Nm Ccdconfig
70is used to dynamically configure and unconfigure concatenated disk
71devices, or ccds. For more information about the ccd, see
65.Xr ccd 4 .
66.Pp
67The options are as follows:
68.Bl -tag -width indent
69.It Fl c
72.Xr ccd 4 .
73.Pp
74The options are as follows:
75.Bl -tag -width indent
76.It Fl c
70Configure a ccd.
71This is the default behavior of
72.Nm .
77Configure a ccd. This is the default behavior of
78.Nm ccdconfig .
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
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
82ccd configuration file.
83If no arguments are specified, every configured
84ccd is dumped.
85Otherwise, the configuration of each listed ccd is dumped.
88ccd configuration file. If no arguments are specified, every configured
89ccd is dumped. Otherwise, the configuration of each listed ccd is dumped.
90.It Fl M Ar core
91Extract values associated with the name list from
92.Pa core
93instead of the default
94.Pa /dev/mem .
95.It Fl N Ar system
96Extract the name list from
97.Pa system
98instead of the default
99.Pa /netbsd .
86.It Fl u
87Unconfigure a ccd.
88.It Fl U
89Unconfigure all ccd devices listed the ccd configuration file.
90.It Fl v
100.It Fl u
101Unconfigure a ccd.
102.It Fl U
103Unconfigure all ccd devices listed the ccd configuration file.
104.It Fl v
91Cause
92.Nm
105Causes
106.Nm ccdconfig
93to be verbose.
94.El
95.Pp
96A ccd is described on the command line and in the ccd configuration
97file by the name of the ccd, the interleave factor, the ccd configuration
107to be verbose.
108.El
109.Pp
110A ccd is described on the command line and in the ccd configuration
111file by the name of the ccd, the interleave factor, the ccd configuration
98flags, and a list of one or more devices.
99The flags may be represented
112flags, and a list of one or more devices. The flags may be represented
100as a decimal number, a hexadecimal number, a comma-separated list
101of strings, or the word
102.Dq none .
103The flags are as follows:
113as a decimal number, a hexadecimal number, a comma-separated list
114of strings, or the word
115.Dq none .
116The flags are as follows:
104.Bd -literal -offset indent
117.Bd -unfilled -offset indent
118CCDF_SWAP 0x01 Interleave should be dmmax
105CCDF_UNIFORM 0x02 Use uniform interleave
119CCDF_UNIFORM 0x02 Use uniform interleave
106CCDF_MIRROR 0x04 Support mirroring
107CCDF_NO_OFFSET 0x08 Do not use an offset
108CCDF_LINUX 0x0A Linux md(4) compatibility
109.Ed
110.Pp
111The format in the
112configuration file appears exactly as if it were entered on the command line.
113Note that on the command line and in the configuration file, the
114.Pa flags
115argument is optional.
120.Ed
121.Pp
122The format in the
123configuration file appears exactly as if it were entered on the command line.
124Note that on the command line and in the configuration file, the
125.Pa flags
126argument is optional.
116.Bd -literal -offset indent
127.Bd -unfilled -offset indent
117#
118# /etc/ccd.conf
119# Configuration file for concatenated disk devices
120#
128#
129# /etc/ccd.conf
130# Configuration file for concatenated disk devices
131#
121
132.Pp
122# ccd ileave flags component devices
133# ccd ileave flags component devices
123ccd0 16 none /dev/da2s1 /dev/da3s1
134ccd0 16 none /dev/sd2e /dev/sd3e
124.Ed
125.Pp
135.Ed
136.Pp
126The component devices need to name partitions of type
127.Li FS_BSDFFS
128(or
129.Dq 4.2BSD
130as shown by
131.Xr disklabel 8 ) .
132.Pp
133If you want to use the
134.Tn Linux
135.Xr md 4
136compatibility mode, please be sure
137to 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
142default ccd configuration file
143.El
144.Sh EXAMPLES
145A number of
146.Nm
147examples are shown below.
148The arguments passed
149to
150.Nm
151are exactly the same as you might place in the
152.Pa /etc/ccd.conf
153configuration file.
154The first example creates a 4-disk stripe out of
155four scsi disk partitions.
156The stripe uses a 64 sector interleave.
157The second example is an example of a complex stripe/mirror combination.
158It reads as a two disk stripe of da4 and da5 which is mirrored
159to a two disk stripe of da6 and da7.
160The last example is a simple
161mirror.
162The 2nd slice of /dev/da8 is mirrored with the 3rd slice of /dev/da9
163and assigned to ccd0.
164.Pp
165.Bd -literal
166# ccdconfig ccd0 64 none /dev/da0s1 /dev/da1s1 /dev/da2s1 /dev/da3s1
167# ccdconfig ccd0 128 CCDF_MIRROR /dev/da4 /dev/da5 /dev/da6 /dev/da7
168# ccdconfig ccd0 128 CCDF_MIRROR /dev/da8s2 /dev/da9s3
137.Sh EXAMPLE
138The following command, executed from the command line, would configure ccd0
139with 4 components (/dev/sd2e, /dev/sd3e, /dev/sd4e, /dev/sd5e), and an
140interleave factor of 32 blocks.
141.Bd -unfilled -offset indent
142# ccdconfig ccd0 32 0 /dev/sd2e /dev/sd3e /dev/sd4e /dev/sd5e
169.Ed
170.Pp
143.Ed
144.Pp
171The following are matching commands in
172.Tn Linux
173and
174.Fx
175to create a RAID-0 in
176.Tn Linux
177and read it from
178.Fx .
179.Bd -literal
180# Create a RAID-0 on Linux:
181mdadm --create --chunk=32 --level=0 --raid-devices=2 /dev/md0 \\
182 /dev/hda1 /dev/hdb1
183# Make the RAID-0 just created available on FreeBSD:
184ccdconfig -c /dev/ccd0 32 linux /dev/ad0s1 /dev/ad0s2
185.Ed
186.Pp
187When you create a new ccd disk you generally want to
188.Xr fdisk 8
189and
190.Xr disklabel 8
191it before doing anything else.
192Once you create the initial label you can
193edit it, adding additional partitions.
194The label itself takes up the first
19516 sectors of the ccd disk.
196If all you are doing is creating file systems
197with newfs, you do not have to worry about this as newfs will skip the
198label area.
199However, if you intend to
200.Xr dd 1
201to or from a ccd partition it is usually a good idea to construct the
202partition such that it does not overlap the label area.
203For example, if
204you have A ccd disk with 10000 sectors you might create a 'd' partition
205with offset 16 and size 9984.
206.Pp
207.Bd -literal
208# disklabel ccd0 > /tmp/disklabel.ccd0
209# disklabel -Rr ccd0 /tmp/disklabel.ccd0
210# disklabel -e ccd0
211.Ed
212.Pp
213The disklabeling of a ccd disk is usually a one-time affair.
214If you reboot the machine and reconfigure the ccd disk,
215the disklabel you
216had created before will still be there and not require reinitialization.
217Beware that changing any ccd parameters: interleave, flags, or the
218device list making up the ccd disk, will usually destroy any prior
219data on that ccd disk.
220If this occurs it is usually a good idea to
221reinitialize the label before [re]constructing your ccd disk.
222.Sh RECOVERY
223An error on a ccd disk is usually unrecoverable unless you are using the
224mirroring option.
225But mirroring has its own perils: It assumes that
226both copies of the data at any given sector are the same.
227This holds true
228until a write error occurs or until you replace either side of the mirror.
229This is a poor-man's mirroring implementation.
230It works well enough that if
231you begin to get disk errors you should be able to backup the ccd disk,
232replace the broken hardware, and then regenerate the ccd disk.
233If you need
234more than this you should look into external hardware RAID SCSI boxes,
235RAID controllers (see GENERIC),
236or software RAID systems such as
237.Xr geom 8
238and
239.Xr vinum 8 .
145.Sh FILES
146/etc/ccd.conf - default ccd configuration file.
240.Sh SEE ALSO
147.Sh SEE ALSO
241.Xr dd 1 ,
242.Xr ccd 4 ,
148.Xr ccd 4 ,
243.Xr disklabel 8 ,
244.Xr fdisk 8 ,
245.Xr rc 8 ,
246.Xr vinum 8
149.Xr rc 8 .
247.Sh HISTORY
248The
150.Sh HISTORY
151The
249.Nm
250utility first appeared in
152.Nm ccdconfig
153command first appeared in
251.Nx 1.0a .
154.Nx 1.0a .
252.Sh BUGS
253The initial disklabel returned by
254.Xr ccd 4
255specifies only 3 partitions.
256One needs to change the number of partitions to 8 using
257.Dq Nm disklabel Fl e
258to get the usual
259.Bx
260expectations.