Chapter 15 The format Utility
(Reference)
This chapter describes the format utility's menus
and commands.
This is a list of the reference information in this chapter.
For a overview of when to use the format utility,
see format Utility.
Recommendations and Requirements for Using
the format Utility
You must be superuser or have assumed an equivalent role to use the format utility. Otherwise, the following error message is displayed
when you try to use the format utility:
$ format
Searching for disks...done
No permission (or no disks found)!
|
Keep the following guidelines in mind when you use the format utility
and want to preserve the existing data:
-
Back up all files on the disk drive.
-
Save all your defect lists in files by using the format utility's dump command. The file name should include the drive type, model
number, and serial number.
-
Save the paper copies of the manufacturer's defect list that
was shipped with your drive.
format Menu and Command
Descriptions
The format main menu appears similar to the following:
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
fdisk - run the fdisk program (x86 only)
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format>
|
The following table
describes the main menu items for the format utility.
Table 15–1 The Main Menu Item Descriptions
for the
format Utility
|
Menu Item
|
Command or Menu?
|
Description
|
|
disk
|
Command
|
Lists all of the system's drives. Also lets you choose the disk you
want to use in subsequent operations. This disk is referred to as the current
disk.
|
|
type
|
Command
|
Identifies the manufacturer and model of the current disk. Also displays
a list of known drive types. Choose the Auto configure option
for all SCSI-2 disk drives.
|
|
partition
|
Menu
|
Creates and modifies slices. For more information, see partition Menu.
|
|
current
|
Command
|
Displays the following information about the current disk:
-
Device name and device type
-
Number of cylinders, alternate cylinders, heads and sectors
-
Physical device name
|
|
format
|
Command
|
Formats the current disk by using one of these sources of information
in this order:
-
Information that is found in the format.dat file
-
Information from the automatic configuration process
-
Information that you type at the prompt if no format.dat entry exists
This command does not apply to IDE disks. IDE disks are preformatted
by the manufacturer.
|
|
fdisk
|
Menu
|
x86 platform only: Runs the fdisk program to create
a Solaris fdisk partition.
The fdisk command cannot be used on disks with an
EFI label that are greater than 1 terabyte in size.
|
|
repair
|
Command
|
Repairs a specific block on the current disk.
|
|
label
|
Command
|
Writes a new label to the current disk.
|
|
analyze
|
Menu
|
Runs read, write, and compare tests. For more information, see analyze Menu.
|
|
defect
|
Menu
|
Retrieves and displays defect lists. For more information, see defect Menu. This feature does not apply
to IDE disks. IDE disks manage defects automatically.
|
|
backup
|
Command
|
VTOC – Searches for backup
labels.
EFI – Not supported.
|
|
verify
|
Command
|
Displays the following information about the current disk:
-
Device name and device type
-
Number of cylinders, alternate cylinders, heads and sectors
-
Partition table
|
|
save
|
Command
|
VTOC – Saves new disk and partition
information.
EFI – Not applicable.
|
|
inquiry
|
Command
|
SCSI disks only – Displays
the vendor, product name, and revision level of the current drive.
|
|
volname
|
Command
|
Labels the disk with a new eight-character volume name that you specify.
|
|
quit
|
Command
|
Exits the format menu.
|
partition Menu
The partition menu appears similar to the following:
format> partition
PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
quit
partition>
|
The following table describes the partition menu
items.
Table 15–2 Descriptions for
partition Menu Items
|
Subcommand
|
Description
|
|
change `n' partition
|
Enables you to specify the following information for the new partition:
-
Identification tag
-
Permission flags
-
Starting cylinder
-
Size
|
|
select
|
Enables you to choose a predefined partition table.
|
|
modify
|
Enables you to change all the slices in the partition table. This command
is preferred over the individual change `x' partition commands.
|
|
name
|
Enables you to specify a name for the current partition table.
|
|
print
|
Displays the current partition table.
|
|
label
|
Writes the partition map and the label to the current disk.
|
|
quit
|
Exits the partition menu.
|
x86: fdisk Menu
The fdisk menu appears on x86 based systems only
and appears similar to the following.
format> fdisk
Total disk size is 14169 cylinders
Cylinder size is 2510 (512 byte) blocks
Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active x86 Boot 1 9 9 0
2 Solaris2 10 14168 14159 100
SELECT ONE OF THE FOLLOWING:
1. Create a partition
2. Specify the active partition
3. Delete a partition
4. Change between Solaris and Solaris2 Partition IDs
5. Exit (update disk configuration and exit)
6. Cancel (exit without updating disk configuration)
Enter Selection:
|
The following table describes the fdisk menu items.
Table 15–3 x86: Descriptions
for
fdisk Menu Items
|
Menu Item
|
Description
|
|
Create a partition
|
Creates an fdisk partition. You must create a separate
partition for each OS such as Solaris or DOS. There is a maximum of four partitions
per disk. You are prompted for the size of the fdisk partition
as a percentage of the disk.
|
|
Specify the active partition
|
Enables you to specify the partition to be used for booting. This menu
item identifies where the first stage boot program looks for the second stage
boot program.
|
|
Delete a partition
|
Deletes a previously created partition. This command destroys all the
data in the partition.
|
|
Change between Solaris and Solaris2 Partition IDs
|
Changes partition IDs from 130 (0x82) to 191 (0xbf) and back again.
|
|
Exit (update disk configuration and exit)
|
Writes a new version of the partition table and exits the fdisk menu.
|
|
Cancel (exit without updating disk configuration)
|
Exits the fdisk menu without modifying the partition
table.
|
analyze Menu
The analyze menu appears similar to the following.
format> analyze
ANALYZE MENU:
read - read only test (doesn't harm SunOS)
refresh - read then write (doesn't harm data)
test - pattern testing (doesn't harm data)
write - write then read (corrupts data)
compare - write, read, compare (corrupts data)
purge - write, read, write (corrupts data)
verify - write entire disk, then verify (corrupts data)
print - display data buffer
setup - set analysis parameters
config - show analysis parameters
quit
analyze>
|
The following table describes the analyze menu items.
Table 15–4 Descriptions for
analyze Menu Items
|
Subcommand
|
Description
|
|
read
|
Reads each sector on the current disk. Repairs defective blocks as a
default.
|
|
refresh
|
Reads then writes data on the current disk without harming the data.
Repairs defective blocks as a default.
|
|
test
|
Writes a set of patterns to the disk without harming the data. Repairs
defective blocks as a default.
|
|
write
|
Writes a set of patterns to the disk then reads back the data on the
disk. Destroys existing data on the disk. Repairs defective blocks as a default.
|
|
compare
|
Writes a set of patterns to the disk, reads back the data, and then
compares it to the data in the write buffer. Destroys existing data on the
disk. Repairs defective blocks as a default.
|
|
purge
|
Removes all data from the disk so that the data cannot be retrieved
by any means. Data is removed by writing three distinct patterns over the
entire disk (or a section of the disk). If the verification passes, a hex-bit
pattern is written over the entire disk (or a section of the disk).
Repairs defective blocks as a default.
|
|
verify
|
In the first pass, writes unique data to each block on the entire disk.
In the next pass, reads and verifies the data. Destroys existing data on
the disk. Repairs defective blocks as a default.
|
|
print
|
Displays the data in the read/write buffer.
|
|
setup
|
Enables you to specify the following analysis parameters:
Analyze entire disk? yes
Starting block number: depends on drive
Ending block number: depends on drive
Loop continuously? no
Number of passes: 2
Repair defective blocks? yes
Stop after first error? no
Use random bit patterns? no
Number of blocks per transfer: 126 (0/n/nn)
Verify media after formatting? yes
Enable extended messages? no
Restore defect list? yes
Restore disk label? yes
|
|
config
|
Displays the current analysis parameters.
|
|
quit
|
Exits the analyze menu.
|
defect Menu
The defect menu appears similar to the following:
format> defect
DEFECT MENU:
primary - extract manufacturer's defect list
grown - extract manufacturer's and repaired defects lists
both - extract both primary and grown defects lists
print - display working list
dump - dump working list to file
quit
defect>
|
The following table describes the defect menu items.
Table 15–5 The
defect Menu
Item Descriptions
|
Subcommand
|
Description
|
|
primary
|
Reads the manufacturer's defect list from the disk drive and updates
the in-memory defect list.
|
|
grown
|
Reads the grown defect list and then updates the in-memory defect list.
Grown defects are defects that have been detected during analysis.
|
|
both
|
Reads both the manufacturer's defect list and the grown defect list.
Then, updates the in-memory defect list.
|
|
print
|
Displays the in-memory defect list.
|
|
dump
|
Saves the in-memory defect list to a file.
|
|
quit
|
Exits the defect menu.
|
format.dat File
The format.dat file that is shipped with the Solaris OS supports
many standard disks. If your disk drive is not listed in the format.dat file, you can do the following:
Adding an entry to the format.dat file can save
time if the disk drive will be used throughout your site. To use the format.dat file on other systems, copy the file to each system that will
use the specific disk drive that you added to the format.dat file.
You might need to modify the /etc/format.dat file
for your system if you have one of the following:
Note –
Do not alter default entries in the /etc/format.dat file.
If you want to alter the default entries, copy the entry, give the entry a
different name, and make the appropriate changes to avoid confusion.
The /etc/format.dat is not applicable for disks
with EFI labels.
Contents of the format.dat File
The format.dat contains disk drive information
that is used by the format utility. Three items are defined
in the format.dat file:
-
Search paths
-
Disk types
-
Slice tables
Syntax of the format.dat File
The following syntax
rules apply to the /etc/format.dat file:
-
The pound sign (#) is the comment character.
Any text on a line after a pound sign is not interpreted by the format utility.
-
Each definition in the format.dat file
appears on a single logical line. If the definition is longer than one line
long, all lines but the last line of the definition must end with a backslash
(\).
-
A definition consists of a series of assignments that have
an identifier on the left side and one or more values on the right side. The
assignment operator is the equal sign (=). The assignments
within a definition must be separated by a colon (:).
-
White space is ignored by the format utility.
If you want an assigned value to contain white space, enclose the entire value
in double quotation marks ("). This syntax causes the white
space within the quotes to be preserved as part of the assignment value.
-
Some assignments can have multiple values on the right side.
Separate values by a comma.
Keywords in the format.dat File
The format.dat file
contains disk definitions that are read by the format utility
when it is started. Each definition starts with one of the following keywords: disk_type or partition. These keywords are described
in the following table.
Table 15–6 Keyword Descriptions for
the
format.dat File
|
Keyword
|
Description
|
|
disk_type
|
Defines the controller and disk model. Each disk_type definition
contains information that concerns the physical geometry of the disk. The
default data file contains definitions for the controllers and disks that
the Solaris OS supports.
You need to add a new disk_type definition only if
you have an unsupported disk. You can add as many disk_type definitions
to the data file as you want.
|
|
partition
|
Defines a partition table for a specific disk type. The partition table
contains the partition information, plus a name that lets you refer to it
in the format utility. The default format.dat file
contains default partition definitions for several kinds of disk drives. Add
a partition definition if you recreated partitions on any of the disks on
your system. Add as many partition definitions to the data file as you need.
|
Disk Type (format.dat)
The disk_type keyword in the format.dat file
defines the controller and disk model. Each disk_type definition
contains information about the physical geometry of the disk. The default format.dat file contains definitions for the controllers and disks
that the Solaris OS supports. You need to add a new disk_type only
if you have an unsupported disk. You can add as many disk_type definitions
to the data file as you want.
The keyword itself is assigned the name of the disk type. This name
appears in the disk's label, and is used to identify the disk type whenever
the format utility is run. Enclose the name in double
quotation marks to preserve any white space in the name. The following table
describes the identifiers that must also be assigned values in all disk_type definitions.
Table 15–7 Required
disk_type Identifiers
(
format.dat)
|
Identifier
|
Description
|
|
ctlr
|
Identifies the controller type for the disk type. Currently, the supported
values are SCSI and ATA.
|
|
ncyl
|
Specifies the number of data cylinders in the disk type. This determines
how many logical disk cylinders the system will be allowed to access.
|
|
acyl
|
Specifies the number of alternate cylinders in the disk type. These
cylinders are used by the format utility to store information
such as the defect list for the drive. You should always reserve at least
two cylinders for alternates.
|
|
pcyl
|
Specifies the number of physical cylinders in the disk type. This number
is used to calculate the boundaries of the disk media. This number is usually
equal to ncyl plus acyl.
|
|
nhead
|
Specifies the number of heads in the disk type. This number is used
to calculate the boundaries of the disk media.
|
|
nsect
|
Specifies the number of data sectors per track in the disk type. This
number is used to calculate the boundaries of the disk media. Note that this
number includes only the data sectors. Any spares are not reflected in the
number of data sections per track.
|
|
rpm
|
Specifies the rotations per minute of the disk type. This information
is put in the label and later used by the file system to calculate the optimal
placement of file data.
|
Other identifiers might be necessary, depending on the controller. The
following table describes the identifiers that are required for SCSI controllers.
Table 15–8 Required
disk_type Identifiers
for SCSI Controllers
format.dat
|
Identifier
|
Description
|
|
fmt_time
|
Specifies a number that indicates how long it takes to format a given
drive. See the controller manual for more information.
|
|
cache
|
Specifies a number that controls the operation of the on-board cache
while the format utility is operating. See the controller
manual for more information.
|
|
trks_zone
|
Specifies a number that identifies how many tracks that exist per defect
zone, to be used in alternate sector mapping. See the controller manual for
more information.
|
|
asect
|
Specifies a number that identifies how many sectors are available for
alternate mapping within a given defect zone. See the controller manual for
more information.
|
Example 15–1 Required disk_type Identifiers
for SCSI Controllers (format.dat)
The following are examples of disk_type definitions:
disk_type = "SUN1.3G" \
: ctlr = SCSI : fmt_time = 4 \
: trks_zone = 17 : asect = 6 : atrks = 17 \
: ncyl = 1965 : acyl = 2 : pcyl = 3500 : nhead = 17 : nsect = 80 \
: rpm = 5400 : bpt = 44823
disk_type = "SUN2.1G" \
: ctlr = SCSI : fmt_time = 4 \
: ncyl = 2733 : acyl = 2 : pcyl = 3500 : nhead = 19 : nsect = 80 \
: rpm = 5400 : bpt = 44823
disk_type = "SUN2.9G" \
: ctlr = SCSI : fmt_time = 4 \
: ncyl = 2734 : acyl = 2 : pcyl = 3500 : nhead = 21 : nsect = 99 \
: rpm = 5400
|
Partition Tables (format.dat)
A partition table in the format.dat file defines
a slice table for a specific disk type.
The partition keyword in the format.dat file
is assigned the name of the partition table. Enclose the name in double quotation
marks to preserve any white space in the name. The following table describes
the identifiers that must be assigned values in all partition tables.
Table 15–9 Required Identifiers for
Partition Tables (
format.dat)
|
Identifier
|
Description
|
|
disk
|
The name of the disk_type that this partition table
is defined for. This name must appear exactly as it does in the disk_type definition.
|
|
ctlr
|
The disk controller type that this partition table can be attached to.
Currently, the supported values are ATA for ATA controllers and SCSI for SCSI
controllers. The controller type that is specified here must also be defined
for the disk_type that you specified in the disk_type definition.
|
The other identifiers
in a slice definition describe the actual partition information. The identifiers
are the numbers 0 through 7. These identifiers are optional. Any partition
that is not explicitly assigned is set to 0 length. The value of each of these
identifiers is a pair of numbers separated by a comma. The first number is
the starting cylinder for the partition. The second is the number of sectors
in the slice.
Example 15–2 Required Identifiers for Partition Tables (format.dat)
The following are some examples of slice definitions:
partition = "SUN1.3G" \
: disk = "SUN1.3G" : ctlr = SCSI \
: 0 = 0, 34000 : 1 = 25, 133280 : 2 = 0, 2672400 : 6 = 123, 2505120
partition = "SUN2.1G" \
: disk = "SUN2.1G" : ctlr = SCSI \
: 0 = 0, 62320 : 1 = 41, 197600 : 2 = 0, 4154160 : 6 = 171, 3894240
partition = "SUN2.9G" \
: disk = "SUN2.9G" : ctlr = SCSI \
: 0 = 0, 195426 : 1 = 94, 390852 : 2 = 0, 5683986 : 6 = 282, 5097708
|
Specifying an Alternate Data File for the format Utility
The format utility determines the location of an
alternate file by the following methods in this order:
-
If a file name is given with the format -x option, that file is always used as the data file.
-
If the -x option is not specified, then the format utility searches the current directory for a file named format.dat. If the file exists, it is used as the data file.
-
If neither of these methods yields a data file, the format utility uses the /etc/format.dat file as the
data file. This file is shipped with the Solaris OS and should always be
present.
Rules for Input to format Commands
When you use the format utility, you need to provide various kinds of information. This
section describes the rules for this information. For information on using format's help facility when you specify data, see Getting Help on the format Utility.
Specifying Numbers to format Commands
Several places in the format utility require number
as input. You must either specify the appropriate data or select a number
from a list of choices. In either case, the help facility causes format to
display the upper and lower limits of the number expected. Simply enter the
appropriate number. The number is assumed to be in decimal format unless a
base is explicitly specified as part of the number (for example, 0x for hexadecimal).
The following are examples of integer input:
Enter number of passes [2]: 34
Enter number of passes [34] Oxf
|
Specifying Block Numbers to format Commands
Whenever
you are required to specify a disk block number, there are two ways to do
so:
You can specify the information as an integer that represents the logical
block number. You can specify the number in any base, but the default is decimal.
The maximum operator (a dollar sign, $) can also be used
here so that format utility can select the appropriate
value. Logical block format is used by the SunOS disk drivers in error messages.
The other way to specify a block number is by using cylinder/head/sector
format. In this method, you must specify explicitly the three logical components
of the block number: the cylinder, head, and sector values. These values are
still logical. However, they allow you to define regions of the disk that
are related to the layout of the media.
If any of the cylinder/head/sector numbers are not specified, the value
is assumed to be zero. You can also use the maximum operator in place of any
of the numbers. Then, the format utility will select the
appropriate value. The following are some examples of cylinder, head, and
sector values:
Enter defective block number: 34/2/3
Enter defective block number: 23/1/
Enter defective block number: 457//
Enter defective block number: 12345
Enter defective block number: Oxabcd
Enter defective block number: 334/$/2
Enter defective block number: 892//$
|
The format utility always displays block numbers
in both formats. Also, the help facility shows you the upper and lower limits
of the block number expected, in both formats.
Specifying format Command
Names
Command
names are needed as input whenever the format utility displays
a menu prompt. You can abbreviate the command names, as long as what you type
is sufficient to uniquely identify the command desired.
For example, use p to access the partition menu
from the format menu. Then, type p to
display the current slice table.
format> p
PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
quit
partition> p
|
Specifying Disk Names to format Commands
At certain points in
the format utility, you must name something. In these cases,
you are free to specify any string you want for the name. If the name has
white space in it, the entire name must be enclosed in double quotation marks
("). Otherwise, only the first word of the name is used.
For example, if you want to identify a specific partition table for
a disk, you can use the name subcommand that is available
from the partition menu:
partition> name
Enter table name (remember quotes): "new disk3"
|
Getting Help on the format Utility
The format utility provides a help facility that you can use whenever the format utility is expecting input. You can request help about what
input is expected by typing a question mark (?). The format utility displays a brief description of what type of input
is needed.
If you type a ? at a menu prompt, a list of available
commands is displayed.
The man pages associated with the format utility
include the following:
-
format(1M) –
Describes the basic format utility capabilities and provides
descriptions of all command-line variables.
-
format.dat(4) –
Describes disk drive configuration information for the format utility.