Original work by Christopher
Shumway. Revised by Jim
Brown.
When choosing a mass storage solution the most important factors to consider are
speed, reliability, and cost. It is rare to have all three in balance; normally a fast,
reliable mass storage device is expensive, and to cut back on cost either speed or
reliability must be sacrificed.
In designing the system described below, cost was chosen as the most important factor,
followed by speed, then reliability. Data transfer speed for this system is ultimately
constrained by the network. And while reliability is very important, the CCD drive
described below serves online data that is already fully backed up on CD-R's and can
easily be replaced.
Defining your own requirements is the first step in choosing a mass storage solution.
If your requirements prefer speed or reliability over cost, your solution will differ
from the system described in this section.
In addition to the IDE system disk, three Western Digital 30GB, 5400 RPM IDE disks
form the core of the CCD disk described below providing approximately 90GB of online
storage. Ideally, each IDE disk would have its own IDE controller and cable, but to
minimize cost, additional IDE controllers were not used. Instead the disks were
configured with jumpers so that each IDE controller has one master, and one slave.
Upon reboot, the system BIOS was configured to automatically detect the disks
attached. More importantly, FreeBSD detected them on reboot:
ad0: 19574MB <WDC WD205BA> [39770/16/63] at ata0-master UDMA33
ad1: 29333MB <WDC WD307AA> [59598/16/63] at ata0-slave UDMA33
ad2: 29333MB <WDC WD307AA> [59598/16/63] at ata1-master UDMA33
ad3: 29333MB <WDC WD307AA> [59598/16/63] at ata1-slave UDMA33
Note: If FreeBSD does not detect all the disks, ensure that you have jumpered
them correctly. Most IDE drives also have a “Cable Select” jumper. This is
not the jumper for the master/slave
relationship. Consult the drive documentation for help in identifying the correct
jumper.
Next, consider how to attach them as part of the file system. You should research both
vinum(8) (Chapter 20) and ccd(4). In this
particular configuration, ccd(4) was chosen.
The ccd(4) driver allows
you to take several identical disks and concatenate them into one logical file system. In
order to use ccd(4), you need a
kernel with ccd(4) support built
in. Add this line to your kernel configuration file, rebuild, and reinstall the
kernel:
device ccd
The ccd(4) support can
also be loaded as a kernel loadable module.
To set up ccd(4), you must first
use bsdlabel(8) to label
the disks:
bsdlabel -w ad1 auto
bsdlabel -w ad2 auto
bsdlabel -w ad3 auto
This creates a bsdlabel for ad1c, ad2c and ad3c that spans the entire
disk.
The next step is to change the disk label type. You can use bsdlabel(8) to edit
the disks:
bsdlabel -e ad1
bsdlabel -e ad2
bsdlabel -e ad3
This opens up the current disk label on each disk with the editor specified by the EDITOR environment variable, typically vi(1).
An unmodified disk label will look something like this:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 60074784 0 unused 0 0 0 # (Cyl. 0 - 59597)
Add a new e partition for ccd(4) to use. This
can usually be copied from the c partition, but the fstype
must
be 4.2BSD. The disk label should now look something like
this:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 60074784 0 unused 0 0 0 # (Cyl. 0 - 59597)
e: 60074784 0 4.2BSD 0 0 0 # (Cyl. 0 - 59597)
Now that you have all the disks labeled, you must build the ccd(4). To do that,
use ccdconfig(8), with
options similar to the following:
ccdconfig ccd0 32 0 /dev/ad1e /dev/ad2e /dev/ad3e
The use and meaning of each option is shown below:
- The first argument is the device to configure, in this case, /dev/ccd0c. The /dev/ portion is
optional.
- The interleave for the file system. The interleave defines the size of a stripe in
disk blocks, each normally 512 bytes. So, an interleave of 32 would be 16,384 bytes.
- Flags for ccdconfig(8). If you
want to enable drive mirroring, you can specify a flag here. This configuration does not
provide mirroring for ccd(4), so it is set
at 0 (zero).
- The final arguments to ccdconfig(8) are the
devices to place into the array. Use the complete pathname for each device.
After running ccdconfig(8) the ccd(4) is configured.
A file system can be installed. Refer to newfs(8) for options,
or simply run:
newfs /dev/ccd0c
Generally, you will want to mount the ccd(4) upon each
reboot. To do this, you must configure it first. Write out your current configuration to
/etc/ccd.conf using the following command:
ccdconfig -g > /etc/ccd.conf
During reboot, the script /etc/rc runs ccdconfig -C if /etc/ccd.conf exists. This
automatically configures the ccd(4) so it can be
mounted.
Note: If you are booting into single user mode, before you can mount(8) the ccd(4), you need to
issue the following command to configure the array:
ccdconfig -C
To automatically mount the ccd(4), place an entry
for the ccd(4) in /etc/fstab so it will be mounted at boot time:
/dev/ccd0c /media ufs rw 2 2