FORMAT(1M-SysV) RISC/os Reference Manual FORMAT(1M-SysV)
NAME
format - program to format hard disks (On-line and stan-
dalone versions)
SYNOPSIS
/etc/format for the on-line program.
The standalone version can be booted when the system is at
the monitor prompt.
DESCRIPTION
format is used for formatting hard disks prior to construct-
ing file systems. Additionally, format records the bad sec-
tors and constructs an initial volume header. Although for-
mat can also be used to modify disk information, other util-
ities such as dvhtool(1M) and badspots(1M) are better
suited.
CAUTION: SCSI disks are formatted by the manufacturer and do
not need to be reformatted. In addition, although indivi-
dual partitions can be formatted with SMD disks, the SCSI
format command can only format the entire disk. To map out
bad spots that may eventually occur, use badspots(1M).
format consists of the following phases:
Selecting the drive
Initializing the drive
Reading the manufacturer's defect list (SMD only)
Reading defects stored in a file (SMD, On-line version only)
Formatting the drive
Scanning the drive for defects
Manipulating the bad sector list
Mapping the bad sectors
Writing the defects to a file (SMD, On-line version only)
Writing the volume header partition
If a SIGENT is encountered at any time, before exiting the
on-line version, format will prompt as to whether or not the
volume header partition should be written out before exit-
ing. Since the defect list for SMD drives is contained
within the volume header, it is important that it be written
out once new defects have been entered, or if that portion
of the disk has been reformatted. For the standalone ver-
sion, the program will just exit, and the defect list could
be lost.
Phase 1 - Selecting the drive
After printing out a warning message about the possibility
of data loss occurring as a result of running this program a
prompt is displayed to request which drive will be format-
ted.
Printed 1/15/91 Page 1
FORMAT(1M-SysV) RISC/os Reference Manual FORMAT(1M-SysV)
For the on-line version, the following prompt is displayed.
Enter full path to /dev entry for entire volume?
The full path name of the character device for the partition
that contains the entire volume should be entered. This is
usually partition 10.
For the standalone version, the name of the device is first
requested.
name of device?
Determining the specific unit is dependant upon the type of
device. The standalone version automatically opens the
entire volume partition. If dkip (Interphase SMD disk con-
troller) or dkij (Interphase Jaguar SCSI controller) is
entered, the following prompts are displayed.
controller number?
unit number?
If dkis or dksd, indicating an integrated SCSI disk, is
entered, the following prompts are displayed instead.
LUN number?
target id?
Phase 2 - Initializing the drive
During initialization, a valid volume header for the device
is obtained, either from the device itself or by construct-
ing one based on user input.
For SCSI drives, if no volume header is found, the informa-
tion is constructed by reading the geometry information from
the disk itself. For SMD drives, if no volume header is
found, the program displays a menu of known, supported dev-
ices. By selecting one of these devices from the displayed
list, the program automatically creates a volume header. If
the drive type of the particular device to be formatted is
not on the list, select "other". A prompt will then be
displayed for each of the device parameters. Contact MIPS
customer support before formatting an unsupported drive. If
a valid SMD volume header was found, it will read the bad
sector table stored in the volume directory partition.
After the drive specific parameters are known, format ini-
tializes the partition table. The partition entries are
initialized as follows. Partition 8 is the volume header
partition. Partition 9 is the track replacement partition
used for track forwarding on SMD drives. (It is initialized
to zero for SCSI drives). Partition 10 contains the entire
Page 2 Printed 1/15/91
FORMAT(1M-SysV) RISC/os Reference Manual FORMAT(1M-SysV)
volume. None of these three partitions can be used to
create filesystems. The rest of the partition can be used in
various combinations to create filesystems and swap parti-
tions. Selecting the correct combination is important,
since in this scheme, some of the partitions overlap. Each
partition can be marked as either BSD or System V. Generally
all partitions should be marked as BSD.
After format has obtained a valid volume header, a prompt is
displayed that asks to modify the device parameters and the
partition table information. It is recommended that the
device parameters should never be modified. Contact MIPS
customer support before changing the device parameters.
The program then allows modification of the partition table.
The partition table can be listed and then entries can be
added or deleted. The partition table can be initialized
according to format's default partitioning scheme, a
specific partition table entry information can be modified,
and the default bootfile name and partition entry number for
the bootfile that are contained in the volume header can
also be modified. format requires a partition to be an
exact multiple of cylinders, but does not perform any check-
ing on partition overlap. Once a valid volume header has
been written to the disk, this phase should be done by run-
ning dvhtool(1M).
Phase 3 - Reading the manufacturer's defect list (SMD only)
After the volume header information is set, format asks
whether the media defect information should be read from the
drive. Most SMD drives, when shipped directly from the
manufacturer and not from MIPS, contain the media defect
information on the drive itself. Since formatting the drive
overwrites the media defect information, this can only be
done before it is formatted for the first time, and then the
volume header should be saved. If instructed to read the
defects off the drive, format performs the read, and prints
each defect as it is encountered. The information is saved
in an internal table, and can and should be written to the
volume header partition, since the data will be lost if it
isn't written to the disk. When using the on-line version
of format the defects can also be saved away to a file.
SCSI drives contain a primary defect list that is accessi-
ble, but cannot be overwritten. Any new defects are placed
in a secondary defect list. The SCSI protocol accumula-
tively keeps track of all defects itself, so it is not
necessary to save away this list, in the volume header par-
tition, as it is for SMD drives. These defects can be
listed by running dvhtool(1m).
Printed 1/15/91 Page 3
FORMAT(1M-SysV) RISC/os Reference Manual FORMAT(1M-SysV)
Phase 4 - Reading defects from a file (SMD, On-line version
only)
Since SMD drives must keep track of the defects, RISC/os
does this by writing the defect list to the volume header
partition. Since the possibility exists that the informa-
tion can be corrupted, this list could be lost, and the data
would then need to be painstakingly re-entered by hand. The
option exists to write this list to a file, so that the list
can be saved. format will prompt for the name of the file
in which the list is contained. It will also prompt for
whether this list should be added to any defects already
contained in the bad sector table, or whether the on-disk
list should be purged, and just the defects in this list be
added.
Phase 5 - Formatting the drive
format then asks whether to format the drive or not, warning
that this is a destructive operation. With a 'yes'
response, there will be a prompts asking if the entire drive
should be formatted. format can format a single partition
of an SMD disk as well as the entire drive. However, the
format command on a SCSI drive can only format the entire
drive. If the entire drive is to be formatted, then none of
the partitions on that drive can be mounted, and the swap
partition cannot be on this drive. If only one partition is
to be formatted, then that partition can't be mounted. The
response to the screen prompt determines what portion of the
drive will be formatted, scanned, and mapped. If only a
single partition is formatted, then format scans only that
partition and maps only the bad sectors within that parti-
tion. The program prints a dot on the screen for each
cylinder that is formatted to indicate the progress of the
formatting phase. During the format operation, format can-
not be aborted. Since one SCSI command formats the entire
drive, this can take quite some time (up to 45 minutes).
The standalone version does allow the program to abort, but
the format could still be taking place.
Phase 6 - Scanning the drive for defects
The program scans only that portion of the disk that was
formatted in the previous phase, unless otherwise specified.
The scan is done by writing a pattern to the disk and then
verifying that this same information can be read without
errors. A three-byte pattern is used that rotates on each
pass. Performing three passes provides every possible com-
bination for the three-byte pattern, although the number of
passes can be modified when prompted. To indicate the pro-
gress of the scanning phase, format prints a dot on the
screen for each cylinder that is scanned. As defects are
encountered, error messages are displayed, along with
whether the sector(s) will be added to the bad sector list
or are already contained in the list. This phase can be
Page 4 Printed 1/15/91
FORMAT(1M-SysV) RISC/os Reference Manual FORMAT(1M-SysV)
aborted at any time by pressing the <ESCAPE> key.
Phase 7 - Manipulating the bad sector list
The bad sector list manipulation phase is used to add,
delete, initialize, and list the bad sectors that format is
aware of for this drive.
For SMD, the defects must be entered in the format of either
`cylinder, head, sector' or `cylinder, head, position,
length'. Although the manufacturer lists the defects in
both hexidecimal and decimal format, the defects must be
entered in decimal format.
On SMD drives, the entire defect mapping is done by
software, so any defect can be added or deleted. However,
with SCSI drives, the drive itself keeps track of this info,
and only selected operations can be done to this list,
namely adding to it via the Reassign Blocks command.
Because of this, the only defects that can be manipulated
are those in this current session. To list out the defects
list on the drive itself, use the badspots(1M) command. SCSI
defects are entered as physical block numbers.
When adding or deleting an entry, format verifies each piece
of information against the drive's parameters. For invalid
input, format prints an error message to the screen and
rejects the information.
Phase 8 - Mapping the bad sectors
Any bad sectors that exist on the disk should be mapped out
to avoid problems once the software is installed. Prior to
this phase, format has gathered the list of bad sectors
through some combination of the following: reading the media
defects off the drive, reading the defects from a file,
scanning for bad sectors, reading the bad sectors off the
volume header partition, and gathering media defect informa-
tion from the user. format now uses this bad sector list and
maps out these bad sectors. A sector can be mapped out by
slipping a sector, forwarding an entire track for SMD, or by
using the Reassign Blocks command for the SCSI drive. The
capabilities of this device are included as part of the dev-
ice specific parameters. Once again, format maps only bad
sectors in that portion of the disk that was previously for-
matted, unless otherwise specified. If none of the disk was
formatted, then no bad sectors are mapped. This phase is
concluded with an opportunity to print the bad sector table
on the screen.
Phase 9 - Writing the defects to a file (SMD, On-line version
only)
If the specified file can be created, the bad sector table
is dumped to that file. Each defect in the list is of the
Printed 1/15/91 Page 5
FORMAT(1M-SysV) RISC/os Reference Manual FORMAT(1M-SysV)
form `cylinder, head, sector'.
Phase 10 - Writing the volume header partition
Once all of the device specific information and defect map-
ping have been initialized through format, it must be stored
to the disk for future reference. If the information is not
written out to the disk after the volume header partition is
formatted, format must be run again, and all of the data
must be reentered.
The volume header, which includes the device paramaters and
partition table, is written out to the first sector of each
track of cylinder zero.
Additionally, when mapping tracks on SMD disks, format must
indicate that the track is bad, and which track it is being
mapped to. Once this has been done, the fact that it must
go to a different track is transparent to the operating sys-
tem. However, format must save this information so that it
can be recreated, and so that it can keep track of which
replacement tracks are unused for future mapping. This list
is written out to the volume header partition.
SEE ALSO
badspots(1M), dvhtool(1M), prtvtoc(1M).
The `Standalone Program' chapter of the Technical Reference
Manual that was shipped with your system will give a more
detailed discussion on how to format the disk for your par-
ticular machine.
Page 6 Printed 1/15/91