mkpart(1M) —
NAME
mkpart − disk maintenance utility
SYNOPSIS
/etc/mkpart [ −f filename ] [ −p partition ] ... [ −P partition ] ...
[ −b ] [ −B filename ] [ −A sector ] ... [ −V ] [ −v ]
[ −i [ −I interleave ] ] [ −x file ] [ −t [ vpa ] ]
[ −n ] [ −O ] device
DESCRIPTION
This program allows the system administrator to display and modify the data structures that the disk driver uses to access disks. These structures describe the number, size, and type of the partitions, as well as the physical characteristics of the disk drive itself.
The user maintains a file of stanzas, each of which contains comments and parameters. The stanzas are of two varieties: those that describe disk partitions and disk devices. Stanzas may refer to other stanzas of the same type so that common device or partition types may be customized. By default, the stanza file is named /etc/partitions. The required parameter device specifies the device stanza for the disk to be used.
The following options can be used with mkpart:
−f filename
Specifies the partition and device specification stanza file. If not present, /etc/partitions is assumed.
−p partition
Removes a partition from the vtoc on the specified device. The partition is a stanza that indicates the partition to be removed by its partition number parameter; no comparisons are made by attribute. Note that alternate partitions cannot be removed.
−P partition
Adds a partition to the vtoc on the specified device. A partition is a stanza that contains and/or refers to other stanzas that contain all of the necessary parameters for a vtoc partition.
−b Causes only the boot program to be updated, unless other options are specified.
−B filename
Specifies a different boot program than the one given by the device stanza.
−F interleave
Causes the entire device to be hardware formatted. This process rewrites all the sector headers on each track of the disk, enabling subsequent access using normal reads and writes. interleave is the distance in physical sectors between each successive logical sector. Normal values are 1 for track-cache controllers and 2-4 for standard controllers.
−A sector
Marks the specified sector as bad and assigns it an alternate if possible. sector is a zero-based absolute sector number from the beginning of the drive. To compute a sector number given cylinder, head, and (zero-based) sector in track, the formula is:
cylinder * (sectors-per-track * heads-per-cylinder) + head * (sectors-per-track) + sector
−V Causes a complete surface-analysis pass to be run. This first writes a data pattern (currently 0xe5 in every byte) to each sector of the disk, then reads each sector. Any errors are noted and the bad sectors found are added to the alternates table if possible.
−v Causes a non-destructive surface-analysis pass to be run. This pass reads every sector of the disk, noting bad sectors as above.
−i Initializes the Volume Table of Contents (VTOC) on the drive to default values, clearing any existing partition and bad-sector information which may have existed. This is the only way to remove an alternate partition and can be used to re-initialize a drive which may have obsolete or incorrect VTOC data on it.
−I interleave
Provides an interleave value to use to initialize the VTOC without actually formatting the drive.
−x file
Writes a complete device and partition stanza list for the specified device to file.
−t [vpa]
Creates a listing of the current vtoc. The sub-parameters specify pieces to be printed:
| v | vtoc and related structures |
| p | partitions |
| a | alternate sectors |
−n Turns on a special mode for message compatibility with the installation. Other than the output format, no functionality is changed. This option is not recommended for normal use.
−O Forces the creation of an “old style” PDINFO. This is a debugging option only; its use can destroy the disk structure integrity.
The partitions file is composed of blank-line-separated stanzas. (Blank lines have only tabs and spaces between new-line characters.) Commentary consists of all text between a # and a new-line character. Stanzas begin with an identifier followed by a colon (:), and are followed by a comma-separated list of parameters. Each parameter has a keyword followed by an equal sign (=) followed by a value. The value can be a number, another stanza’s name, a double quoted string, or a parentheses-surrounded, comma-separated list of numbers or ranges of numbers, as appropriate for the keyword. Numbers may be written as decimal, octal, or hexadecimal constants in the form familiar to C programmers.
Device specification stanzas may contain the following parameters:
usedevice = name
Causes the named stanza’s parameters to be included in the device definition.
boot = string
Indicates that the string is the filename of a bootstrap program to install on the disk.
device = string
Gives the filename of the character special device for the disk.
heads = number
Specifies the number of tracks per cylinder on the device.
cyls = number
Is the number of cylinders on the disk.
sectors = number
Is the number of sectors per track.
bpsec = number
Is the number of bytes per sector.
physheads, physcyls, physsectors, physbpsec = number
Are the physical values associated with the disk, if they are different from those values used in normal operation. This situation occurs with disk controllers that support sector sparing and/or virtual geometries. These values are needed to properly format disks connected to such controllers.
dserial = string
Is an arbitrary string which is recorded in the volume label (Multibus systems only).
vtocsec = number
Gives the sector number to use for the VTOC. Note that for AT386 systems, this number must be 17.
altsec = number
Is the sector to use for the alternate block table.
badsec = number-list
Lists the known bad sectors. These are appended to any specified in the command line or found during surface analysis.
Partition stanzas may have the following parameters:
usepart = name
Refers to another partition stanza.
partition = number
Gives this partition’s entry number in the vtoc.
tag = tagname
A partition tag specifies the purpose of the partition. The tagnames are reserved words which are presently used for identification purposes only:
BACKUP means the entire disk.
ROOT is a root file system partition.
BOOT is a bootstrap partition.
SWAP is a partition that does not contain a file system.
USR is a partition that does contain a file system.
ALTSCTR is an alternate sector/track partition that contains four sections. It permits a variable number of replacement sectors with no inherent maximum.
1. The partition table section, located at the beginning of the first sector of the partition, contains information about the general layout of this partition.
2. The partition map section is a bitmap of all the sectors allocated in the alternate sector/track partition. It identifies sectors that are either good or bad/allocated.
3. The entry section contains a list of bad sector entries. Each entry includes the starting bad sector number, its count and the starting alternate sector number. Contiguous bad sectors that are added at the same time are grouped into one single entry as a cluster of bad sectors.
4. The reserved section is a pool of alternate sectors used for bad sector remap.
ALTS Contains alternate sectors to which the driver remaps bad sectors. Currently, a maximum of 253 alternate sectors are supported.
OTHER Is a partition that the UNIX System does not know how to handle, such as MS-DOS space.
perm = permname
Specifies a permission type for the partition. Permissions are not mutually exclusive:
RO indicates that the partition cannot be written upon. Normally, write access is granted (standard UNIX System file permissions notwithstanding).
NOMOUNT disallows the driver from mounting the file system that may be contained in the partition.
VALID indicates that the partition contains valid data. Any partition added with the −A flag will be marked VALID.
start = number
Is the starting sector number for the partition. Note that for AT386 systems, the root file system should start at the second track of the cylinder, which is the beginning of the active UNIX System fdisk partition. This allows space for the writing of the boot code.
size = number
Is the size, in sectors, of the partition.
When mkpart is run, it first attempts to read the volume label (for Multibus systems) or the fdisk table (for AT386 systems), the vtoc block, and the alternate sector table. If any of the structures is invalid or cannot be read, or if the −i flag is specified, the internal tables are initialized to default values for the device specified (taken from the device stanza in the partition file). If the −F flag is specified, the device is formatted. If either the −V or −v flag is specified, the appropriate surface analysis is performed.
After these steps, partitions are deleted or added as required. Next, any bad sectors specified in the partition file, found during surface analysis, or specified in the command line with −A flags are merged into the alternate sectors table. Note that an alternate partition must exist for any bad-sector marking to occur, as bad sectors are assigned good alternates at this point.
Finally, the boot program is written to track 0 of cylinder 0 (Multibus systems) or the cylinder where the active UNIX System fdisk partition starts (AT386 systems). If −b was not the only parameter specified, the updated VTOC is written, and and the disk driver is instructed to re-read the tables when the drive is opened the next time. Bad sectors that are found during the disk preparation procedure are stored in the alternate tables during the creation of the alternate sector/track partition. If bad sectors are added using the −A option during the course of normal system operation, the tables in the alternate sector/track partition are updated. In addition, the disk driver will be instructed to update its internal alternate sector/track tables. This allows grown defect sectors to be remapped right away without closing the drive or shutting down the system.
When only −t is specified, only a listing is created and no updating occurs.
FILES
/etc/partitions
/etc/boot
/dev/rdsk/*p0
BUGS
Currently, very little consistency checking is done. No checks are made to ensure that the fdisk partition table is consistent with the UNIX System partitions placed in the VTOC.
ADDED VALUE
This entry, supplied by INTERACTIVE Systems Corporation, contains enhancements to UNIX System V.
\*U — Version 1.0