System Administration Guide, Volume I
この本のみを検索
PDF 文書ファイルをダウンロードする

The format Utility

31

This chapter describes the format utility's menu and commands.
This is a list of the overview information in this chapter.
Requirements or Restrictions for Using the format Utilitypage 494
Format Menu and Command Descriptionspage 494
Files Used by format--format.datpage 502
Associated Man Pagespage 512
Rules for Input to format Commandspage 509
See Chapter 27, "Overview of Disk Management," for a conceptual overview of when to use the format utility.

Requirements or Restrictions for Using the format Utility

You must be root to use the format utility. If you are not root, you will see the following error message when you try to use format.

  % format  
       Searching for disk...done  
       No permission (or no disk found)!  

Recommendations for Preserving Information When Using format

  • Back up all files on the disk drive before doing anything else.
  • Save all your defect lists in files by using the format 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 shipped with your drive.

Format Menu and Command Descriptions

The format main menu looks like 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 systems 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  
              quit  

Table 31-1 describes the format main menu items.
Table 31-1 format
ItemCommand or Menu?Allows You To ...
diskcommandChoose the disk that will be used in subsequent operations (known as the current disk). All of the system's drives are listed.
typecommandIdentify the manufacturer and model of the current disk. A list of known drive types is displayed. Choose the Auto configure option for all SCSI-2 disk drives.
partitionmenuCreate and modify slices. See "The partition Menu" on page 497 for more
information.
currentcommandDisplay the following information about the current disk: · Device name and type

· Number of cylinders, alternate cylinders, heads and sectors · Physical device name

formatcommandFormat the current disk, using one of these sources of information in this order:

· Information found in the format.dat file · Information from the automatic configuration process · Information prompted for if there is no format.dat entry

fdiskmenuRun the fdisk program to create a Solaris fdisk partition.
repaircommandRepair a specific block on the disk.
labelcommandWrite a new label to the current disk
analyzemenuRun read, write, compare tests. See "The analyze Menu" on page 500 for
more information.
defectmenuRetrieve and print defect lists. See "The defect Menu" on page 502 for more
information.
backupcommandSearch for backup labels.
verifycommandPrint the following information about the disk: · Device name and type

· Number of cylinders, alternate cylinders, heads and sectors · Partition table

savecommandSave new disk and partition information.
Table 31-1 format(Continued)
ItemCommand or Menu?Allows You To ...
inquirycommandPrint the vendor, product name, and revision level of the current drive (SCSI disks only).
volnamecommandLabel the disk with a new eight-character volume name.
quitcommandExit the format menu.

The partition Menu

The partition menu looks like this.

  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>  

Table 31-2 describes the partition menu items.
Table 31-2 partition
The Command ...Allows You To ...
change 'x'
partition
Specify new slice:
· Identification tag
· Permission flags
· Starting cylinder
· Size
selectChoose a predefined slice table.
modifyChange all the slices in the slice table. This command is preferred over the individual change 'x' partition commands.
nameSpecify a name for the current slice table.
Table 31-2 partition(Continued)
The Command ...Allows You To ...
printView the current slice table.
labelWrite the slice map and label to the current disk.
quitExit the partition menu.

x86: The fdisk Menu

The fdisk menu appears on x86 systems only and looks like this.

  format> fdisk  
               Total disk size is 1855 cylinders  
               Cylinder size is 553 (512 byte) blocks  
                                             Cylinders  
        Partition   Status    Type      Start   End   Length    %  
        =========   ======    ========  =====   ===   ======   ===  
            1                 DOS-BIG       0   370     371     20  
            2       Active    SOLARIS     370  1851    1482     80  
  
  SELECT ONE OF THE FOLLOWING:  
  
       1.   Create a partition  
       2.   Change Active (Boot from) partition  
       3.   Delete a partition  
       4.   Exit (Update disk configuration and exit)  
       5.   Cancel (Exit without updating disk configuration)  
  Enter Selection:  

Table 31-3 describes the fdisk menu items.
Table 31-3 fdisk
The Command ...Allows You To ...
Create a partitionCreate an fdisk partition. You must create a separate partition for each operating system such as Solaris or DOS. There is a maximum of 4 partitions per disk. You will be prompted for the size of the fdisk partition as a percentage of the disk.
Change Active
partition
Specify which partition will be used for booting. This
identifies where the first stage boot program will look
for the second state boot program.
Delete a partitionDelete a previously created partition. This command will destroy all the data in the partition.
ExitWrite a new version of the partition table and exit the fdisk menu.
CancelExit the fdisk menu without modifying the partition table.

The analyze Menu

The analyze menu looks like this.

  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>  

Table 31-4 describes the analyze menu items.
Table 31-4 analyze
The Command ...Allows You To ...
readRead each sector on this disk. Repairs defective blocks as a default.
refreshRead then write data on the disk without harming the data. Repairs defective blocks as a default.
testWrite a set of patterns to the disk without harming the data. Repairs defective blocks as a default.
writeWrite a set of patterns to the disk then read the data on the disk back. Destroys existing data on the disk. Repairs defective blocks as a default.
compareWrite a set of patterns to the disk, read the data back, and compare it to the data in the write buffer. Destroys existing data on the disk. Repairs defective blocks as a default.
Table 31-4 analyze(Continued)
The Command ...Allows You To ...
purgeRemove all data from the disk so that the data can't be retrieved by any means. Data is removed by writing three distinct patterns over the entire disk (or section of the disk), then writing an hex-bit pattern if the verification passes. Repairs defective blocks as a default.
verifyWrite unique data to each block on the entire disk in the first pass. Read and verify the data in the next pass. Destroys existing data on the disk. Repairs defective blocks as a default.
printView the data in the read/write buffer.
setupSpecify 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 Defaults are shown in bold.

configView the current analysis parameters.
quitExit the analyze menu.

The defect Menu

The defect menu looks like this.

  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>  

Table 31-5 describes the defect menu items.
Table 31-5 defect
The Command ...Allows You To ...
primaryRead the manufacturer's defect list from the disk drive and update the in-memory defect list.
grownRead the grown defect list (defects that have been detected during analysis) and update the in-memory defect list.
bothRead both the manufacturer's and grown defect list and update the in-memory defect list.
printView the in-memory defect list.
dumpSave the in-memory defect list to a file.
quitExit the defect menu.

Files Used by format--format.dat

The format data, /etc/format.dat, contains:
  • Disk types
  • Default slice tables
The format.dat file shipped with the Solaris operating system supports many standard disks. If your disk drive is not listed in the format.dat file, you can choose to add an entry for it or allow format to prompt you for the information it needs while it is performing operations.
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 you added to the format.dat file.
You should modify the data file for your system if you have one of the following:
  • A disk that is not supported by the Solaris operating system
  • A disk with a slice table that is different from the Solaris operating system default configuration

Note - Do not alter default entries. If you want to alter the default entries, copy the entry, give it a different name, and make the modification to avoid confusion.

Structure

The format data file (format.dat) contains specific disk drive information used by the format utility. Three items are defined in the format.dat file:
  • Search paths
  • Disk types
  • Slice tables

Syntax

The following syntax rules apply to the data file:
  • The pound sign (#) is the comment character. Any text on a line after a pound sign is not interpreted by format.
  • Each definition in the format.dat file appears on a single logical line. If the definition is more than one line long, all 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 format. If you want an assigned value to contain white space, enclose the entire value in double quotes ("). This will cause the white space within the quotes to be preserved as part of the assignment value.
  • Some assignments can have multiple values on the right hand side. Separate values by a comma.

Keywords

The data file contains disk definitions that are read in by format when it is started. Each definition starts with one of the following keywords: search_path, disk_type, and partition, which are described in Table 31-6.
Table 31-6 format.dat
KeywordUse
search_pathThis keyword is no longer used in the format.dat file. Starting with the Solaris 2.0 release, the format utility searchs the logical device hierarchy (/dev) so there is no need to set this keyword to find a system's disks.
disk_typeDefines the controller and disk model. Each disk_type definition contains information concerning the physical geometry of the disk. The default data file contains definitions for the controllers and disks that the Solaris operating system 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.
partitionDefines a slice table for a specific disk type. The slice table contains the slice information, plus a name that lets you refer to it in format. The default data file contains default slice definitions for several kinds of disk drives. Add a slice definition if you re-created slices on any of the disks on your system. Add as many slice definitions to the data file as you need.

Disk Type

disk_type defines the controller and disk model. Each disk_type definition contains the physical geometry of the disk. The default data file contains definitions for the controllers and disks that the Solaris operating system 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 format is run. Enclose the name in double quotes to preserve any white space in the name. Table 31-7 describes the identifiers that must also be assigned values in all disk_type definitions.
Table 31-7 disk_type
IdentifierDescription
ctlrValid controller type for the disk type. Currently, the supported values for this assignment are SCSI and ISP-80 (IPI controller).
ncylThe number of data cylinders in the disk type. This determines how many logical cylinders of the disk the system will be allowed to access.
acylThe number of alternate cylinders in the disk type. These cylinders are used by format to store information such as the defect list for the drive. You should always leave at least two cylinders for alternates.
pcylThe 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.
nheadThe number of heads in the disk type. This number is used to calculate the boundaries of the disk media.
nsectThe 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 is only the data sectors, any spares are not reflected in the assignment.
rpmThe 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 assignments may be necessary depending on the controller. Table 31-8 describes the assignments required for SCSI controllers.
Table 31-8 disk_type
IdentifierDescription
fmt_timeA number indicating how long it takes to format a given drive. See the controller manual for more
information.
cacheA number that controls the operation of the onboard cache while format is operating. See the controller manual for more information.
trks_zoneA number that specified how many tracks you have per defect zone, to be used in alternate sector mapping. See the controller manual for more information.
asectThe number assigned to this parameter specifies how many sectors are available for alternate mapping within a given defect zone. See the controller manual for more information.
Below are some examples of disk_type definitions:

  disk_type = "SUN0535" \  
       : ctlr = SCSI : fmt_time = 4 \  
       : ncyl = 1866 : acyl = 2 : pcyl = 2500 : nhead = 7 : nsect = 80 \  
       : rpm = 5400  
  disk_type = "SUN0669" \  
       : ctlr = SCSI : fmt_time = 4 \  
       : trks_zone = 15 : asect = 5 : atrks = 30 \  
       : ncyl =  1614 : acyl = 2 : pcyl = 1632 : nhead = 15 : nsect = 54 \  
       : rpm = 3600 : bpt = 31410  
  disk_type = "SUN1.0G" \  
       : ctlr = SCSI : fmt_time = 4 \  
       : trks_zone = 15 : asect = 5 : atrks = 30 \  
       : ncyl =  1703 : acyl = 2 : pcyl = 1931 : nhead = 15 : nsect = 80 \  
       : rpm = 3597 : bpt = 41301  

Slice Tables

A partition definition keyword is assigned the name of the slice table. Enclose the name in double quotes to preserve any white space in the name. Table 31-9 describes the identifiers that must be assigned values in all slice tables.
Table 31-9
IdentifierDescription
diskThe name of the disk_type that this slice table is defined for. This name must appear exactly as it does in the disk_type definition.
ctlrThe disk controller type this slice table can be attached to. Currently, the supported values for this
assignment are ISP-80 for IPI controllers and SCSI for SCSI controllers. The controller type specified here
must also be defined for the disk_type chosen above.
The other assignments in a slice definition describe the actual slice information. The identifiers are the numbers 0 through 7. These assignments are optional. Any slice not explicitly assigned is set to 0 length. The value of each of these assignments is a pair of numbers separated by a comma. The first number is the starting cylinder for the slice, and the second is the number of sectors in the slice. Below are some examples of slice definitions:

  partition = "SUN0535" \  
       : disk = "SUN0535" : ctlr = SCSI \  
       : 0 = 0, 64400 : 1 = 115, 103600 : 2 = 0, 1044960 : 6 = 300, 876960  
  partition = "SUN0669" \  
       : disk = "SUN0669" : ctlr = SCSI \  
       : 0 = 0, 32400 : 1 = 40, 64800 : 2 = 0, 1307340 : 6 = 120, 1210140  
  partition = "SUN1.0G" \  
       : disk = "SUN1.0G" : ctlr = SCSI \  
       : 0 = 0, 32400 : 1 = 27, 64800 : 2 = 0, 2043600 : 6 = 81, 1946400  

Location

The format utility learns of the location of your data file by the following methods.
  1. If a filename is given with the -x command line option, that file is always used as the data file.

  1. If the -x option is not specified, then format looks in the current directory for a file named format.dat. If the file exists, it is used as the data file.

  2. If neither of these methods yields a data file, format uses /etc/format.dat as the data file. This file is shipped with the Solaris operating system and should always be present.

Rules for Input to format Commands

When using format, you need to provide information in various formats. This section describes the rules for the formats. See "Help" on page 511 for information on using format's help facility when inputting data.

Numbers

Several places in format require an integer as input. You must either specify the data or select one from a list of choices. In either case, the help facility causes format to print the upper and lower limits of the integer expected. Simply enter the number desired. 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  

Block Numbers

Whenever you are required to specify a disk block number, there are two ways to input the information:
  • Block number as an integer
  • Block number in the cylinder/head/sector format
You can specify the information as an integer representing the logical block number. You can specify the integer in any base, but the default is decimal. The maximum operator (a dollar sign, $) can also be used here to let format 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 the cylinder/head/sector format. In this format, you must specify explicitly the three logical components of the block number, the cylinder, head, and sector values. These values are still logical, but they allow you to define regions of the disk related to the layout of the media.
If any of the cylinder/head/sector numbers are not specified, the appropriate value is assumed to be zero. You can also use the maximum operator in place of any of the numbers and let format select the appropriate value. Below are some examples of cylinder, head, and sector entries:

  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//$  

format always prints block numbers, in both of the above formats. Also, the help facility shows you the upper and lower bounds of the block number expected, in both formats.

Command Names

Command names are needed as input whenever format is displaying a menu prompt. You can abbreviate the command names, as long as what is entered is sufficient to uniquely identify the command desired.
For example, use p to enter the partition menu from the format menu. Then enter 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  

Other Names

There are certain times in format when you must name something. In these cases, you are free to specify any string desired for the name. If the name has white space in it, the entire name must be enclosed in double quotes ("). Otherwise, only the first word of the name is used.

Help

The format utility provides a help facility you can use whenever format is expecting input. You can request help about what information is expected by entering a question mark (?). The format utility displays a brief description of what type of input is needed.
If you enter a ? at a menu prompt, a list of available commands is displayed.

Associated Man Pages

The man pages associated with the format utility is format(1M), which describes the basic format utility capabilities and provides descriptions of all command line variables, and format.dat(4), which describes disk drive configuration information for the format utility.