\" ------------------------------------------------------------------ \" | Copyright Unpublished, MIPS Computer Systems, Inc. All Rights | \" | Reserved. This software contains proprietary and confidential | \" | information of MIPS and its suppliers. Use, disclosure or | \" | reproduction is prohibited without the prior express written | \" | consent of MIPS. | \" ------------------------------------------------------------------ \" %Q% %M% %I% .TH FORMAT 8spp .ds ]W MIPS Computer Systems .SH NAME format \- disk formatter .SH SYNOPSIS .nf .ft B /etc/format .ft R .SH DESCRIPTION .I Format is used to format disks prior to the constructing of file systems. In addition to the formatting operation, .I format records and maps bad sectors and constructs an initial volume header. Thus, .I format may be used to modify a disk partition table or examine the volume header information without actually formatting a disk. .I Format consists of the following phases: initialization, reading of media defects, formatting, scanning for bad sectors, mapping of bad sectors, and writing the bad sector list and volume header out to disk. Details on the contents of the disk volume header are contained in .I dvh(5pp). Throughout the phases of .I format, questions are asked which require a yes or no answer. .I Format interprets any character other than a 'y' to mean no. .PP .B "Phase 1 - Initialization." During the initialization phase of .I format, a valid volume header for the device is obtained, either from the device itself or by constructing one based on user input. .I Format initially asks the user for the full path to the /dev entry of the entire volume. Based on this information, .I format opens the device and gets the associated volume header information. Note that the .B first time a drive is formatted, the user will see error information each time an attempt is made to read the volume header information from the drive. Once the drive has gone through the format phase, no errors should occur when attempting to read the volume header information. If the acquired volume header is valid, .I format proceeds to read in the bad sector table from the drive. If this volume header is
.B not valid, .I format constructs a volume header in the following way. Built into .I format are a few tables which contain drive specific information for different types of drives. If the drive to be formatted is one for which an entry exists in .I format's tables, then the volume header is constructed based upon this information. Otherwise, .I format prompts the user for each piece of information. .PP After the drive specific parameters are known, .I format initializes the partition table. Eleven of the sixteen partitions are initialized. Eight of these partitions are reserved as Unix partitions, while the other three are marked as the volume directory partition, the track (or sector) forwarding partition, and the entire volume partition. The volume directory partition contains the bad sector table and the first level boot program. The track forwarding partition is used for mapping bad tracks, while the entire volume partition allows access to the entire disk. Each of the Unix partitions may be marked as either BSD or System V. The first Unix partition is used as the .I root and is approximately 16 Megabytes, the second is used as the .I swap and is approximately 48 Megabytes, the third includes all the Unix partitions, and the seventh is set to the size of all the Unix partitions minus the space reserved for the .I root and .I swap. .PP After .I format has obtained a valid volume header, the user has an opportunity to modify the drive specific parameters and the partition table information. If the drive specific parameters are to be modified, .I format informs the user of the current value and prompts for the new value. The user may enter a new value or type a carrage return which causes .I format to keep the current value. .I Format also prompts the user for some drive characteristics, which require a yes or no answer. .PP .I Format next allows the user to modify the partition table. A user may list the partition table, add an entry, delete an entry, initialize the partition table according to .I format's default partitioning scheme, replace a specific partition table entries information, and modify the following additional information.
The volume header contains a default boot file name, the partition entry number for the root partition, and the partition entry number for the swap partition. This additional information may be modified via .I format. .I Format requires a partition to be a multiple of cylinders, but does not perform any checking on partition overlap. .PP .B "Phase 2 - Reading Media Defects." After the volume header information is set, .I format asks the user whether the media defect information should be read from the drive. Most drives, when shipped from the manufacturer, contain the media defect information on the drive itself. The media defect information must be read by .I format before the drive is actually formatted, since the format operation overwrites the media defect information. If instructed to read the defects off the drive, .I format performs the read, prints each defect as it is encountered, and saves this information for later use. .PP .B "Phase 3 - Format." This phase involves actually formatting the drive. .I Format asks the user whether or not the drive is to be formatted, warning the user that this is a destructive operation. If .I format is informed that formatting is to happen, it then asks whether or not the entire drive should be formatted. .I Format allows a single partition to be formatted as well as the entire drive. The indication that .I format receives at this point, on which portion of the drive to operate on, is used in the scan phase and the mapping of bad sectors phase as well as the format phase. In other words, if .I format is to only format a single partition, then it will only scan that partition and it will only map bad sectors within that partition. After .I format has gathered this information, the specified portion of the drive is formatted. To indicate progress through the format phase, .I format prints a dot for each cylinder which has been formatted. .PP .B "Phase 4 - Scan." This phase of .I format involves scanning for bad sectors. If the user desires scanning to be done, .I format only scans the portion of the disk which was previously formatted. If none of the disk was formatted, then none will be scanned. Scanning consists of .I format writing a pattern to the disk and then verifying that this same information can be read without errors.
The number of passes which scan performs is dependent on what the user specifies. .I Format uses a three byte pattern which is rotated on each pass; thus, three passes would scan with each pattern variation. .I Format indicates any bad sectors encountered during the scan and saves this information for later use. To indicate progress through the scan phase, .I format prints a dot for each cylinder which has been scanned. .PP .B "Phase 4 - Manipulate Bad Sector List." After the scan phase is the bad sector list manipulation phase of .I format. This phase allows the user to add, delete, and list the bad sectors which .I format is currently aware of for this drive. To add a bad sector, .I format to choose a defect entry format, (either cylinder, bad sector, or cyclinder number) the track number, the byte position within the track, and the length in bits of the defect. This input is usually added based on the written media defect list received with the drive. These defect lists contain the above mentioned information in both hexidecimal and in decimal. The decimal representation, which is usually in parenthesis, should always be used .B without the leading zeros. When adding or deleting an entry, .I format verifies each piece of information against the drive's parameters. Invalid input causes .I format to complain and reject the information. .PP .B "Phase 5 - Map Bad Sectors." Any bad sectors which exist on the disk should be mapped out to avoid problems once software is installed. Prior to this phase, .I format has gathered the list of bad sectors through some combination of the following: reading the media defects off the drive, scanning for bad sectors, reading the bad sectors off the volume header partition, and gathering media defect information from the user. .I Format now uses this bad sector list and the capabilities of this device to map out these bad sectors. A sector may be mapped out by slipping a sector, forwarding a sector, or forwarding an entire track. The capabilities of this device are included as part of the the device specific parameters. Once again, .I format will only map bad sectors in that portion of the disk which was previously formatted. Thus, if none of the disk was formatted no bad sectors will be mapped. This phase concludes with an opportunity for the user to print
information on how each of the bad sectors was handled. .PP .B "Phase 6 - Write Bad Sector List and Volume Header." The final phase of .I format consists of allocating space in the volume header partition for the bad sector list, and writing the bad sector list and the volume header out to the device. The volume header is replicated in the first sector of each track of cylinder zero of the device. .SH EXAMPLE .PP An example format session is contained in the section describing standalone programs of the .I "System Administration Guide". .SH SEE ALSO dkip(7), .br dvh(4), .br dvhtool(8), .br format(8spp) in the .I MIPS System Programmer's Package Reference manual. .br MIPS Series M System Administration Guide, .br V/SMD 3200 Disk Controller User's Guide .SH DEFICIENCIES Currently .I format does not implement sector forwarding and assumes at most one slip sector per track.