xref: /freebsd/sbin/ccdconfig/ccdconfig.8 (revision 3a7c4a1c830da39b510b62c7fbd19454aed1587d)
1*3a7c4a1cSPedro F. Giffuni.\"	$NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $
289a7b2b7SSatoshi Asami.\"
3*3a7c4a1cSPedro F. Giffuni.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
489a7b2b7SSatoshi Asami.\" All rights reserved.
589a7b2b7SSatoshi Asami.\"
6*3a7c4a1cSPedro F. Giffuni.\" This code is derived from software contributed to The NetBSD Foundation
7*3a7c4a1cSPedro F. Giffuni.\" by Jason R. Thorpe.
8*3a7c4a1cSPedro F. Giffuni.\"
989a7b2b7SSatoshi Asami.\" Redistribution and use in source and binary forms, with or without
1089a7b2b7SSatoshi Asami.\" modification, are permitted provided that the following conditions
1189a7b2b7SSatoshi Asami.\" are met:
1289a7b2b7SSatoshi Asami.\" 1. Redistributions of source code must retain the above copyright
1389a7b2b7SSatoshi Asami.\"    notice, this list of conditions and the following disclaimer.
1489a7b2b7SSatoshi Asami.\" 2. Redistributions in binary form must reproduce the above copyright
1589a7b2b7SSatoshi Asami.\"    notice, this list of conditions and the following disclaimer in the
1689a7b2b7SSatoshi Asami.\"    documentation and/or other materials provided with the distribution.
17*3a7c4a1cSPedro F. Giffuni.\" 3. All advertising materials mentioning features or use of this software
18*3a7c4a1cSPedro F. Giffuni.\"    must display the following acknowledgement:
19*3a7c4a1cSPedro F. Giffuni.\"        This product includes software developed by the NetBSD
20*3a7c4a1cSPedro F. Giffuni.\"        Foundation, Inc. and its contributors.
21*3a7c4a1cSPedro F. Giffuni.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22*3a7c4a1cSPedro F. Giffuni.\"    contributors may be used to endorse or promote products derived
23*3a7c4a1cSPedro F. Giffuni.\"    from this software without specific prior written permission.
2489a7b2b7SSatoshi Asami.\"
2589a7b2b7SSatoshi Asami.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2689a7b2b7SSatoshi Asami.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2789a7b2b7SSatoshi Asami.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2889a7b2b7SSatoshi Asami.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2989a7b2b7SSatoshi Asami.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
3089a7b2b7SSatoshi Asami.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3189a7b2b7SSatoshi Asami.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
3289a7b2b7SSatoshi Asami.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3389a7b2b7SSatoshi Asami.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3489a7b2b7SSatoshi Asami.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3589a7b2b7SSatoshi Asami.\" SUCH DAMAGE.
3689a7b2b7SSatoshi Asami.\"
377f3dea24SPeter Wemm.\" $FreeBSD$
389ad54eb7SPhilippe Charnier.\"
39494b4bb3SSevan Janiyan.Dd October 3, 2016
4089a7b2b7SSatoshi Asami.Dt CCDCONFIG 8
419fe48c6eSRuslan Ermilov.Os
4289a7b2b7SSatoshi Asami.Sh NAME
4389a7b2b7SSatoshi Asami.Nm ccdconfig
4489a7b2b7SSatoshi Asami.Nd configuration utility for the concatenated disk driver
4589a7b2b7SSatoshi Asami.Sh SYNOPSIS
467c7fb079SRuslan Ermilov.Nm
4789a7b2b7SSatoshi Asami.Op Fl cv
4889a7b2b7SSatoshi Asami.Ar ccd
4989a7b2b7SSatoshi Asami.Ar ileave
5089a7b2b7SSatoshi Asami.Op Ar flags
518d646af5SRuslan Ermilov.Ar dev ...
527c7fb079SRuslan Ermilov.Nm
5389a7b2b7SSatoshi Asami.Fl C
5489a7b2b7SSatoshi Asami.Op Fl v
5589a7b2b7SSatoshi Asami.Op Fl f Ar config_file
567c7fb079SRuslan Ermilov.Nm
5789a7b2b7SSatoshi Asami.Fl u
5889a7b2b7SSatoshi Asami.Op Fl v
598d646af5SRuslan Ermilov.Ar ccd ...
607c7fb079SRuslan Ermilov.Nm
6189a7b2b7SSatoshi Asami.Fl U
6289a7b2b7SSatoshi Asami.Op Fl v
6389a7b2b7SSatoshi Asami.Op Fl f Ar config_file
647c7fb079SRuslan Ermilov.Nm
6589a7b2b7SSatoshi Asami.Fl g
668d646af5SRuslan Ermilov.Op Ar ccd ...
6789a7b2b7SSatoshi Asami.Sh DESCRIPTION
68e1205e80SPhilippe CharnierThe
69e1205e80SPhilippe Charnier.Nm
70e1205e80SPhilippe Charnierutility is used to dynamically configure and unconfigure concatenated disk
719806e231SRuslan Ermilovdevices, or ccds.
729806e231SRuslan ErmilovFor more information about the ccd, see
7389a7b2b7SSatoshi Asami.Xr ccd 4 .
7489a7b2b7SSatoshi Asami.Pp
7589a7b2b7SSatoshi AsamiThe options are as follows:
7689a7b2b7SSatoshi Asami.Bl -tag -width indent
7789a7b2b7SSatoshi Asami.It Fl c
789806e231SRuslan ErmilovConfigure a ccd.
799806e231SRuslan ErmilovThis is the default behavior of
807c7fb079SRuslan Ermilov.Nm .
8189a7b2b7SSatoshi Asami.It Fl C
8289a7b2b7SSatoshi AsamiConfigure all ccd devices listed in the ccd configuration file.
8389a7b2b7SSatoshi Asami.It Fl f Ar config_file
8489a7b2b7SSatoshi AsamiWhen configuring or unconfiguring all devices, read the file
8589a7b2b7SSatoshi Asami.Pa config_file
8689a7b2b7SSatoshi Asamiinstead of the default
8789a7b2b7SSatoshi Asami.Pa /etc/ccd.conf .
8889a7b2b7SSatoshi Asami.It Fl g
8989a7b2b7SSatoshi AsamiDump the current ccd configuration in a format suitable for use as the
909806e231SRuslan Ermilovccd configuration file.
919806e231SRuslan ErmilovIf no arguments are specified, every configured
929806e231SRuslan Ermilovccd is dumped.
939806e231SRuslan ErmilovOtherwise, the configuration of each listed ccd is dumped.
9489a7b2b7SSatoshi Asami.It Fl u
9589a7b2b7SSatoshi AsamiUnconfigure a ccd.
9689a7b2b7SSatoshi Asami.It Fl U
9789a7b2b7SSatoshi AsamiUnconfigure all ccd devices listed the ccd configuration file.
9889a7b2b7SSatoshi Asami.It Fl v
999ad54eb7SPhilippe CharnierCause
1009ad54eb7SPhilippe Charnier.Nm
10189a7b2b7SSatoshi Asamito be verbose.
10289a7b2b7SSatoshi Asami.El
10389a7b2b7SSatoshi Asami.Pp
10489a7b2b7SSatoshi AsamiA ccd is described on the command line and in the ccd configuration
10589a7b2b7SSatoshi Asamifile by the name of the ccd, the interleave factor, the ccd configuration
1069806e231SRuslan Ermilovflags, and a list of one or more devices.
1079806e231SRuslan ErmilovThe flags may be represented
10889a7b2b7SSatoshi Asamias a decimal number, a hexadecimal number, a comma-separated list
10989a7b2b7SSatoshi Asamiof strings, or the word
11089a7b2b7SSatoshi Asami.Dq none .
11189a7b2b7SSatoshi AsamiThe flags are as follows:
11205527a9aSRuslan Ermilov.Bd -literal -offset indent
11389a7b2b7SSatoshi AsamiCCDF_UNIFORM	0x02		Use uniform interleave
114cb7c6b53SSatoshi AsamiCCDF_MIRROR	0x04		Support mirroring
1153f4f4a14SMartin CracauerCCDF_NO_OFFSET	0x08		Do not use an offset
1163f4f4a14SMartin CracauerCCDF_LINUX	0x0A		Linux md(4) compatibility
11789a7b2b7SSatoshi Asami.Ed
11889a7b2b7SSatoshi Asami.Pp
11989a7b2b7SSatoshi AsamiThe format in the
12089a7b2b7SSatoshi Asamiconfiguration file appears exactly as if it were entered on the command line.
12189a7b2b7SSatoshi AsamiNote that on the command line and in the configuration file, the
12289a7b2b7SSatoshi Asami.Pa flags
12389a7b2b7SSatoshi Asamiargument is optional.
12405527a9aSRuslan Ermilov.Bd -literal -offset indent
12589a7b2b7SSatoshi Asami#
12689a7b2b7SSatoshi Asami# /etc/ccd.conf
12789a7b2b7SSatoshi Asami# Configuration file for concatenated disk devices
12889a7b2b7SSatoshi Asami#
12905527a9aSRuslan Ermilov
13089a7b2b7SSatoshi Asami# ccd           ileave  flags   component devices
1316d595743SDavid E. O'Brienccd0            16      none    /dev/da2s1 /dev/da3s1
13289a7b2b7SSatoshi Asami.Ed
13389a7b2b7SSatoshi Asami.Pp
13487fc6c15SJoseph KoshyThe component devices need to name partitions of type
13587fc6c15SJoseph Koshy.Li FS_BSDFFS
13687fc6c15SJoseph Koshy(or
13787fc6c15SJoseph Koshy.Dq 4.2BSD
13887fc6c15SJoseph Koshyas shown by
13987fc6c15SJoseph Koshy.Xr disklabel 8 ) .
1403f4f4a14SMartin Cracauer.Pp
141d5bd01d2SRuslan ErmilovIf you want to use the
142d5bd01d2SRuslan Ermilov.Tn Linux
143d5bd01d2SRuslan Ermilov.Xr md 4
144d5bd01d2SRuslan Ermilovcompatibility mode, please be sure
1453f4f4a14SMartin Cracauerto read the notes in
1463f4f4a14SMartin Cracauer.Xr ccd 4 .
1476087df9eSRuslan Ermilov.Sh FILES
1486087df9eSRuslan Ermilov.Bl -tag -width /etc/ccd.conf -compact
1496087df9eSRuslan Ermilov.It Pa /etc/ccd.conf
1506087df9eSRuslan Ermilovdefault ccd configuration file
1516087df9eSRuslan Ermilov.El
152251c176fSRuslan Ermilov.Sh EXAMPLES
153e1205e80SPhilippe CharnierA number of
154e1205e80SPhilippe Charnier.Nm
1559806e231SRuslan Ermilovexamples are shown below.
1569806e231SRuslan ErmilovThe arguments passed
157e1205e80SPhilippe Charnierto
158e1205e80SPhilippe Charnier.Nm
159e1205e80SPhilippe Charnierare exactly the same as you might place in the
16018252fc1SMatthew Dillon.Pa /etc/ccd.conf
1619806e231SRuslan Ermilovconfiguration file.
1629806e231SRuslan ErmilovThe first example creates a 4-disk stripe out of
1639806e231SRuslan Ermilovfour scsi disk partitions.
1649806e231SRuslan ErmilovThe stripe uses a 64 sector interleave.
16518252fc1SMatthew DillonThe second example is an example of a complex stripe/mirror combination.
1666d595743SDavid E. O'BrienIt reads as a two disk stripe of da4 and da5 which is mirrored
1679806e231SRuslan Ermilovto a two disk stripe of da6 and da7.
1689806e231SRuslan ErmilovThe last example is a simple
1699806e231SRuslan Ermilovmirror.
170494b4bb3SSevan JaniyanThe second slice of /dev/da8 is mirrored with the third slice of /dev/da9
1716d595743SDavid E. O'Brienand assigned to ccd0.
17205527a9aSRuslan Ermilov.Bd -literal
1736d595743SDavid E. O'Brien# ccdconfig ccd0 64 none /dev/da0s1 /dev/da1s1 /dev/da2s1 /dev/da3s1
1746d595743SDavid E. O'Brien# ccdconfig ccd0 128 CCDF_MIRROR /dev/da4 /dev/da5 /dev/da6 /dev/da7
1756d595743SDavid E. O'Brien# ccdconfig ccd0 128 CCDF_MIRROR /dev/da8s2 /dev/da9s3
17689a7b2b7SSatoshi Asami.Ed
17789a7b2b7SSatoshi Asami.Pp
178d5bd01d2SRuslan ErmilovThe following are matching commands in
179d5bd01d2SRuslan Ermilov.Tn Linux
180d5bd01d2SRuslan Ermilovand
181d5bd01d2SRuslan Ermilov.Fx
182d5bd01d2SRuslan Ermilovto create a RAID-0 in
183d5bd01d2SRuslan Ermilov.Tn Linux
184d5bd01d2SRuslan Ermilovand read it from
185d5bd01d2SRuslan Ermilov.Fx .
1863f4f4a14SMartin Cracauer.Bd -literal
187d5bd01d2SRuslan Ermilov# Create a RAID-0 on Linux:
1883f4f4a14SMartin Cracauermdadm --create --chunk=32 --level=0 --raid-devices=2 /dev/md0 \\
1893f4f4a14SMartin Cracauer   /dev/hda1 /dev/hdb1
190d5bd01d2SRuslan Ermilov# Make the RAID-0 just created available on FreeBSD:
19105d98029SSergey Kandaurovccdconfig -c /dev/ccd0 32 linux /dev/ada0s1 /dev/ada0s2
1923f4f4a14SMartin Cracauer.Ed
1933f4f4a14SMartin Cracauer.Pp
19418252fc1SMatthew DillonWhen you create a new ccd disk you generally want to
1956d595743SDavid E. O'Brien.Xr fdisk 8
1966d595743SDavid E. O'Brienand
197f6b811beSGiorgos Keramidas.Xr disklabel 8
1989806e231SRuslan Ermilovit before doing anything else.
1999806e231SRuslan ErmilovOnce you create the initial label you can
2009806e231SRuslan Ermilovedit it, adding additional partitions.
2019806e231SRuslan ErmilovThe label itself takes up the first
2029806e231SRuslan Ermilov16 sectors of the ccd disk.
2039806e231SRuslan ErmilovIf all you are doing is creating file systems
20418252fc1SMatthew Dillonwith newfs, you do not have to worry about this as newfs will skip the
2059806e231SRuslan Ermilovlabel area.
2069806e231SRuslan ErmilovHowever, if you intend to
207f6b811beSGiorgos Keramidas.Xr dd 1
20818252fc1SMatthew Dillonto or from a ccd partition it is usually a good idea to construct the
2099806e231SRuslan Ermilovpartition such that it does not overlap the label area.
2109806e231SRuslan ErmilovFor example, if
21118252fc1SMatthew Dillonyou have A ccd disk with 10000 sectors you might create a 'd' partition
21218252fc1SMatthew Dillonwith offset 16 and size 9984.
21305527a9aSRuslan Ermilov.Bd -literal
2146907df79SDavid E. O'Brien# disklabel ccd0 > /tmp/disklabel.ccd0
2156907df79SDavid E. O'Brien# disklabel -Rr ccd0 /tmp/disklabel.ccd0
2166907df79SDavid E. O'Brien# disklabel -e ccd0
21718252fc1SMatthew Dillon.Ed
21818252fc1SMatthew Dillon.Pp
2196d595743SDavid E. O'BrienThe disklabeling of a ccd disk is usually a one-time affair.
2206d595743SDavid E. O'BrienIf you reboot the machine and reconfigure the ccd disk,
22118252fc1SMatthew Dillonthe disklabel you
22218252fc1SMatthew Dillonhad created before will still be there and not require reinitialization.
22318252fc1SMatthew DillonBeware that changing any ccd parameters: interleave, flags, or the
22418252fc1SMatthew Dillondevice list making up the ccd disk, will usually destroy any prior
2259806e231SRuslan Ermilovdata on that ccd disk.
2269806e231SRuslan ErmilovIf this occurs it is usually a good idea to
22718252fc1SMatthew Dillonreinitialize the label before [re]constructing your ccd disk.
22818252fc1SMatthew Dillon.Sh RECOVERY
22918252fc1SMatthew DillonAn error on a ccd disk is usually unrecoverable unless you are using the
2309806e231SRuslan Ermilovmirroring option.
2319806e231SRuslan ErmilovBut mirroring has its own perils: It assumes that
2329806e231SRuslan Ermilovboth copies of the data at any given sector are the same.
2339806e231SRuslan ErmilovThis holds true
23418252fc1SMatthew Dillonuntil a write error occurs or until you replace either side of the mirror.
2359806e231SRuslan ErmilovThis is a poor-man's mirroring implementation.
2369806e231SRuslan ErmilovIt works well enough that if
23718252fc1SMatthew Dillonyou begin to get disk errors you should be able to backup the ccd disk,
2389806e231SRuslan Ermilovreplace the broken hardware, and then regenerate the ccd disk.
2399806e231SRuslan ErmilovIf you need
240b94231daSDima Dorfmanmore than this you should look into external hardware RAID SCSI boxes,
2416d595743SDavid E. O'BrienRAID controllers (see GENERIC),
2426d595743SDavid E. O'Brienor software RAID systems such as
2436d25ea1fSDima Dorfman.Xr geom 8
2446d595743SDavid E. O'Brienand
245d1cd5e7cSJoel Dahl.Xr gvinum 8 .
24689a7b2b7SSatoshi Asami.Sh SEE ALSO
247f6b811beSGiorgos Keramidas.Xr dd 1 ,
24889a7b2b7SSatoshi Asami.Xr ccd 4 ,
249f6b811beSGiorgos Keramidas.Xr disklabel 8 ,
2506d595743SDavid E. O'Brien.Xr fdisk 8 ,
251d1cd5e7cSJoel Dahl.Xr gvinum 8 ,
252d1cd5e7cSJoel Dahl.Xr rc 8
2536087df9eSRuslan Ermilov.Sh HISTORY
2546087df9eSRuslan ErmilovThe
2556087df9eSRuslan Ermilov.Nm
2566087df9eSRuslan Ermilovutility first appeared in
257494b4bb3SSevan Janiyan.Nx 1.1 .
2586907df79SDavid E. O'Brien.Sh BUGS
2596907df79SDavid E. O'BrienThe initial disklabel returned by
2606907df79SDavid E. O'Brien.Xr ccd 4
2616907df79SDavid E. O'Brienspecifies only 3 partitions.
262497dd0f9SGiorgos KeramidasOne needs to change the number of partitions to 8 using
263522ccf3fSRuslan Ermilov.Dq Nm disklabel Fl e
264522ccf3fSRuslan Ermilovto get the usual
265522ccf3fSRuslan Ermilov.Bx
266522ccf3fSRuslan Ermilovexpectations.
267