xref: /freebsd/sbin/ccdconfig/ccdconfig.8 (revision 9fe48c6e8d0e0133351770178246b4f76ae6a5d9)
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.\" 3. All advertising materials mentioning features or use of this software
159ad54eb7SPhilippe Charnier.\"    must display the following acknowledgment:
1689a7b2b7SSatoshi Asami.\"	This product includes software developed for the NetBSD Project
1789a7b2b7SSatoshi Asami.\"	by Jason R. Thorpe.
1889a7b2b7SSatoshi Asami.\" 4. The name of the author may not be used to endorse or promote products
1989a7b2b7SSatoshi Asami.\"    derived from this software without specific prior written permission.
2089a7b2b7SSatoshi Asami.\"
2189a7b2b7SSatoshi Asami.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2289a7b2b7SSatoshi Asami.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2389a7b2b7SSatoshi Asami.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2489a7b2b7SSatoshi Asami.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2589a7b2b7SSatoshi Asami.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2689a7b2b7SSatoshi Asami.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2789a7b2b7SSatoshi Asami.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2889a7b2b7SSatoshi Asami.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2989a7b2b7SSatoshi Asami.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3089a7b2b7SSatoshi Asami.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3189a7b2b7SSatoshi Asami.\" SUCH DAMAGE.
3289a7b2b7SSatoshi Asami.\"
337f3dea24SPeter Wemm.\" $FreeBSD$
349ad54eb7SPhilippe Charnier.\"
3589a7b2b7SSatoshi Asami.Dd July 17, 1995
3689a7b2b7SSatoshi Asami.Dt CCDCONFIG 8
379fe48c6eSRuslan Ermilov.Os
3889a7b2b7SSatoshi Asami.Sh NAME
3989a7b2b7SSatoshi Asami.Nm ccdconfig
4089a7b2b7SSatoshi Asami.Nd configuration utility for the concatenated disk driver
4189a7b2b7SSatoshi Asami.Sh SYNOPSIS
427c7fb079SRuslan Ermilov.Nm
4389a7b2b7SSatoshi Asami.Op Fl cv
4489a7b2b7SSatoshi Asami.Ar ccd
4589a7b2b7SSatoshi Asami.Ar ileave
4689a7b2b7SSatoshi Asami.Op Ar flags
4789a7b2b7SSatoshi Asami.Ar dev
489ad54eb7SPhilippe Charnier.Op Ar
497c7fb079SRuslan Ermilov.Nm
5089a7b2b7SSatoshi Asami.Fl C
5189a7b2b7SSatoshi Asami.Op Fl v
5289a7b2b7SSatoshi Asami.Op Fl f Ar config_file
537c7fb079SRuslan Ermilov.Nm
5489a7b2b7SSatoshi Asami.Fl u
5589a7b2b7SSatoshi Asami.Op Fl v
5689a7b2b7SSatoshi Asami.Ar ccd
579ad54eb7SPhilippe Charnier.Op Ar
587c7fb079SRuslan Ermilov.Nm
5989a7b2b7SSatoshi Asami.Fl U
6089a7b2b7SSatoshi Asami.Op Fl v
6189a7b2b7SSatoshi Asami.Op Fl f Ar config_file
627c7fb079SRuslan Ermilov.Nm
6389a7b2b7SSatoshi Asami.Fl g
6489a7b2b7SSatoshi Asami.Op Fl M Ar core
6589a7b2b7SSatoshi Asami.Op Fl N Ar system
66d90d7015SRuslan Ermilov.Op Ar ccd Op Ar ...
6789a7b2b7SSatoshi Asami.Sh DESCRIPTION
6889a7b2b7SSatoshi Asami.Nm Ccdconfig
6989a7b2b7SSatoshi Asamiis used to dynamically configure and unconfigure concatenated disk
7089a7b2b7SSatoshi Asamidevices, or ccds.  For more information about the ccd, see
7189a7b2b7SSatoshi Asami.Xr ccd 4 .
7289a7b2b7SSatoshi Asami.Pp
7389a7b2b7SSatoshi AsamiThe options are as follows:
7489a7b2b7SSatoshi Asami.Bl -tag -width indent
7589a7b2b7SSatoshi Asami.It Fl c
7689a7b2b7SSatoshi AsamiConfigure a ccd.  This is the default behavior of
777c7fb079SRuslan Ermilov.Nm .
7889a7b2b7SSatoshi Asami.It Fl C
7989a7b2b7SSatoshi AsamiConfigure all ccd devices listed in the ccd configuration file.
8089a7b2b7SSatoshi Asami.It Fl f Ar config_file
8189a7b2b7SSatoshi AsamiWhen configuring or unconfiguring all devices, read the file
8289a7b2b7SSatoshi Asami.Pa config_file
8389a7b2b7SSatoshi Asamiinstead of the default
8489a7b2b7SSatoshi Asami.Pa /etc/ccd.conf .
8589a7b2b7SSatoshi Asami.It Fl g
8689a7b2b7SSatoshi AsamiDump the current ccd configuration in a format suitable for use as the
8789a7b2b7SSatoshi Asamiccd configuration file.  If no arguments are specified, every configured
8889a7b2b7SSatoshi Asamiccd is dumped.  Otherwise, the configuration of each listed ccd is dumped.
8989a7b2b7SSatoshi Asami.It Fl M Ar core
9089a7b2b7SSatoshi AsamiExtract values associated with the name list from
9189a7b2b7SSatoshi Asami.Pa core
9289a7b2b7SSatoshi Asamiinstead of the default
9389a7b2b7SSatoshi Asami.Pa /dev/mem .
9489a7b2b7SSatoshi Asami.It Fl N Ar system
954924f5c2SSatoshi AsamiUse
964924f5c2SSatoshi Asami.Ar system
974924f5c2SSatoshi Asamias the kernel instead of the running kernel (as determined from
984924f5c2SSatoshi Asami.Xr getbootfile 3 ) .
9989a7b2b7SSatoshi Asami.It Fl u
10089a7b2b7SSatoshi AsamiUnconfigure a ccd.
10189a7b2b7SSatoshi Asami.It Fl U
10289a7b2b7SSatoshi AsamiUnconfigure all ccd devices listed the ccd configuration file.
10389a7b2b7SSatoshi Asami.It Fl v
1049ad54eb7SPhilippe CharnierCause
1059ad54eb7SPhilippe Charnier.Nm
10689a7b2b7SSatoshi Asamito be verbose.
10789a7b2b7SSatoshi Asami.El
10889a7b2b7SSatoshi Asami.Pp
10989a7b2b7SSatoshi AsamiA ccd is described on the command line and in the ccd configuration
11089a7b2b7SSatoshi Asamifile by the name of the ccd, the interleave factor, the ccd configuration
11189a7b2b7SSatoshi Asamiflags, and a list of one or more devices.  The flags may be represented
11289a7b2b7SSatoshi Asamias a decimal number, a hexadecimal number, a comma-separated list
11389a7b2b7SSatoshi Asamiof strings, or the word
11489a7b2b7SSatoshi Asami.Dq none .
11589a7b2b7SSatoshi AsamiThe flags are as follows:
11689a7b2b7SSatoshi Asami.Bd -unfilled -offset indent
11789a7b2b7SSatoshi AsamiCCDF_SWAP		0x01		Interleave should be dmmax
11889a7b2b7SSatoshi AsamiCCDF_UNIFORM	0x02		Use uniform interleave
119cb7c6b53SSatoshi AsamiCCDF_MIRROR	0x04		Support mirroring
120cb7c6b53SSatoshi AsamiCCDF_PARITY	0x08		Support parity (not implemented yet)
12189a7b2b7SSatoshi Asami.Ed
12289a7b2b7SSatoshi Asami.Pp
12389a7b2b7SSatoshi AsamiThe format in the
12489a7b2b7SSatoshi Asamiconfiguration file appears exactly as if it were entered on the command line.
12589a7b2b7SSatoshi AsamiNote that on the command line and in the configuration file, the
12689a7b2b7SSatoshi Asami.Pa flags
12789a7b2b7SSatoshi Asamiargument is optional.
12889a7b2b7SSatoshi Asami.Bd -unfilled -offset indent
12989a7b2b7SSatoshi Asami#
13089a7b2b7SSatoshi Asami# /etc/ccd.conf
13189a7b2b7SSatoshi Asami# Configuration file for concatenated disk devices
13289a7b2b7SSatoshi Asami#
13389a7b2b7SSatoshi Asami.Pp
13489a7b2b7SSatoshi Asami# ccd           ileave  flags   component devices
13551d28510SSatoshi Asamiccd0            16      none    /dev/da2e /dev/da3e
13689a7b2b7SSatoshi Asami.Ed
13789a7b2b7SSatoshi Asami.Pp
13887fc6c15SJoseph KoshyThe component devices need to name partitions of type
13987fc6c15SJoseph Koshy.Li FS_BSDFFS
14087fc6c15SJoseph Koshy(or
14187fc6c15SJoseph Koshy.Dq 4.2BSD
14287fc6c15SJoseph Koshyas shown by
14387fc6c15SJoseph Koshy.Xr disklabel 8 ) .
144251c176fSRuslan Ermilov.Sh EXAMPLES
14518252fc1SMatthew DillonA number of ccdconfig examples are shown below.  The arguments passed
14618252fc1SMatthew Dillonto ccdconfig are exactly the same as you might place in the
14718252fc1SMatthew Dillon.Pa /etc/ccd.conf
14818252fc1SMatthew Dillonconfiguration file.  The first example creates a 4-disk stripe out of
14918252fc1SMatthew Dillonfour scsi disk partitions.  The stripe uses a 64 sector interleave.
15018252fc1SMatthew DillonThe second example is an example of a complex stripe/mirror combination.
15118252fc1SMatthew DillonIt reads as a two disk stripe of da2e and da3e which is mirrored
15218252fc1SMatthew Dillonto a two disk stripe of da4e and da5e.  The last example is a simple
15318252fc1SMatthew Dillonmirror.  /dev/da2e is mirrored with /dev/da4e and assigned to ccd0.
15418252fc1SMatthew Dillon.Pp
15518252fc1SMatthew Dillon.Bd -unfilled -offset
15618252fc1SMatthew Dillon# ccdconfig ccd0 64 none /dev/da2e /dev/da3e /dev/da4e /dev/da5e
15718252fc1SMatthew Dillon# ccdconfig ccd0 128 CCDF_MIRROR /dev/da2e /dev/da3e /dev/da4e /dev/da5e
15818252fc1SMatthew Dillon# ccdconfig ccd0 128 CCDF_MIRROR /dev/da2e /dev/da4e
15989a7b2b7SSatoshi Asami.Ed
16089a7b2b7SSatoshi Asami.Pp
16118252fc1SMatthew DillonWhen you create a new ccd disk you generally want to
16218252fc1SMatthew Dillon.Nm disklabel
16318252fc1SMatthew Dillonit before doing anything else.  Once you create the initial label you can
16418252fc1SMatthew Dillonedit it, adding additional partitions.  The label itself takes up the first
16518252fc1SMatthew Dillon16 sectors of the ccd disk.  If all you are doing is creating filesystems
16618252fc1SMatthew Dillonwith newfs, you do not have to worry about this as newfs will skip the
16718252fc1SMatthew Dillonlabel area.  However, if you intend to
16818252fc1SMatthew Dillon.Nm dd
16918252fc1SMatthew Dillonto or from a ccd partition it is usually a good idea to construct the
17018252fc1SMatthew Dillonpartition such that it does not overlap the label area.  For example, if
17118252fc1SMatthew Dillonyou have A ccd disk with 10000 sectors you might create a 'd' partition
17218252fc1SMatthew Dillonwith offset 16 and size 9984.
17318252fc1SMatthew Dillon.Pp
17418252fc1SMatthew Dillon.Bd -unfilled -offset
17518252fc1SMatthew Dillon# disklabel -r -w ccd0c auto
17618252fc1SMatthew Dillon# disklabel -e ccd0c
17718252fc1SMatthew Dillon.Ed
17818252fc1SMatthew Dillon.Pp
17918252fc1SMatthew DillonThe disklabeling of a ccd disk is usually a one-time affair.  Unlike other
18018252fc1SMatthew Dillondevices, ccd currently requires that you specify partition 'c' when
18118252fc1SMatthew Dillonrunning disklabel.  If you reboot the machine and reconfigure the ccd disk,
18218252fc1SMatthew Dillonthe disklabel you
18318252fc1SMatthew Dillonhad created before will still be there and not require reinitialization.
18418252fc1SMatthew DillonBeware that changing any ccd parameters: interleave, flags, or the
18518252fc1SMatthew Dillondevice list making up the ccd disk, will usually destroy any prior
18618252fc1SMatthew Dillondata on that ccd disk.  If this occurs it is usually a good idea to
18718252fc1SMatthew Dillonreinitialize the label before [re]constructing your ccd disk.
18818252fc1SMatthew Dillon.Sh RECOVERY
18918252fc1SMatthew DillonAn error on a ccd disk is usually unrecoverable unless you are using the
19018252fc1SMatthew Dillonmirroring option.  But mirroring has its own perils:  It assumes that
19118252fc1SMatthew Dillonboth copies of the data at any given sector are the same.  This holds true
19218252fc1SMatthew Dillonuntil a write error occurs or until you replace either side of the mirror.
19318252fc1SMatthew Dillon.Nm Ccd
19418252fc1SMatthew Dillonuses a poor-man's mirroring implementation.  It works well enough that if
19518252fc1SMatthew Dillonyou begin to get disk errors you should be able to backup the ccd disk,
19618252fc1SMatthew Dillonreplace the broken hardware, and then regenerate the ccd disk.  If you need
19718252fc1SMatthew Dillonmore then this you should look into external hardware RAID SCSI boxes,
19818252fc1SMatthew DillonRAID controllers such as the
19918252fc1SMatthew Dillon.Nm dpt
20018252fc1SMatthew Dilloncontroller, or software RAID systems such as
20118252fc1SMatthew Dillon.Nm vinum .
20289a7b2b7SSatoshi Asami.Sh FILES
2039ad54eb7SPhilippe Charnier.Bl -tag -width /etc/ccd.conf -compact
2049ad54eb7SPhilippe Charnier.It Pa /etc/ccd.conf
2059ad54eb7SPhilippe Charnierdefault ccd configuration file
2069ad54eb7SPhilippe Charnier.El
20789a7b2b7SSatoshi Asami.Sh SEE ALSO
20889a7b2b7SSatoshi Asami.Xr ccd 4 ,
20997a00e76SAlexey Zelkin.Xr rc 8 ,
21018252fc1SMatthew Dillon.Xr vinum 8
21189a7b2b7SSatoshi Asami.Sh HISTORY
21289a7b2b7SSatoshi AsamiThe
2139ad54eb7SPhilippe Charnier.Nm
21489a7b2b7SSatoshi Asamicommand first appeared in
21589a7b2b7SSatoshi Asami.Nx 1.0a .
216