xref: /freebsd/sbin/ccdconfig/ccdconfig.8 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to The NetBSD Foundation
5.\" by Jason R. Thorpe.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $
29.\"
30.Dd March 22, 2024
31.Dt CCDCONFIG 8
32.Os
33.Sh NAME
34.Nm ccdconfig
35.Nd configuration utility for the concatenated disk driver
36.Sh SYNOPSIS
37.Nm
38.Op Fl cv
39.Ar ccd
40.Ar ileave
41.Op Ar flags
42.Ar dev ...
43.Nm
44.Fl C
45.Op Fl v
46.Op Fl f Ar config_file
47.Nm
48.Fl u
49.Op Fl v
50.Ar ccd ...
51.Nm
52.Fl U
53.Op Fl v
54.Op Fl f Ar config_file
55.Nm
56.Fl g
57.Op Ar ccd ...
58.Sh DESCRIPTION
59The
60.Nm
61utility is used to dynamically configure and unconfigure concatenated disk
62devices, or ccds.
63For more information about the ccd, see
64.Xr ccd 4 .
65.Pp
66The options are as follows:
67.Bl -tag -width indent
68.It Fl c
69Configure a ccd.
70This is the default behavior of
71.Nm .
72.It Fl C
73Configure all ccd devices listed in the ccd configuration file.
74.It Fl f Ar config_file
75When configuring or unconfiguring all devices, read the file
76.Pa config_file
77instead of the default
78.Pa /etc/ccd.conf .
79.It Fl g
80Dump the current ccd configuration in a format suitable for use as the
81ccd configuration file.
82If no arguments are specified, every configured
83ccd is dumped.
84Otherwise, the configuration of each listed ccd is dumped.
85.It Fl u
86Unconfigure a ccd.
87.It Fl U
88Unconfigure all ccd devices listed the ccd configuration file.
89.It Fl v
90Cause
91.Nm
92to be verbose.
93.El
94.Pp
95A ccd is described on the command line and in the ccd configuration
96file by the name of the ccd, the interleave factor, the ccd configuration
97flags, and a list of one or more devices.
98The flags may be represented
99as a decimal number, a hexadecimal number, a comma-separated list
100of strings, or the word
101.Dq none .
102The flags are as follows:
103.Bd -literal -offset indent
104CCDF_UNIFORM	0x02		Use uniform interleave
105CCDF_MIRROR	0x04		Support mirroring
106CCDF_NO_OFFSET	0x08		Do not use an offset
107CCDF_LINUX	0x0A		Linux md(4) compatibility
108.Ed
109.Pp
110The format in the
111configuration file appears exactly as if it were entered on the command line.
112Note that on the command line and in the configuration file, the
113.Pa flags
114argument is optional.
115.Bd -literal -offset indent
116#
117# /etc/ccd.conf
118# Configuration file for concatenated disk devices
119#
120
121# ccd           ileave  flags   component devices
122ccd0            16      none    /dev/da2s1 /dev/da3s1
123.Ed
124.Pp
125If you want to use the
126.Tn Linux
127.Xr md 4
128compatibility mode, please be sure
129to read the notes in
130.Xr ccd 4 .
131.Sh FILES
132.Bl -tag -width /etc/ccd.conf -compact
133.It Pa /etc/ccd.conf
134default ccd configuration file
135.El
136.Sh EXAMPLES
137A number of
138.Nm
139examples are shown below.
140The arguments passed
141to
142.Nm
143are exactly the same as you might place in the
144.Pa /etc/ccd.conf
145configuration file.
146The first example creates a 4-disk stripe out of
147four scsi disk partitions.
148The stripe uses a 64-sector interleave.
149The second example is an example of a complex stripe/mirror combination.
150It reads as a two disk stripe of da4 and da5 which is mirrored
151to a two disk stripe of da6 and da7.
152The last example is a simple
153mirror.
154The second slice of /dev/da8 is mirrored with the third slice of /dev/da9
155and assigned to ccd0.
156.Bd -literal
157# ccdconfig ccd0 64 none /dev/da0s1 /dev/da1s1 /dev/da2s1 /dev/da3s1
158# ccdconfig ccd0 128 CCDF_MIRROR /dev/da4 /dev/da5 /dev/da6 /dev/da7
159# ccdconfig ccd0 128 CCDF_MIRROR /dev/da8s2 /dev/da9s3
160.Ed
161.Pp
162The following are matching commands in
163.Tn Linux
164and
165.Fx
166to create a RAID-0 in
167.Tn Linux
168and read it from
169.Fx .
170.Bd -literal
171# Create a RAID-0 on Linux:
172mdadm --create --chunk=32 --level=0 --raid-devices=2 /dev/md0 \\
173   /dev/hda1 /dev/hdb1
174# Make the RAID-0 just created available on FreeBSD:
175ccdconfig -c /dev/ccd0 32 linux /dev/ada0s1 /dev/ada0s2
176.Ed
177.Pp
178When you create a new ccd disk you generally want to
179partition it using
180.Xr gpart 8
181it before doing anything else.
182Beware that changing any ccd parameters: interleave, flags, or the
183device list making up the ccd disk, will usually destroy any prior
184data on that ccd disk.
185If this occurs it is usually a good idea to
186reinitialize the label before [re]constructing your ccd disk.
187.Sh RECOVERY
188An error on a ccd disk is usually unrecoverable unless you are using the
189mirroring option.
190But mirroring has its own perils: It assumes that
191both copies of the data at any given sector are the same.
192This holds true
193until a write error occurs or until you replace either side of the mirror.
194This is a poor-man's mirroring implementation.
195It works well enough that if
196you begin to get disk errors you should be able to backup the ccd disk,
197replace the broken hardware, and then regenerate the ccd disk.
198If you need
199more than this you should look into external hardware RAID SCSI boxes,
200RAID controllers (see GENERIC),
201or software RAID systems such as
202.Xr geom 8
203and
204.Xr gvinum 8 .
205.Sh SEE ALSO
206.Xr dd 1 ,
207.Xr ccd 4 ,
208.Xr gpart 8 ,
209.Xr gvinum 8 ,
210.Xr rc 8
211.Sh HISTORY
212The
213.Nm
214utility first appeared in
215.Nx 1.1 .
216