1.\" 2.\" Copyright (c) 1994 Jason Downs 3.\" Copyright (c) 1994 Jason R. Thorpe 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by Jason Downs and 17.\" Jason R. Thorpe. 18.\" 4. Neither the name of the author nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" $Id: ccd.4,v 1.2 1994/08/05 22:54:09 mycroft Exp $ 35.\" 36.Dd August 3, 1994 37.Dt CCD 4 38.Os BSD 4 39.Sh NAME 40.Nm ccd 41.Nd procedure for configuring concatenated disk devices 42.Sh DESCRIPTION 43The 44.Nm 45driver provides the capability of `concatenating' two 46or more disks/partitions into one virtual disk. 47.Pp 48This document assumes that you're familiar with how to generate kernels, 49and how to properly set up a system configuration file. 50.Pp 51First, you need to add the disks that you wish to concatenate to your 52kernel configuration. They should probably have `hard-coded' id numbers 53as opposed to wildcards, since you don't want the autoconfig sequence 54to move these disks around. For a hp300, your config might look something 55like this: 56.Pp 57.Bd -unfilled -offset indent 58master hpib0 at scode7 59master hpib1 at scode? 60master hpib2 at scode? 61disk rd0 at hpib1 slave 0 62disk rd1 at hpib1 slave 1 63disk rd2 at hpib1 slave 2 64disk rd3 at hpib2 slave 0 65disk rd4 at hpib2 slave 1 66tape ct0 at hpib0 slave ? 67.Ed 68.Pp 69In this example, the disks rd3 and rd4 will be concatenated. 70.Pp 71The `c' partitions of the disks 72.Pa should not 73be concatenated. Rather, you should use some other partition, which is 74defined in the individual labels of each disk, to use the entire disk 75.Pa except the first cylinder. 76This is to avoid corrupting the labels of component disks within the 77concatenated disk. In this example, the `h' partition will be used. 78.Pp 79The next piece is the pseudo-device line in your kernel configuration file 80that actually configures the 81.Nm 82device. It should look something like: 83.Bd -unfilled -offset indent 84pseudo-device ccd0 on rd3h and rd4h interleave 8192 85.Ed 86.Pp 87This will configure a virtual disk using rd3h and rd4h, interleaving the access 88at every 8192 blocks. An interleave is recommended, but not required; if it 89is not specified, the driver will use each disk in sequence, which isn't as 90efficient as interleaving the access. 91.Pp 92In this example, the disks to be concatenated are HP 7958s, which are 93approximately 120 megabytes in size. The label on each of the 94example disks reads as follows: 95.Bd -unfilled -offset indent 96# /dev/rrd3c: 97type: HP-IB 98disk: 99label: 100flags: 101bytes/sector: 512 102sectors/track: 36 103tracks/sector: 7 104sectors/cylinder: 252 105cylinders: 1013 106rpm: 3600 107interleave: 1 108trackskew: 0 109cylinderskew: 0 110headswitch: 0 # milliseconds 111track-to-track seek: 0 # milliseconds 112drivedata: 0 113.Pp 1142 partitions: 115# size offset fstype [fsize bsize cpg] 116 c: 255276 0 boot 1024 4096 16 # (Cyl. 0 - 1012) 117 h: 255024 252 4.2BSD 1024 4096 15 # (Cyl. 1 - 1012) 118.Ed 119.Pp 120Of course, this label will not work for any other type of disk, so you 121will have to create your own. In the simple case, make the `h' (or whatever 122partition you specified in your ccd pseudo-device specification) the size of 123partition `c', 124minus the number of sectors/cylinder, and set the offset to the same 125number as your sectors/cylinder. This leaves an extra cylinder for the label 126to reside in. 127.Pp 128Once you have given each disk an appropriate label, you should reboot 129with the newly generated, ccd-capable kernel. 130.Pp 131At boot time, shortly after the autoconfig sequence, you should see a message 132like the following: 133.Bd -unfilled -offset indent 134ccd0: 2 components (rd3h, rd4h), 507904 blocks interleaved at 8192 135ccd0 configured 136.Ed 137.Pp 138If you do not see this message, then the 139.Nm 140device is 141.Pa NOT 142configured. 143.Pp 144Now it is time to make the device nodes for the concatenated disk, if you 145have not done so already. You can do this with the 146.Xr MAKEDEV 8 147script, as follows: 148.Bd -unfilled -offset indent 149# cd /dev 150# sh MAKEDEV ccd0 151.Ed 152.Pp 153Now you need to create 154.Xr disktab 5 155entry for the virtual disk, since it does not 156support labels within itself. The following is appropriate for this 157example: 158.Bd -unfilled -offset indent 159rd7958-2:\\ 160 :ty=winchester:ns#36:nt#7:nc#2024:\\ 161 :pc#507904:bc#4096:fc#1024 162.Ed 163.Pp 164All values are copied from the `standard' entry, taking into account any 165differences from your label(s), except: 166.Bd -unfilled -offset indent 167nc#4048 168This is the total number of cylinders. This should be the 169total number of cylinders from all of the partitions you 170defined your ccd to encompass. 171.Pp 172pc#507904 173This is the total size, which is not the sum of all of the 174partitions configured as the ccd. Use the number reported 175by the autoconfig sequence. 176.Ed 177.Pp 178If your 179.Xr disktab 5 180entry is set up correctly, you can now use 181.Xr newfs 8 182to create a file system on the virtual disk: 183.Bd -unfilled -offset indent 184# newfs /dev/rccd0c rd7958-2 185.Ed 186.Pp 187where `/dev/rccd0c' is the raw device of the 188.Nm 189device, and `rd7958-2' is the name 190of your 191.Xr disktab 5 192entry. 193.Pp 194You should now have a working file system on the concatenated disk, which you 195can 196.Xr fsck 8 197and 198.Xr mount 8 199just like any other, normal, disk. 200.Sh WARNINGS 201Presumably, you must use disks of all of the same type. The results of using 202disks with different geometries would be unpredictable, at best. 203.Pp 204If just one (or more) of the disks in a concatenated disk fails, the entire 205file system will be lost. 206.Pp 207There is a kernel-level limit of eight devices per one 208.Nm 209device. 210.Sh BUGS 211Currently, the 212.Nm 213driver works only on the hp300. It should be fairly easy to add 214support for other architectures using 215.Xr config 8 , 216but support for architectures using 217.Xr config.new 8 218is more difficult. 219.Sh FILES 220/etc/disktab - disk description file 221.Pp 222.Sh SEE ALSO 223.Xr MAKEDEV 8 , 224.Xr disktab 5 , 225.Xr newfs 8 , 226.Xr fsck 8 , 227.Xr mount 8 , 228.Xr config 8 , 229.Xr config.new 8 230