*BSD News Article 64048


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!newshost.telstra.net!plaster.csdc.toshiba.com.au!inferno.mpx.com.au!news.unimelb.EDU.AU!news.rmit.EDU.AU!harbinger.cc.monash.edu.au!news.mira.net.au!vic.news.telstra.net!act.news.telstra.net!imci3!imci2!news.internetMCI.com!newsfeed.internetmci.com!howland.reston.ans.net!math.ohio-state.edu!news.cis.ohio-state.edu!nntp.sei.cmu.edu!nntp.club.cc.cmu.edu!cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!news.sesqui.net!uuneo.neosoft.com!bonkers
!not-for-mail
From: asami@cs.berkeley.edu (Satoshi Asami)
Newsgroups: comp.unix.bsd.freebsd.announce
Subject: ccd for FreeBSD-current
Date: 22 Mar 1996 19:35:19 -0600
Organization: Taronga Park BBS
Lines: 246
Sender: peter@taronga.com
Approved: peter@taronga.com
Message-ID: <4ivkgn$e5i@bonkers.taronga.com>
NNTP-Posting-Host: localhost.taronga.com

The ccd group is proud to announce the availability of the
concatenated disk driver for FreeBSD-current.  It's been running here
for a few days without any problem, but of course that doesn't mean it 
will work for you.

The README file is included below.  You can also go to the newborn ccd 
master site (in fact I just made it tonight) at

  http://stampede.cs.berkeley.edu/ccd/

which includes some ccd news, an html-enhanced version of the README,
etc.

Happy concatenating!

Satoshi
-------
$Id: ccd.README,v 1.7 1996/03/21 13:33:45 asami Exp $
**********************************************************
*           The FreeBSD ccd driver (pre-alpha)           *
*                      for 2.2-current users             *
*                           by Satoshi Asami             *
*                          and Nisha Talagala            *
*                         version of 96/03/20            *
**********************************************************

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

 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)

(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 pre-alpha 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)
  sys/dev/ccd/ccd.PLIST
  sys/dev/ccd/ccd.4
  sys/dev/ccd/ccd.c
  sys/sys/ccdvar.h
  sbin/ccdconfig/Makefile
  sbin/ccdconfig/ccdconfig.8
  sbin/ccdconfig/ccdconfig.c
  sbin/ccdconfig/pathnames.h
  ccd.patch

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:

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
course.)

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 Makefile.inc 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,
etc.

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@stampede.cs.berkeley.edu.  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@cs.berkeley.edu).

(12) Where do I get new versions?

They will be made available as

  ftp://stampede.cs.berkeley.edu/pub/ccd/ccd-<date>.tar.gz

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

  http://stampede/cs.berkeley.edu/ccd/

which contains the latest development news and links to various
tarballs.

(13) I'm tired

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

Satoshi