xref: /freebsd/sbin/ccdconfig/ccdconfig.8 (revision 05527a9a28d6e1c79ea5dbf4d76cfd57f86ece03)
189a7b2b7SSatoshi Asami.\"	$NetBSD: ccdconfig.8,v 1.1.2.1 1995/11/11 02:43:33 thorpej Exp $
289a7b2b7SSatoshi Asami.\"
389a7b2b7SSatoshi Asami.\" Copyright (c) 1995 Jason R. Thorpe.
489a7b2b7SSatoshi Asami.\" All rights reserved.
589a7b2b7SSatoshi Asami.\"
689a7b2b7SSatoshi Asami.\" Redistribution and use in source and binary forms, with or without
789a7b2b7SSatoshi Asami.\" modification, are permitted provided that the following conditions
889a7b2b7SSatoshi Asami.\" are met:
989a7b2b7SSatoshi Asami.\" 1. Redistributions of source code must retain the above copyright
1089a7b2b7SSatoshi Asami.\"    notice, this list of conditions and the following disclaimer.
1189a7b2b7SSatoshi Asami.\" 2. Redistributions in binary form must reproduce the above copyright
1289a7b2b7SSatoshi Asami.\"    notice, this list of conditions and the following disclaimer in the
1389a7b2b7SSatoshi Asami.\"    documentation and/or other materials provided with the distribution.
1489a7b2b7SSatoshi Asami.\" 4. The name of the author may not be used to endorse or promote products
1589a7b2b7SSatoshi Asami.\"    derived from this software without specific prior written permission.
1689a7b2b7SSatoshi Asami.\"
1789a7b2b7SSatoshi Asami.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1889a7b2b7SSatoshi Asami.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1989a7b2b7SSatoshi Asami.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2089a7b2b7SSatoshi Asami.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2189a7b2b7SSatoshi Asami.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2289a7b2b7SSatoshi Asami.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2389a7b2b7SSatoshi Asami.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2489a7b2b7SSatoshi Asami.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2589a7b2b7SSatoshi Asami.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2689a7b2b7SSatoshi Asami.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2789a7b2b7SSatoshi Asami.\" SUCH DAMAGE.
2889a7b2b7SSatoshi Asami.\"
297f3dea24SPeter Wemm.\" $FreeBSD$
309ad54eb7SPhilippe Charnier.\"
3189a7b2b7SSatoshi Asami.Dd July 17, 1995
3289a7b2b7SSatoshi Asami.Dt CCDCONFIG 8
339fe48c6eSRuslan Ermilov.Os
3489a7b2b7SSatoshi Asami.Sh NAME
3589a7b2b7SSatoshi Asami.Nm ccdconfig
3689a7b2b7SSatoshi Asami.Nd configuration utility for the concatenated disk driver
3789a7b2b7SSatoshi Asami.Sh SYNOPSIS
387c7fb079SRuslan Ermilov.Nm
3989a7b2b7SSatoshi Asami.Op Fl cv
4089a7b2b7SSatoshi Asami.Ar ccd
4189a7b2b7SSatoshi Asami.Ar ileave
4289a7b2b7SSatoshi Asami.Op Ar flags
4389a7b2b7SSatoshi Asami.Ar dev
449ad54eb7SPhilippe Charnier.Op Ar
457c7fb079SRuslan Ermilov.Nm
4689a7b2b7SSatoshi Asami.Fl C
4789a7b2b7SSatoshi Asami.Op Fl v
4889a7b2b7SSatoshi Asami.Op Fl f Ar config_file
497c7fb079SRuslan Ermilov.Nm
5089a7b2b7SSatoshi Asami.Fl u
5189a7b2b7SSatoshi Asami.Op Fl v
5289a7b2b7SSatoshi Asami.Ar ccd
539ad54eb7SPhilippe Charnier.Op Ar
547c7fb079SRuslan Ermilov.Nm
5589a7b2b7SSatoshi Asami.Fl U
5689a7b2b7SSatoshi Asami.Op Fl v
5789a7b2b7SSatoshi Asami.Op Fl f Ar config_file
587c7fb079SRuslan Ermilov.Nm
5989a7b2b7SSatoshi Asami.Fl g
60d90d7015SRuslan Ermilov.Op Ar ccd Op Ar ...
6189a7b2b7SSatoshi Asami.Sh DESCRIPTION
62e1205e80SPhilippe CharnierThe
63e1205e80SPhilippe Charnier.Nm
64e1205e80SPhilippe Charnierutility is used to dynamically configure and unconfigure concatenated disk
659806e231SRuslan Ermilovdevices, or ccds.
669806e231SRuslan ErmilovFor more information about the ccd, see
6789a7b2b7SSatoshi Asami.Xr ccd 4 .
6889a7b2b7SSatoshi Asami.Pp
6989a7b2b7SSatoshi AsamiThe options are as follows:
7089a7b2b7SSatoshi Asami.Bl -tag -width indent
7189a7b2b7SSatoshi Asami.It Fl c
729806e231SRuslan ErmilovConfigure a ccd.
739806e231SRuslan ErmilovThis is the default behavior of
747c7fb079SRuslan Ermilov.Nm .
7589a7b2b7SSatoshi Asami.It Fl C
7689a7b2b7SSatoshi AsamiConfigure all ccd devices listed in the ccd configuration file.
7789a7b2b7SSatoshi Asami.It Fl f Ar config_file
7889a7b2b7SSatoshi AsamiWhen configuring or unconfiguring all devices, read the file
7989a7b2b7SSatoshi Asami.Pa config_file
8089a7b2b7SSatoshi Asamiinstead of the default
8189a7b2b7SSatoshi Asami.Pa /etc/ccd.conf .
8289a7b2b7SSatoshi Asami.It Fl g
8389a7b2b7SSatoshi AsamiDump the current ccd configuration in a format suitable for use as the
849806e231SRuslan Ermilovccd configuration file.
859806e231SRuslan ErmilovIf no arguments are specified, every configured
869806e231SRuslan Ermilovccd is dumped.
879806e231SRuslan ErmilovOtherwise, the configuration of each listed ccd is dumped.
8889a7b2b7SSatoshi Asami.It Fl u
8989a7b2b7SSatoshi AsamiUnconfigure a ccd.
9089a7b2b7SSatoshi Asami.It Fl U
9189a7b2b7SSatoshi AsamiUnconfigure all ccd devices listed the ccd configuration file.
9289a7b2b7SSatoshi Asami.It Fl v
939ad54eb7SPhilippe CharnierCause
949ad54eb7SPhilippe Charnier.Nm
9589a7b2b7SSatoshi Asamito be verbose.
9689a7b2b7SSatoshi Asami.El
9789a7b2b7SSatoshi Asami.Pp
9889a7b2b7SSatoshi AsamiA ccd is described on the command line and in the ccd configuration
9989a7b2b7SSatoshi Asamifile by the name of the ccd, the interleave factor, the ccd configuration
1009806e231SRuslan Ermilovflags, and a list of one or more devices.
1019806e231SRuslan ErmilovThe flags may be represented
10289a7b2b7SSatoshi Asamias a decimal number, a hexadecimal number, a comma-separated list
10389a7b2b7SSatoshi Asamiof strings, or the word
10489a7b2b7SSatoshi Asami.Dq none .
10589a7b2b7SSatoshi AsamiThe flags are as follows:
10605527a9aSRuslan Ermilov.Bd -literal -offset indent
10789a7b2b7SSatoshi AsamiCCDF_UNIFORM	0x02		Use uniform interleave
108cb7c6b53SSatoshi AsamiCCDF_MIRROR	0x04		Support mirroring
10989a7b2b7SSatoshi Asami.Ed
11089a7b2b7SSatoshi Asami.Pp
11189a7b2b7SSatoshi AsamiThe format in the
11289a7b2b7SSatoshi Asamiconfiguration file appears exactly as if it were entered on the command line.
11389a7b2b7SSatoshi AsamiNote that on the command line and in the configuration file, the
11489a7b2b7SSatoshi Asami.Pa flags
11589a7b2b7SSatoshi Asamiargument is optional.
11605527a9aSRuslan Ermilov.Bd -literal -offset indent
11789a7b2b7SSatoshi Asami#
11889a7b2b7SSatoshi Asami# /etc/ccd.conf
11989a7b2b7SSatoshi Asami# Configuration file for concatenated disk devices
12089a7b2b7SSatoshi Asami#
12105527a9aSRuslan Ermilov
12289a7b2b7SSatoshi Asami# ccd           ileave  flags   component devices
1236d595743SDavid E. O'Brienccd0            16      none    /dev/da2s1 /dev/da3s1
12489a7b2b7SSatoshi Asami.Ed
12589a7b2b7SSatoshi Asami.Pp
12687fc6c15SJoseph KoshyThe component devices need to name partitions of type
12787fc6c15SJoseph Koshy.Li FS_BSDFFS
12887fc6c15SJoseph Koshy(or
12987fc6c15SJoseph Koshy.Dq 4.2BSD
13087fc6c15SJoseph Koshyas shown by
13187fc6c15SJoseph Koshy.Xr disklabel 8 ) .
132251c176fSRuslan Ermilov.Sh EXAMPLES
133e1205e80SPhilippe CharnierA number of
134e1205e80SPhilippe Charnier.Nm
1359806e231SRuslan Ermilovexamples are shown below.
1369806e231SRuslan ErmilovThe arguments passed
137e1205e80SPhilippe Charnierto
138e1205e80SPhilippe Charnier.Nm
139e1205e80SPhilippe Charnierare exactly the same as you might place in the
14018252fc1SMatthew Dillon.Pa /etc/ccd.conf
1419806e231SRuslan Ermilovconfiguration file.
1429806e231SRuslan ErmilovThe first example creates a 4-disk stripe out of
1439806e231SRuslan Ermilovfour scsi disk partitions.
1449806e231SRuslan ErmilovThe stripe uses a 64 sector interleave.
14518252fc1SMatthew DillonThe second example is an example of a complex stripe/mirror combination.
1466d595743SDavid E. O'BrienIt reads as a two disk stripe of da4 and da5 which is mirrored
1479806e231SRuslan Ermilovto a two disk stripe of da6 and da7.
1489806e231SRuslan ErmilovThe last example is a simple
1499806e231SRuslan Ermilovmirror.
1509806e231SRuslan ErmilovThe 2nd slice of /dev/da8 is mirrored with the 3rd slice of /dev/da9
1516d595743SDavid E. O'Brienand assigned to ccd0.
15218252fc1SMatthew Dillon.Pp
15305527a9aSRuslan Ermilov.Bd -literal
1546d595743SDavid E. O'Brien# ccdconfig ccd0 64 none /dev/da0s1 /dev/da1s1 /dev/da2s1 /dev/da3s1
1556d595743SDavid E. O'Brien# ccdconfig ccd0 128 CCDF_MIRROR /dev/da4 /dev/da5 /dev/da6 /dev/da7
1566d595743SDavid E. O'Brien# ccdconfig ccd0 128 CCDF_MIRROR /dev/da8s2 /dev/da9s3
15789a7b2b7SSatoshi Asami.Ed
15889a7b2b7SSatoshi Asami.Pp
15918252fc1SMatthew DillonWhen you create a new ccd disk you generally want to
1606d595743SDavid E. O'Brien.Xr fdisk 8
1616d595743SDavid E. O'Brienand
162f6b811beSGiorgos Keramidas.Xr disklabel 8
1639806e231SRuslan Ermilovit before doing anything else.
1649806e231SRuslan ErmilovOnce you create the initial label you can
1659806e231SRuslan Ermilovedit it, adding additional partitions.
1669806e231SRuslan ErmilovThe label itself takes up the first
1679806e231SRuslan Ermilov16 sectors of the ccd disk.
1689806e231SRuslan ErmilovIf all you are doing is creating file systems
16918252fc1SMatthew Dillonwith newfs, you do not have to worry about this as newfs will skip the
1709806e231SRuslan Ermilovlabel area.
1719806e231SRuslan ErmilovHowever, if you intend to
172f6b811beSGiorgos Keramidas.Xr dd 1
17318252fc1SMatthew Dillonto or from a ccd partition it is usually a good idea to construct the
1749806e231SRuslan Ermilovpartition such that it does not overlap the label area.
1759806e231SRuslan ErmilovFor example, if
17618252fc1SMatthew Dillonyou have A ccd disk with 10000 sectors you might create a 'd' partition
17718252fc1SMatthew Dillonwith offset 16 and size 9984.
17818252fc1SMatthew Dillon.Pp
17905527a9aSRuslan Ermilov.Bd -literal
1806907df79SDavid E. O'Brien# disklabel ccd0 > /tmp/disklabel.ccd0
1816907df79SDavid E. O'Brien# disklabel -Rr ccd0 /tmp/disklabel.ccd0
1826907df79SDavid E. O'Brien# disklabel -e ccd0
18318252fc1SMatthew Dillon.Ed
18418252fc1SMatthew Dillon.Pp
1856d595743SDavid E. O'BrienThe disklabeling of a ccd disk is usually a one-time affair.
1866d595743SDavid E. O'BrienIf you reboot the machine and reconfigure the ccd disk,
18718252fc1SMatthew Dillonthe disklabel you
18818252fc1SMatthew Dillonhad created before will still be there and not require reinitialization.
18918252fc1SMatthew DillonBeware that changing any ccd parameters: interleave, flags, or the
19018252fc1SMatthew Dillondevice list making up the ccd disk, will usually destroy any prior
1919806e231SRuslan Ermilovdata on that ccd disk.
1929806e231SRuslan ErmilovIf this occurs it is usually a good idea to
19318252fc1SMatthew Dillonreinitialize the label before [re]constructing your ccd disk.
19418252fc1SMatthew Dillon.Sh RECOVERY
19518252fc1SMatthew DillonAn error on a ccd disk is usually unrecoverable unless you are using the
1969806e231SRuslan Ermilovmirroring option.
1979806e231SRuslan ErmilovBut mirroring has its own perils: It assumes that
1989806e231SRuslan Ermilovboth copies of the data at any given sector are the same.
1999806e231SRuslan ErmilovThis holds true
20018252fc1SMatthew Dillonuntil a write error occurs or until you replace either side of the mirror.
2019806e231SRuslan ErmilovThis is a poor-man's mirroring implementation.
2029806e231SRuslan ErmilovIt works well enough that if
20318252fc1SMatthew Dillonyou begin to get disk errors you should be able to backup the ccd disk,
2049806e231SRuslan Ermilovreplace the broken hardware, and then regenerate the ccd disk.
2059806e231SRuslan ErmilovIf you need
206b94231daSDima Dorfmanmore than this you should look into external hardware RAID SCSI boxes,
2076d595743SDavid E. O'BrienRAID controllers (see GENERIC),
2086d595743SDavid E. O'Brienor software RAID systems such as
2096d25ea1fSDima Dorfman.Xr geom 8
2106d595743SDavid E. O'Brienand
211f6b811beSGiorgos Keramidas.Xr vinum 8 .
21289a7b2b7SSatoshi Asami.Sh FILES
2139ad54eb7SPhilippe Charnier.Bl -tag -width /etc/ccd.conf -compact
2149ad54eb7SPhilippe Charnier.It Pa /etc/ccd.conf
2159ad54eb7SPhilippe Charnierdefault ccd configuration file
2169ad54eb7SPhilippe Charnier.El
21789a7b2b7SSatoshi Asami.Sh SEE ALSO
218f6b811beSGiorgos Keramidas.Xr dd 1 ,
21989a7b2b7SSatoshi Asami.Xr ccd 4 ,
2206d595743SDavid E. O'Brien.Xr raid 4 ,
221f6b811beSGiorgos Keramidas.Xr disklabel 8 ,
2226d595743SDavid E. O'Brien.Xr fdisk 8 ,
22397a00e76SAlexey Zelkin.Xr rc 8 ,
22418252fc1SMatthew Dillon.Xr vinum 8
2256907df79SDavid E. O'Brien.Sh BUGS
2266907df79SDavid E. O'BrienThe initial disklabel returned by
2276907df79SDavid E. O'Brien.Xr ccd 4
2286907df79SDavid E. O'Brienspecifies only 3 partitions.
229522ccf3fSRuslan ErmilovOne needs to change the number of paritions to 8 using
230522ccf3fSRuslan Ermilov.Dq Nm disklabel Fl e
231522ccf3fSRuslan Ermilovto get the usual
232522ccf3fSRuslan Ermilov.Bx
233522ccf3fSRuslan Ermilovexpectations.
23489a7b2b7SSatoshi Asami.Sh HISTORY
23589a7b2b7SSatoshi AsamiThe
2369ad54eb7SPhilippe Charnier.Nm
237e1205e80SPhilippe Charnierutility first appeared in
23889a7b2b7SSatoshi Asami.Nx 1.0a .
239