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