format(1M)
NAME
format − format program for gd disks
SYNOPSIS
/sbin/format diskunit
DESCRIPTION
format is a program which is used to format, verify, manage flawmaps, or define partition sizes for disk drives on an HDC, HSA, or other HVME disk controller that employs the Generic Disk driver (gd).
Geometry Blocks
format maintains (in memory) two copies of the disk’s geometry block. The "disk geometry block" is an exact copy of the geometry block as it exists on the disk. The "current geometry block" is a copy of the geometry block which may be modified with the "partition" command and then written to disk. Whenever the "disk geometry block" is read from the disk, the "current geometry block" is initialized to be the same as the "disk geometry block"; if there is no geometry block on the disk, the "current geometry block" partitions are initialized to default values. format has several commands which manipulate the "disk geometry block" and/or the "current geometry block". For example, the "status" command displays the partition sizes of the "disk geometry block"; the "partition" command displays the partition sizes of the "current geometry block".
Flawmap
Each disk has an associated flawmap. A flawmap consists of a series of ascii records which define the location of flaws on the disk. The format command uses a disk’s flawmap to relocate bad sectors and tracks on the disk. HSA disks also support relocation of bad sectors without requiring a reformat. A flawmap resides on the drive description tracks of each gd disk. Also, a copy of the flawmap normally exists in a backup file on any other disk. A sample flawmap is:
Serial Number 123456789
cyl 6 head 7 offset 10770 length 2
cyl 10 head 12 offset 13058 length 3 11-7-86
cyl 10 head 17 offset 5371 length 2
cyl 13 head 0 offset 2584 length 5
Each record in the flawmap has the form "cyl xxx head xxx offset xxx length xxx [optional comment]", defining the physical disk address of one disk flaw. Flaw records must be in ascending order. The first record of the flawmap may optionally be a comment. This optional first record is normally used to indicate the serial number of the disk.
The backup flawmap file may be edited with an editing program to add/remove flaws. For HDC disks, the disk’s initial flawmap is produced from vendor flaw information. Additional flawmap records are edited into the flawmap as new flaws develop on the disk. HSA disks have vendor flaw information encoded on their media, and their embedded SCSI controllers manage these flaws without software interaction. This means that HSA disks will have no initial flawmap. However, as flaws develop over the life of the disk drive, they may be added to the flawmap using the relocate subcommand, or by supplying a flawmap file when formatting the HSA drive. The flawmap record format for HSA disks is somewhat different from that of HDC disks. Records simply contain 4 numbers representing the start cylinder, start head, start sector, and sector count of each flaw, in no particular order. When a disk flaw is detected, CX/UX records it in the error log. errpt(1M) may be used to peruse this error log. For each flaw, errpt(1M) lists the actual ascii flaw record which must be added to flawmap or relocated to correct the flaw. For HDC disks, new flaw records do not take affect until the disk is formatted with the new flawmap. New flaws on HSA disks can be relocated at any time and a reformat operation is not required (See relocate subcommand below).
RUNNING FORMAT
format may be run either interactively (if no option is specified) or non-interactively (if an option is specified). Only a single disk unit may be specified for each invocation of the format program. Multiple disks may be formatted simultaneously by running multiple copies of format.
"format <disk unit>" starts the format program in an interactive mode. When format starts, it opens partition 7 of the raw device of the specified disk unit. "format 5", for example, refers to /dev/rdsk/5s7. The format program must have read/write access to the raw device. In interactive mode, format accepts and executes commands until the program is terminated. A list of commands may be obtained by typing "?". Different commands are available for different controller types; for example, certain commands available for HDC disks are not available on HSA or ISE disks. Commands may be abbreviated; only enough characters are required to uniquely identify the command.
"format <option> [flawmap] <disk unit>" starts the format program in a non-interactive mode. format executes the single command which is specified by the option. [flawmap] is specified if the command requires it. format options are:
-c certify the disk (the "certify" command)
-d read vendor data from the disk (the "data" command)
-f format the disk (the "format" command)
-l list disk flaws (the "list" command)
-v verify the disk (the "verify" command)
After running format, if the disk was formatted or if the partition sizes were modified, then it is necessary to re-build the file systems on the disk.
COMMANDS
"certify [flawmap]"
This command certifies the disk to produce a flawmap. To locate flaws, "certify" writes and reads data patterns to and from each track of the disk. A "." is printed as each cylinder is completed. The produced flawmap is written to the filepath specified by the [flawmap] parameter. If [flawmap] is not specified, the disk is formatted with the produced flawmap, then the flawmap is written to the drive description tracks (this flawmap may then be accessed with the "read" or "list" commands). "certify" determines which physical sectors of a disk are flawed; it cannot determine which specific bits of these sectors are flawed. Thus, it produces flaw records which may appear different from the equivalent vendor flaw records, yet will still mark down the same physical sectors. The "list" command may be used to determine which physical sectors will be marked down. This command supported only on HDC disks.
"data <flawmap>"
This command reads vendor flaw data from the disk to produce a flawmap. Vendor data is located on the first sector of each track. Every disk revolution, "data" reads the vendor data from a single track. A "." is printed as each cylinder is completed. The produced flawmap is written to the filepath specified by the <flawmap> parameter. This command is supported only on HDC disks.
"format [flawmap]"
This command formats the disk using one of: 1) the flawmap on the drive description tracks of the disk, if no flawmap filepath is specified; 2) a flawmap in a backup file on any other disk or tape, if a flawmap filepath is specified; 3) no flawmap (a flaw-free disk), if the flawmap filepath is /dev/null. For HSA disks, this is a single atomic operation, which may take 10 minutes or more on large disks. For HDC disks, one track is formatted f or every two disk revolutions. A "." is printed as each cylinder is completed. When formatting has successfully completed, the "current geometry block" and the flawmap are written to the drive description tracks.
"? [commandname]"
If the optional parameter is not specified, this command prints a summary of all the commands. If the optional [commandname] parameter is specified, this command prints information about that specific command - command syntax, what the command does, and warnings associated with the command.
"list [flawmap]"
This command lists the flawed sectors on the disk using one of: 1) the flawmap on the drive description tracks of the disk, if no flawmap filepath is specified; 2) a flawmap in a backup file on any disk or tape, if the filepath is specified. Flaws are displayed as the physical cylinder, head, sector addresses which will be relocated when the disk is formatted. "list" first removes comments, validates each flaw, converts each offset/length to a physical sector(s), and then prints the flaws.
"partition [partition#] [size]"
If no parameters are specified, this command prints the partition sizes and partition starting locations of the "current geometry block". If the optional parameters are present, this command sets the size of [partition#] to be [size] units. Typing "partition default" is a special form of the command, which sets all partitions sizes to default values. The partition start and size are modified only in the "current geometry block"; the "disk geometry block" is not changed. Partition sizes are always given in the current unit. The current unit may be modified with the "unit" command. The size actually reserved for a partition is always rounded up to a cylinder boundary. Each time the size of a partition changes, the starting locations of all subsequent partitions (with larger partition numbers) is also changed. This is because partition 1 always follows partition 0, etc.
"quit"
This command terminates the program. If the "current geometry block" differs from the "disk geometry block", format will not terminate. This means that the "partition" command was used to modify the geometry block, but the "current geometry block" was never written to disk. At this point it is necessary to use either the "format" or "write" command to update the geometry block on the disk, or to force a program exit by typing "q!".
"read [flawmap]"
This command reads the geometry block from the disk. The "disk geometry block" and "current geometry block" are initialized. If there is no geometry block on the disk, the "current geometry block" is initialized with default partition sizes. Also, if the optional [flawmap] filepath is specified, then the flawmap is read from the drive description tracks and is written to the specified flawmap backup file.
"relocate <start-cyl> <start-head> <start-sector> <sector-count>"
This command adds the specified flaw to the flawmap on the disk definition tracks and also relocates the sector so that future requests to this sector are directed to a non-flawed portion of the disk. This command is unsupported on HDC disks.
"sectorsize [size]"
This command is used to specify an alternate physical sector size to be used when formatting the disk. The size specified is in bytes. The physical sector size on the disk is not changed until the ’format’ command is issued. Until reformatted, partition sizes are meaningless as the different physical sector size will change partition layouts. The default sector size is 512 bytes, unless the disk has already been formatted to a different value. This command is unsupported on HDC disks.
"status"
This command prints detailed information about the disk, including the partition sizes and a description of how the disk is organized. Partition sizes are always given in the current unit. The current unit may be modified with the "unit" command.
"unit [unit]"
This command prints/selects the unit for partition sizes. If no parameters are present, then the current unit is printed. If the optional [unit] parameter is present, then the current unit becomes [unit]. [unit] may be any of: "sectors", "cylinders", "kbytes", "megabytes", or "percent" (percent of disk). Only the first letter of [unit] is required.
"verify"
This command verifies the disk by reading every sector. A "." is printed as each cylinder is completed.
"write [flawmap]"
This command writes the "current geometry block" to the disk. The "disk geometry block" is set equal to the "current geometry block". Also, if the optional [flawmap] filepath is present, then the flawmap is read from the specified flawmap backup file and is written to the drive description tracks.
SEE ALSO
gd(7), hdc(7), vdformat(8), format(8), errpt(1M)
CX/UX Administrator’s Reference