VTOC(5) — UNIX Programmer’s Manual
NAME
vtoc − volume table of contents
SYNOPSIS
#include <sys/vtoc.h>
DESCRIPTION
The files /etc/vtoc/∗ describes the disk partitions used for particular disk drives and disk types. The system administrator can modify them with a text editor, and use them as arguments to mkvtoc(8) (see "Dynix System Adminstrators Guide" chapter 6). The VTOC of a disk may be displayed using prtvtoc(8) or prtvtoc(8s).
Special files refer to partitions 0-255. The first eight correspond to the partitions named ’a‘ to ’h‘. The special files with partition number 255 refers to the whole disk. The standard device names begin with the disk controller name (e.g., zd or sd), followed by the drive number, followed by the letter. By convention, these special files are in the directory /dev/.
The block devices access the disk via the system’s normal buffering mechanism and may be read and written without regard to physical disk records. There is also a raw interface that provides for direct transmission between the disk and the user’s read or write buffer. The names of the raw special files are conventionally the same as the block special files, but with the letter ’r‘ prepended to its name — e.g., /dev/rsd0a. The whole disk interface, by convention, is the special file without the partitioning letter — e.g., /dev/rsd0.
Partition Data
The partition data resides in an area of the disk called the "Volume Table of Contents" ( VTOC ) which is at most V_SIZE sectors long, and resides at sector V_VTOCSEC, offset by any reserved cylinders a disk may have.
The structure of the VTOC is described in /usr/include/sys/vtoc.h . Some of the fields include:
v_sanity
This is a magic cookie which identifies this section of the disk as a valid VTOC. It is normally set to VTOC_SANE.
v_version
The version of this particular VTOC.
v_cksum
A checksum, which allows the contents of the VTOC to be verified.
v_nparts
The number of valid partitions in this VTOC.
v_secsize
The size in bytes of sectors on this disk.
v_ntracks
The number of tracks per cylinder.
v_nsectors
The number of sectors per track.
v_ncylinders
The number of cylinders on this disk. The parameters v_ntracks, v_nsectors, and v_ncylinders are used to make filesystems. Since it is not always possible to know the exact geometry of a disk or a disk may not have a fixed geometry, these values should be chosen to reflect the total size of the disk when multiplied together.
v_rpm
The number of disk revolutions-per-minute.
v_disktype
This is a character array which gives the name of the disk type. It is at most VTYPCHR characters long.
v_part Per-partition data.
Each partition has data associated with it. That information includes:
p_start
The sector number where this partition starts.
p_size The size of this partition in sectors.
p_type
The type of this partition.
p_bsize
The size in bytes of filesystem blocks to be made for this partition.
p_fsize
The filesystem fragment size in bytes for this partition.
The parameters p_bsize and p_fsize will only be needed if a filesystem is to be made on this partition. If no filesystem will be made on this partition, then these values are not significant.
Partition Types
Each partition can have associated with it a partition type, which is recorded in the per-partition section of the VTOC. The partition types are:
V_NOPART
This type indicates that this slot in the partition table is empty. No device will be made available which corresponds to this minor device number.
V_RAW
This is a regular partition. Partitions of this type may have filesystems constructed on them, or may be used as raw disk partitions.
V_BOOT
System bootstrap area. These partitions are like those of the type V_RAW, except commands that require a bootstrap partition will search for the first one of type V_BOOT.
V_RESERVED
This designates an area of the disk that may not be accessed under normal circumstances, since it maps an area of the disk reserved for some specific purpose. For example, some disk controllers require that areas of the disk be reserved for bad block lists or configuration information. Most disk types also reserve space for diagnostic routines to read and write the disk without destroying data. The VTOC itself is mapped as reserved space. Programs that write VTOCs directly should disallow any attempt to change the definition of partitions of this type, or serious problems may result.
V_FW System controller firmware area. These partitions are like partitions of type V_RAW but they have added meaning in that commands which access system bootstraps on disk will by default look for the first partition of type V_FW to read or write the firmware. The firmware is only written if the system has a system controller board with loadable firmware.
V_DIAG
S2000 hardware scan and cache data area. These partitions are like partitions of type V_RAW but they have added meaning to the SSM firmware. The SSM firmware will execute a hardware dump routine when an S2000 processor board reports errors detectable by the SSM. This data will be dumped to a V_DIAG partition and contains much of the internal state of the hardware componenets of the S2000 processor board.
IOCTLS
The disk drivers support the following commands to ioctl():
V_READ
This ioctl will cause the VTOC to be read from disk and returned to the caller. This is the only way to read the VTOC, since read/write access to the VTOC area is disallowed. If there is not a valid VTOC on the disk, then EINVAL is returned. The third argument to the ioctl call should be a pointer to an area of memory large enough to store the entire struct vtoc. For portability to future versions of the kernel, a block of size V_SIZE should be allocated for struct vtoc.
V_WRITE
This ioctl will cause the VTOC to be written to disk. This is the only way to write the VTOC, since read/write access to the VTOC area is disallowed when a VTOC driver is present. The third argument to the ioctl call should be a pointer to a filled-out struct vtoc which will be sanity-checked before being written to disk. If the VTOC fails a sanity-check, then EINVAL is returned. This may include overlapping partitions, or an attempt to put a partition over the VTOC area of the disk which is not of type V_RESERVED. If a partition is changed in the new VTOC relative to the old VTOC (i.e., any of the per-partition data is changed), that partition must not be mounted or being used as a swap device, and the raw device must not be open by any process.
V_PART
This ioctl will return the partition information for the disk. It takes its arguments as V_READ does. V_PART differs from V_READ in the V_PART can be used on non VTOC disks. When no VTOC is found, V_PART sets the value of v_sanity to 0xbadbad.
FILES
/etc/vtoc/∗
/dev/{wd,sd,xp}?
/dev/r{wd,sd,xp}∗
SEE ALSO
DYNIX