SP(4I) — Unix Programmer’s Manual
NAME
sp − disk spanning pseudo disk driver
SYNOPSIS
SP0 at address 0x0/00 ∗∗∗ no vector
DESCRIPTION
sp is a pseudo-disk driver that allows an arbitrarily large logical disk partition to be "spanned" across a number of physical disk partitions. Once it is properly configured, this resulting logical disk has the same interface to the kernel and to a user program as any standard disk partitions.
Since this device is intended to allow the system administrator to custom design the size of a partition, and also since sp is not intended to have a root or swap partition, the normal conventions of dividing a disk into a through h partitions has been abandoned. Instead, the sp device has only four minor devices currently in use, sp0c, sp1c, sp2c, and sp3c, each of which is an independently configurable pseudo-disk partition.
CONFIGURATION
The configuration of a spanned disk (the list of physical partitions that comprise the logical disk) can be specified in one of two ways:
1.Compile the configuration statically into the kernel, so that the spanned disk is available at boot time.
2.Describe the configuration in the file /etc/sptab (see sptab(5)), and configure the sp device driver dynamically by running spconfig(8) manually or from within /etc/rc.
In either case, the information needed to configure a spanned disk is the same. You create a spanned disk of the desired size by specifying a number of physical disk partitions that, when added together, are large enough to store the resulting logical disk. You define the actual spanned disk by specifying a list of partitions that create it. This list consists of the physical disk major and minor device numbers.
For example, consider a VME-based system that has two Maxtor 1140 disk drives and you want to create a single disk partition of at least 150 Mbytes. Running the command
diskpart max1140
produces the following information:
max1140: #sectors/track=17, #tracks/cylinder=15 #cylinders=916
PartitionSizeRange
a158840 - 62
b3344063 - 194
c2335800 - 915
d15884195 - 257
e55936258 - 477
f111537478 - 915
g183702195 - 915
hunused
A spanned disk of 150 Mbytes requires 292968 blocks. (One block equals 512 kbytes.) In this example system with two disk drives you can use the "g" partition on drive 0 and the "f" partition on drive 1 for a total of 295239 blocks or 151 Mbytes.
To sensibly allocate the remaining space on drive sd1, you might use sd1b for interleaved swap space, then combine sd1a, sd1d, and sd1e (partitions (1,8), (1,11), (1,12)) to form a separate 45-Mbyte (87704-block) spanned disk. The resulting file system layout would probably be:
PartitionSizeUsageComment
sd0a8.1 Mbytesrootroot file system
sd0b17.1 Mbytesswapdrive 0 swap area
sd1b17.1 Mbytesswapdrive 1 swap area
sp0c151 Mbytesusr1spanned disk
sp1c44.9 Mbytesusr2spanned disk
There is one restriction on the use of physical disk partitions to make a spanned disk: Never use the c physical partitions on any disk as part of a spanned disk, because the bad block table at the end of the physical disk can become corrupted. Aside from this restriction, you can mix the type and number of physical partitions used to create the spanned disk in any order, and in fact need not use the same type drives, or even similar controllers. To use an entire physical disk as part of a spanned disk, you should include entries for the a, b, d, e, f, g, and h partitions in the spanned disk configuration rather than specifying the c partition.
Dynamic Configuration
Of the two configuration methods, this is the simpler. The exact configuration is described in the file /etc/sptab, and the format is described in detail in sptab(5). For example, the configuration described above would appear in /etc/sptab as:
sp0c ( (1,6),(1,13) )
sp1c ( (1,8),(1,11),(1,12) )
This shows that device /dev/sp0c comprises partitions (1,6) and (1,13), and device /dev/sp1c comprises partitions (1,8), (1,11), and (1,12). No size information is needed in this file, since that will be gathered by the driver itself when spconfig(8) is run.
After /etc/sptab has been properly edited, running spconfig loads the configuration tables in the device driver, and leaves the driver ready for normal operation. Any I/O calls made on the driver prior to running spconfig will result in an error.
Static Configuration
Static configuration of a spanned disk requires modification of one file in the kernel configuration area, and subsequent recompilation of the kernel. The file is /sys/conf/spconf.c, which describes the configuration of each of four possible pseudo-disks.
The spconfig.c file contains the major and minor device numbers for all of the physical drives used in creating spanned disks. For each spanned disk device, the file entry is a comma-separated series of makedev(8) commands specifying the decimal major and minor numbers of the partitions. The spconfig.c file must contain four entries for spanned disks (sp[0-3]c), even if less than four are used.
The spconfig.c file contains example lines to show syntax for entries. Again using the example configuration described earlier, the spconfig.c entries would appear as:
dev_t sp0c[Nsp_segs] = {makedev(1,6), makedev(1,13), 0};
dev_t sp1c[Nsp_segs] = {makedev(1,8), makedev(1,11), makedev(1,12), 0};
dev_t sp2c[Nsp_segs] = {0};
dev_t sp3c[Nsp_segs] = {0};
Note that the last two entries, sp2c and sp3c, are null entries. These partitions will be listed with a “not configured” message at boot time. The line
dev_t ∗sp_config[] = {sp0c, sp1c, sp2c, sp3c, 0};
must remain unaltered.
Once this file is edited, the kernel must be rebuilt as described in the UNIX 4.3BSD System Administrator Guide (SMM:1). Thereafter, during boot procedures or in response to the dmesg(8) command, the following lines will appear among device configuration messages:
SP0at address 0x400/02000 ∗∗∗ no vector
sp0at SP0 slave 0(sd0g sd1f ):151M (295239)
sp1at SP0 slave 1(sd1a sd1d sd1e ):45M (87704)
sp2at SP0 slave 2(∗∗ not configured ∗∗)
sp3at SP0 slave 3(∗∗ not configured ∗∗)
MAKING FILE SYSTEMS
Since there is no standard configuration associated with an sp device, newfs(8) cannot be used to build a file system. Therefore it is necessary to fall back on mkfs(8), which requires the user to specify the size of the file system to be built.
To insure that the pseudo-disks operate correctly with block dependent operations, the size of the disk should be rounded down to the nearest 16-block boundary. Recalling the information obtained from diskpart(8) for the previous example, the usable sizes of the spanned disk partitions are calculated as follows:
Pseudo-diskPhysical partitionsSize
sp0csd0g183702
sd1f111537
______
size of pseudo disk =295239
(/dev/sp0c)
blocked value (16 block) =295232
Pseudo-diskPhysical partitionsSize
sp1csd1a 15884
sd1d 15884
sd1e 55936
______
total size of pseudo disk = 87704
(/dev/sp1c)
blocked value (16 block) = 87696
With these numbers in hand, it is now only necessary to run mkfs(8), as in:
/etc/mkfs /dev/rsp0c 295232
/etc/mkfs /dev/rsp1c 87696
If all disk partitions making up a given spanned-disk are of the same physical type, as in this example, then a more efficient file system may be built by supplying additional arguments to the mkfs command. You should specify the number of sectors per track and the number of tracks per cylinder (see mkfs(8) for default values). In the above example of two Maxtor 1140’s on a VME system the diskpart(8) command shows 17 sectors per track and 15 tracks per cylinder. To build the file system, use the commands
/etc/mkfs /dev/rsp0c 295232 17 15
/etc/mkfs /dev/rsp1c 87696 17 15
If you are using dynamic configuration, you must run spconfig(8) prior to running mkfs(8) (in fact, prior to any pseudo-disk access).
FILES
/dev/sp[0-3]cblock files
/dev/rsp[0-3]craw files
/etc/sptab
/etc/spconfig
/sys/conf/spconf.c
SEE ALSO
sptab(5), spconfig(8), diskpart(8), mkfs(8)
UNIX 4.3BSD System Administrator Guide (SMM:1)
DIAGNOSTICS
Since the sp device driver is a pseudo device which in turn calls upon other device drivers, all the diagnostics for the drivers used in making up a spanned disk apply.
BUGS
As in the diagnostics section above, bugs listed under the physical device drivers in question will be visible through the sp driver.
Do not use a spanned disk as the root (/) partition. The PROMs cannot access spanned disks, and the system will not boot. Do not use a spanned disk as the swap partition.
4I BSD — October 28, 1987