ccd for 2.1-stable

Satoshi Asami asami
Sat Apr 27 20:01:48 PDT 1996

Hello the disk world,

I ported the 2.2-current version of ccd back to 2.1-stable.  There is
no change in functionality from the previous version.  (It's just that
it compiles now on your 2.1-stable machine. :)


P.S. Please check out "" and
     "README-s.html" in that directory!
$Id: ccd.README,v 1996/04/27 07:08:43 asami Exp $
*             The FreeBSD ccd driver (beta)              *
*                       for 2.1-stable users             *
*                           by Satoshi Asami             *
*                          and Nisha Talagala            *
*                         version of 96/04/27            *

(0) Changes from previous versions (Jan/14, Jan/31, Mar/20, Mar/25)

 Jan/14 -> Jan/31:
 . There is mirroring support
 . ccdcontrol is renamed ccdconfig (back to original NetBSD name)
 . ccdconfig is now in /sbin (so you can call it from rc -- a patch to 
   rc is also included)

 Jan/31 -> Mar/20:
 . It now runs under -current
 . ccd.c is moved from sys/ccd to sys/dev/ccd (like NetBSD)
 . The driver is now a proper pseudo-device (unlike the isa device
   like before, see below for kernel config file changes)

 Mar/20 -> Mar/25:
 . Mirror handling code is cleaner, and doesn't kludge around b_resid's
   anymore.  For the implementation, read note near top of ccd.c.

 Mar/25 -> Apr/27:
 . Ported back from 2.2-current to 2.1-stable.  No change in

(1) Introduction

This is a port of NetBSD's ccd (concatenated disk) driver.  It is not
a complete work in any way, but seems to be working fairly ok here, so
we decided to make it available so that people can test it and even
fix some bugs. :)

(2) Warning

As the title above says, this is beta software and is therefore VERY
GREEN.  You should not expect this to work.  It may eat your system
disk for lunch.  It may even fry your microwave in the process.  Make
sure you have backed up all your data and locked your children in the
basement before you attempt to try this.

(3) What it does

In case you don't know what it is, ccd is a disk array driver.  You
can combine several disk partitions into one "virtual disk".  Then you
can partition it or use the whole thing or add some pepper and salt or
whatever you want.

(4) What it does not

There is no parity support yet.  That's why its name doesn't resemble
RAID in any form.  However, there is mirroring available starting
from the Jan/31 version.

(4a) Cool, how do I use mirroring?

Add CCDF_MIRROR to the list of flags (third field in /etc/ccd.conf),
and your disk space will magically shrink into half.  The writes go to
all disks, while the reads will all come from the first n/2 disks.

If one of the disk goes "poof", you can reconfigure the ccd to use
only half the disks without mirroring.  That should keep your users
happy until you get the chance to put in the replacement disk.  When
the new disk is installed, use the ccd recovery program called `dd'
(which mysteriously made its way into the release even before we put
out an alpha version of ccd), e.g., to copy sd1g to sd4g,

dd if=/dev/rsd1g of=/dev/rsd4g bs=1048576

(5) How to compile

Note this package is for FreeBSD-current (aka 2.2-current).  It
probably won't work right away for 2.1R or 2.1-stable.  It even may
not work for your version of -current (depending on what date you got
your source).

Ok, first you need to unpack the distribution.  It contains the
following files:

  sys/dev/ccd/ccd.README (this file)

You can unpack them in your /usr/src directory.

After that, apply the ccd.patch.  It makes several changes to the
header files and such.  You can use the following command to apply the

patch -p < ccd.patch

(On a separate line for your triple-clicking pleasure.)

There is a patch to rc in there, so take a look at your /etc/rc and
install the new one.  If you have changed your /etc/rc, either cut &
paste the relevant lines or take out the hunk pertaining rc and apply
it to your /etc/rc.

Then add the following to your kernel configuration file:

pseudo-device   ccd     4

(You can have as many of them as you want, or fewer than four, of

We recommend you to add "options DDB" too.  This will make the kernel
go into a debugger in case of a panic.  That will make it easier for
you to send us a complete bug report.  (Note this will disable
auto-rebooting after a panic, so don't do this on a machine that has
to run unattended.)

(6) How to use ccd

Wait, you need to compile ccdconfig too!  Go in there, do "make depend
all install".  If install complains about missing directories and
such, make sure you have the correct in the parent
(/usr/src/sbin) directory.  If you don't have one (like, you don't
have the sbin source tree), just editing the ccdconfig Makefile and
adding "BINDIR=/sbin" and "NOSHARED=YES" by hand should do.

Also, you will need to create the device files.  There is a patch to
MAKEDEV included in ccd.patch, so go into etc/etc.i386 and install the
new MAKEDEV into /dev.  Then you can, say, "cd /dev; sh MAKEDEV ccd0"
to create the appropriate device files for your first ccd devices,

Now, go and read the man pages.  ccdconfig.8 should be installed by
now; ccd.4 is still sitting in the source directory so go read it
there.  (Try "nroff -man ccd.4 | less -s".)

Assuming you've read them, here is an example, if you have four
partitions (sd1g, sd2g, sd3g, sd4g) you want to combine into one:

echo "ccd0 16 none /dev/sd1g /dev/sd2g /dev/sd3g /dev/sd4g" > /etc/ccd.conf
ccdconfig -Cv (to configure; you'll see a message here)
disklabel ccd0 (just to make sure there is a valid disklabel)
newfs /dev/rccd0c
mount /dev/ccd0c /mnt
(play with /mnt)
umount /mnt
ccdconfig -U (to unconfigure)

(7) What's the second field in /etc/ccd.conf?

That's the "interleave size".  Basically, the ccd driver will write
this many sectors (usually 512 bytes) to one disk before it moves to
the next disk.  As a special case, a zero here means no interleave,
i.e., to concatenate disks serially.

We have found that in FFS, a value of 16 usually optimizes read
performance, while the write peaks with a much larger value (like
512).  This probably has to do with cluster_write() thinking it's
writing to a single disk when it's actually not.  This is one of the
things we are planning to fix.

(8) Are there any caveats?

Oh sure.  One of them is "don't use a partition that starts at a
beginning of the slice".  So please leave some space at the beginning
of the slice in the partitions you are combining (sd[1-4]g in the
above example).  Of course, if someone can figure out why and fix it,
that will be great.

Another is that if you specify odd numbers of disks for mirroring, it
will say it's not going to use the last disk, but doesn't release the
disk properly so you won't be able to use it elsewhere.  We'll fix
this soon.

(9) My disk is totally hosed.  It's all your fault!

See (2).

(10) Anything I can help?

Well, any bug fix is welcome.  In addition to the stuff mentioned
above, we are aware of at least the following:

 a. The disklabel support is still old (pre-2.x FreeBSD style).  We
    should be including <sys/diskslice.h> instead of <sys/disk.h> in
    ccd.c.  Can someone take a look at this?

 b. On a similar note, if I do "disklabel -e ccdX" immediately after
    configuring the disk, it won't let me write it with the error:

      disklabel: ioctl DIOCWDINFO: No disk label on disk;
      use "disklabel -r" to install initial label

    It works if I do a "disklabel -w -r ccdX <some arbitrary entry in
    /etc/disktab>" first and then edit that label.  I don't know if
    fixing the above will take care of this too.

 c. I'm not exactly sure what the "geometry" of this pseudo-disk
    means.  If it doesn't matter, it's ok; if newfs (for instance)
    cares, we should give it a better set of default values.

 d. Someone please tell me how to create an lkm out of this.

(11) Where should I send bug reports/fixes?

Please send them to ccd at  This will reach the
two primary developers (Satoshi and Nisha), as well as other
interested parties.  If you want to be added to this list, please send
mail to Satoshi (asami at

(12) Where do I get new versions?

They will be made available as<date>.tar.gz

so check this site regularly.  Also, you can browse at


which contains the latest development news and links to various

(13) I'm tired

Yeah, I'm tired too.  Well go to sleep now then, and try it tomorrow!
Good night!


More information about the freebsd-announce mailing list