2017-12-27 20:09:50 +00:00
|
|
|
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
|
1995-12-27 10:51:05 +00:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
2017-12-27 20:09:50 +00:00
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Jason R. Thorpe.
|
|
|
|
.\"
|
1995-12-27 10:51:05 +00:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2017-12-30 00:26:42 +00:00
|
|
|
.\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1998-06-04 06:41:26 +00:00
|
|
|
.\"
|
2022-03-17 10:21:06 +00:00
|
|
|
.Dd March 17, 2022
|
1995-12-27 10:51:05 +00:00
|
|
|
.Dt CCDCONFIG 8
|
2001-07-10 11:04:34 +00:00
|
|
|
.Os
|
1995-12-27 10:51:05 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm ccdconfig
|
|
|
|
.Nd configuration utility for the concatenated disk driver
|
|
|
|
.Sh SYNOPSIS
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1995-12-27 10:51:05 +00:00
|
|
|
.Op Fl cv
|
|
|
|
.Ar ccd
|
|
|
|
.Ar ileave
|
|
|
|
.Op Ar flags
|
2005-02-10 09:19:34 +00:00
|
|
|
.Ar dev ...
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1995-12-27 10:51:05 +00:00
|
|
|
.Fl C
|
|
|
|
.Op Fl v
|
|
|
|
.Op Fl f Ar config_file
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1995-12-27 10:51:05 +00:00
|
|
|
.Fl u
|
|
|
|
.Op Fl v
|
2005-02-10 09:19:34 +00:00
|
|
|
.Ar ccd ...
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1995-12-27 10:51:05 +00:00
|
|
|
.Fl U
|
|
|
|
.Op Fl v
|
|
|
|
.Op Fl f Ar config_file
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1995-12-27 10:51:05 +00:00
|
|
|
.Fl g
|
2005-02-10 09:19:34 +00:00
|
|
|
.Op Ar ccd ...
|
1995-12-27 10:51:05 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-07-06 19:34:18 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is used to dynamically configure and unconfigure concatenated disk
|
2004-07-02 21:45:06 +00:00
|
|
|
devices, or ccds.
|
|
|
|
For more information about the ccd, see
|
1995-12-27 10:51:05 +00:00
|
|
|
.Xr ccd 4 .
|
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Fl c
|
2004-07-02 21:45:06 +00:00
|
|
|
Configure a ccd.
|
|
|
|
This is the default behavior of
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm .
|
1995-12-27 10:51:05 +00:00
|
|
|
.It Fl C
|
|
|
|
Configure all ccd devices listed in the ccd configuration file.
|
|
|
|
.It Fl f Ar config_file
|
|
|
|
When configuring or unconfiguring all devices, read the file
|
|
|
|
.Pa config_file
|
|
|
|
instead of the default
|
|
|
|
.Pa /etc/ccd.conf .
|
|
|
|
.It Fl g
|
|
|
|
Dump the current ccd configuration in a format suitable for use as the
|
2004-07-02 21:45:06 +00:00
|
|
|
ccd configuration file.
|
|
|
|
If no arguments are specified, every configured
|
|
|
|
ccd is dumped.
|
|
|
|
Otherwise, the configuration of each listed ccd is dumped.
|
1995-12-27 10:51:05 +00:00
|
|
|
.It Fl u
|
|
|
|
Unconfigure a ccd.
|
|
|
|
.It Fl U
|
|
|
|
Unconfigure all ccd devices listed the ccd configuration file.
|
|
|
|
.It Fl v
|
1998-06-04 06:41:26 +00:00
|
|
|
Cause
|
|
|
|
.Nm
|
1995-12-27 10:51:05 +00:00
|
|
|
to be verbose.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
A ccd is described on the command line and in the ccd configuration
|
|
|
|
file by the name of the ccd, the interleave factor, the ccd configuration
|
2004-07-02 21:45:06 +00:00
|
|
|
flags, and a list of one or more devices.
|
|
|
|
The flags may be represented
|
1995-12-27 10:51:05 +00:00
|
|
|
as a decimal number, a hexadecimal number, a comma-separated list
|
|
|
|
of strings, or the word
|
|
|
|
.Dq none .
|
|
|
|
The flags are as follows:
|
2005-01-15 12:23:35 +00:00
|
|
|
.Bd -literal -offset indent
|
1995-12-27 10:51:05 +00:00
|
|
|
CCDF_UNIFORM 0x02 Use uniform interleave
|
1996-01-31 11:04:52 +00:00
|
|
|
CCDF_MIRROR 0x04 Support mirroring
|
2006-04-13 20:35:31 +00:00
|
|
|
CCDF_NO_OFFSET 0x08 Do not use an offset
|
|
|
|
CCDF_LINUX 0x0A Linux md(4) compatibility
|
1995-12-27 10:51:05 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The format in the
|
|
|
|
configuration file appears exactly as if it were entered on the command line.
|
|
|
|
Note that on the command line and in the configuration file, the
|
|
|
|
.Pa flags
|
|
|
|
argument is optional.
|
2005-01-15 12:23:35 +00:00
|
|
|
.Bd -literal -offset indent
|
1995-12-27 10:51:05 +00:00
|
|
|
#
|
|
|
|
# /etc/ccd.conf
|
|
|
|
# Configuration file for concatenated disk devices
|
|
|
|
#
|
2005-01-15 12:23:35 +00:00
|
|
|
|
1995-12-27 10:51:05 +00:00
|
|
|
# ccd ileave flags component devices
|
2003-12-08 10:50:36 +00:00
|
|
|
ccd0 16 none /dev/da2s1 /dev/da3s1
|
1995-12-27 10:51:05 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
The component devices need to name partitions of type
|
1999-08-06 06:25:07 +00:00
|
|
|
.Li FS_BSDFFS
|
|
|
|
(or
|
|
|
|
.Dq 4.2BSD
|
|
|
|
as shown by
|
2001-01-16 09:15:57 +00:00
|
|
|
.Xr disklabel 8 ) .
|
2006-04-13 20:35:31 +00:00
|
|
|
.Pp
|
2006-04-14 09:20:25 +00:00
|
|
|
If you want to use the
|
|
|
|
.Tn Linux
|
|
|
|
.Xr md 4
|
|
|
|
compatibility mode, please be sure
|
2006-04-13 20:35:31 +00:00
|
|
|
to read the notes in
|
|
|
|
.Xr ccd 4 .
|
2005-01-18 10:09:38 +00:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /etc/ccd.conf -compact
|
|
|
|
.It Pa /etc/ccd.conf
|
|
|
|
default ccd configuration file
|
|
|
|
.El
|
2000-11-17 11:44:16 +00:00
|
|
|
.Sh EXAMPLES
|
2002-07-06 19:34:18 +00:00
|
|
|
A number of
|
|
|
|
.Nm
|
2004-07-02 21:45:06 +00:00
|
|
|
examples are shown below.
|
|
|
|
The arguments passed
|
2002-07-06 19:34:18 +00:00
|
|
|
to
|
|
|
|
.Nm
|
|
|
|
are exactly the same as you might place in the
|
2001-07-15 07:53:42 +00:00
|
|
|
.Pa /etc/ccd.conf
|
2004-07-02 21:45:06 +00:00
|
|
|
configuration file.
|
|
|
|
The first example creates a 4-disk stripe out of
|
|
|
|
four scsi disk partitions.
|
|
|
|
The stripe uses a 64 sector interleave.
|
1999-09-23 10:35:48 +00:00
|
|
|
The second example is an example of a complex stripe/mirror combination.
|
2003-12-08 10:50:36 +00:00
|
|
|
It reads as a two disk stripe of da4 and da5 which is mirrored
|
2004-07-02 21:45:06 +00:00
|
|
|
to a two disk stripe of da6 and da7.
|
|
|
|
The last example is a simple
|
|
|
|
mirror.
|
2016-10-02 23:19:05 +00:00
|
|
|
The second slice of /dev/da8 is mirrored with the third slice of /dev/da9
|
2003-12-08 10:50:36 +00:00
|
|
|
and assigned to ccd0.
|
2005-01-15 12:23:35 +00:00
|
|
|
.Bd -literal
|
2003-12-08 10:50:36 +00:00
|
|
|
# ccdconfig ccd0 64 none /dev/da0s1 /dev/da1s1 /dev/da2s1 /dev/da3s1
|
|
|
|
# ccdconfig ccd0 128 CCDF_MIRROR /dev/da4 /dev/da5 /dev/da6 /dev/da7
|
|
|
|
# ccdconfig ccd0 128 CCDF_MIRROR /dev/da8s2 /dev/da9s3
|
1995-12-27 10:51:05 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2006-04-14 09:20:25 +00:00
|
|
|
The following are matching commands in
|
|
|
|
.Tn Linux
|
|
|
|
and
|
|
|
|
.Fx
|
|
|
|
to create a RAID-0 in
|
|
|
|
.Tn Linux
|
|
|
|
and read it from
|
|
|
|
.Fx .
|
2006-04-13 20:35:31 +00:00
|
|
|
.Bd -literal
|
2006-04-14 09:20:25 +00:00
|
|
|
# Create a RAID-0 on Linux:
|
2006-04-13 20:35:31 +00:00
|
|
|
mdadm --create --chunk=32 --level=0 --raid-devices=2 /dev/md0 \\
|
|
|
|
/dev/hda1 /dev/hdb1
|
2006-04-14 09:20:25 +00:00
|
|
|
# Make the RAID-0 just created available on FreeBSD:
|
2013-10-01 18:41:53 +00:00
|
|
|
ccdconfig -c /dev/ccd0 32 linux /dev/ada0s1 /dev/ada0s2
|
2006-04-13 20:35:31 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
1999-09-23 10:35:48 +00:00
|
|
|
When you create a new ccd disk you generally want to
|
2003-12-08 10:50:36 +00:00
|
|
|
.Xr fdisk 8
|
|
|
|
and
|
2003-01-26 02:52:07 +00:00
|
|
|
.Xr disklabel 8
|
2004-07-02 21:45:06 +00:00
|
|
|
it before doing anything else.
|
|
|
|
Once you create the initial label you can
|
|
|
|
edit it, adding additional partitions.
|
|
|
|
The label itself takes up the first
|
|
|
|
16 sectors of the ccd disk.
|
|
|
|
If all you are doing is creating file systems
|
1999-09-23 10:35:48 +00:00
|
|
|
with newfs, you do not have to worry about this as newfs will skip the
|
2004-07-02 21:45:06 +00:00
|
|
|
label area.
|
|
|
|
However, if you intend to
|
2003-01-26 02:52:07 +00:00
|
|
|
.Xr dd 1
|
1999-09-23 10:35:48 +00:00
|
|
|
to or from a ccd partition it is usually a good idea to construct the
|
2004-07-02 21:45:06 +00:00
|
|
|
partition such that it does not overlap the label area.
|
|
|
|
For example, if
|
1999-09-23 10:35:48 +00:00
|
|
|
you have A ccd disk with 10000 sectors you might create a 'd' partition
|
|
|
|
with offset 16 and size 9984.
|
2005-01-15 12:23:35 +00:00
|
|
|
.Bd -literal
|
2003-01-10 17:46:22 +00:00
|
|
|
# disklabel ccd0 > /tmp/disklabel.ccd0
|
2022-03-17 10:21:06 +00:00
|
|
|
# disklabel -R ccd0 /tmp/disklabel.ccd0
|
2003-01-10 17:46:22 +00:00
|
|
|
# disklabel -e ccd0
|
1999-09-23 10:35:48 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2003-12-08 10:50:36 +00:00
|
|
|
The disklabeling of a ccd disk is usually a one-time affair.
|
|
|
|
If you reboot the machine and reconfigure the ccd disk,
|
1999-09-23 10:35:48 +00:00
|
|
|
the disklabel you
|
|
|
|
had created before will still be there and not require reinitialization.
|
|
|
|
Beware that changing any ccd parameters: interleave, flags, or the
|
|
|
|
device list making up the ccd disk, will usually destroy any prior
|
2004-07-02 21:45:06 +00:00
|
|
|
data on that ccd disk.
|
|
|
|
If this occurs it is usually a good idea to
|
1999-09-23 10:35:48 +00:00
|
|
|
reinitialize the label before [re]constructing your ccd disk.
|
|
|
|
.Sh RECOVERY
|
2001-07-15 07:53:42 +00:00
|
|
|
An error on a ccd disk is usually unrecoverable unless you are using the
|
2004-07-02 21:45:06 +00:00
|
|
|
mirroring option.
|
2004-07-03 00:13:43 +00:00
|
|
|
But mirroring has its own perils: It assumes that
|
2004-07-02 21:45:06 +00:00
|
|
|
both copies of the data at any given sector are the same.
|
|
|
|
This holds true
|
1999-09-23 10:35:48 +00:00
|
|
|
until a write error occurs or until you replace either side of the mirror.
|
2004-07-02 21:45:06 +00:00
|
|
|
This is a poor-man's mirroring implementation.
|
|
|
|
It works well enough that if
|
1999-09-23 10:35:48 +00:00
|
|
|
you begin to get disk errors you should be able to backup the ccd disk,
|
2004-07-02 21:45:06 +00:00
|
|
|
replace the broken hardware, and then regenerate the ccd disk.
|
|
|
|
If you need
|
2001-11-24 19:47:12 +00:00
|
|
|
more than this you should look into external hardware RAID SCSI boxes,
|
2003-12-08 10:50:36 +00:00
|
|
|
RAID controllers (see GENERIC),
|
|
|
|
or software RAID systems such as
|
2004-10-31 05:28:15 +00:00
|
|
|
.Xr geom 8
|
2003-12-08 10:50:36 +00:00
|
|
|
and
|
2013-03-16 22:02:47 +00:00
|
|
|
.Xr gvinum 8 .
|
1995-12-27 10:51:05 +00:00
|
|
|
.Sh SEE ALSO
|
2003-01-26 02:52:07 +00:00
|
|
|
.Xr dd 1 ,
|
1995-12-27 10:51:05 +00:00
|
|
|
.Xr ccd 4 ,
|
2003-01-26 02:52:07 +00:00
|
|
|
.Xr disklabel 8 ,
|
2003-12-08 10:50:36 +00:00
|
|
|
.Xr fdisk 8 ,
|
2013-03-16 22:02:47 +00:00
|
|
|
.Xr gvinum 8 ,
|
|
|
|
.Xr rc 8
|
2005-01-18 10:09:38 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility first appeared in
|
2016-10-02 23:19:05 +00:00
|
|
|
.Nx 1.1 .
|
2003-01-10 17:46:22 +00:00
|
|
|
.Sh BUGS
|
|
|
|
The initial disklabel returned by
|
|
|
|
.Xr ccd 4
|
|
|
|
specifies only 3 partitions.
|
2005-07-28 10:48:07 +00:00
|
|
|
One needs to change the number of partitions to 8 using
|
2003-02-23 01:47:49 +00:00
|
|
|
.Dq Nm disklabel Fl e
|
|
|
|
to get the usual
|
|
|
|
.Bx
|
|
|
|
expectations.
|