Contained Within
Find More Documentation
Featured Support Resources
| Download this book in PDF
format Utility
C
- This appendix contains these sections on the format utility:
-
About format
- If you do not know much about the format utility, read the following information to gain a conceptual view of the format utility and what it is used for before proceeding to the instruction or reference sections.
format Definition
- The format utility is a system administration tool used to prepare hard disk drives for use on your Solaris system. format cannot be used on diskette drives, CD-ROM drives, or tape drives.
- If you need more information on disk drive terminology, see Chapter 2, "Disk Drives." This chapter introduces many disk drive concepts.
Features and Benefits
-
format provides the following features and associated benefits.
-
Table C-1 format
| Feature | Benefit |
Searches your system for all
attached disk drives | Reports
· target location
· disk geometry
· whether the disk is formatted
· if the disk has mounted partitions |
| Retrieves disk labels | Used in repair operations |
| Repairs defective sectors | Allows disk drives to be repaired by knowledgeable administrators instead of sending the drive back to the manufacturer |
| Formats and analyzes a disk | Creates sectors on the disk and verifies each sector |
| Partitions a disk | Divides a disk so individual file systems can be created on separate slices |
| Labels a disk | Writes disk name and configuration information to the disk for future retrieval (usually for repair operations) |
When to Use format
- Disk drives are formatted, partitioned, and labeled by the Solaris installation program as part of installing Solaris. You may need to use format when:
-
- Adding a disk drive to an existing system
- Repairing a disk drive
- The need for formatting and partitioning a disk drive has dropped as more and more manufacturers ship their disk drives already formatted and partitioned. You may not need to use format when adding a disk drive to an existing system.
- Also, some customer sites prefer to replace rather than repair defective drives. If your site has a repair contract with the disk drive manufacturer, you may not need to use format to repair disk drives.
Requirements or Restrictions for Using format
- 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)!
Prerequisite Information Needed to Use format
Recommendations for Preserving Information
-
- 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.
Informing format of a Third-party Drive
- If you are adding a disk drive that is not supplied by Sun Microsystems, Inc., you may need to provide disk information in the format.dat file. To determine if you need to add a format.dat entry:
-
-
Check your disk drive manufacturer literature to see if the disk drive interface is SCSI-2 (small computer system interface, version 2).
If it is, you do not need to supply a format.dat entry. The Solaris software will automatically retrieve information about the drive.
-
If you do not have a SCSI-2 disk drive, check the format.dat file for an entry matching your drive.
If you cannot find an entry that matches, follow the instructions described in "How to Add a Third-Party Disk" on page 51.
Instructions for Using format
- Many of the instructions for using format are covered in these books:
-
Peripherals Administration (this book)
-
-
Administration Supplement for Solaris Platforms
-
- Identifying Disk Devices on Your System
- How to Add a System Disk
- The two procedures covered in this appendix are:
-
- How to Identify a Defective Sector
- How to Repair a Defective Sector
Repairing a Defective Sector
- If a disk on your system has a defective sector, you can repair it using the instructions in the following procedures. You may become aware of defective sectors when you:
-
- Run surface analysis on a disk
See "analyze Menu" on page 115 for more information on the analysis functionality of format.
- Get a number of error messages from the disk driver concerning a particular portion of the disk while your system is running.
The defective area reported while your system is running may not be accurate. Since the system does disk operations many sectors at a time, it is often hard to pinpoint exactly which sector caused a given error. Use "How to Identify a Defective Sector" on page 109 to find the exact sector(s).
-
Note - The following procedures in this section require you to be superuser.
· How to Identify a Defective Sector
-
-
Unmount the file system in the slice that contains the defective sector. See
mount(1M)</> for more information.
-
Enter the format utility by typing format.
-
Select the affected disk.
-
# format
searching for disk...done
AVAILABLE DISK SELECTIONS:
0. c0t2d0 <SUN0424 cyl 1151 alt 2 hd 9 sec 80> opt
/sbus@1,f8000000/esp@0,8000000/sd@2,0
1. c0t3d0 <SUN0424 cyl 1151 alt 2 hd 9 sec 80>
/sbus@1,f8000000/esp@0,8000000/sd@3,0
Specify disk (enter its number):0
selecting c0t2d0: opt
[disk formatted]
Warning: Current Disk has mounted partitions.
|
-
-
Enter the analyze menu by typing analyze.
-
Set up the analysis parameters for the search step. Use the parameters shown here:
-
analyze> setup
Analyze entire disk [no]? n
Enter starting block number [0, 0/0/0]: 12330
Enter ending block number [584159, 1216/9/47]: 12360
Loop continuously [no]? y
Repair defective blocks [yes]? n
Stop after first error [no]? n
Use random bit patterns [no]? n
Enter number of blocks per transfer [31, 0/0/31]: 1
Verify media after formatting [yes]? y
Enable extended messages [no]? n
Restore defect list [yes]? y
Create defect label [yes]? y
|
-
-
Use the read command to find the defect.
-
analyze> read
Ready to analyze (won't harm SunOS). This takes a long time,
but is interruptible with Control-C. Continue? y
pass 0
25/7/24
pass 1
Block 12354 (18/4/18), Corrected media error (hard data ecc)
25/7/24
pass 3
Block 12354 (18/4/18), Corrected media error (hard data ecc)
25/7/24
^C
Total of 0 defective blocks repaired.
|
· How to Repair a Defective Sector
-
-
Enter the repair command from the format menu.
-
# format
searching for disk...done
.
.
FORMAT MENU:
.
.
repair - repair a defective sector
.
.
quit
format> repair
|
-
-
Enter the defective block number.
If you are unsure of the format used to identify the defective sector, see "Block Numbers" on page 125 for more information.
-
format> repair
Enter absolute block number of defect: 18/4/18
Ready to repair defect, continue? y
Repairing block 12354 (18/4/18)...ok.
format>
|
Background for format
- This section provides more detailed information on format and contains these discussions.
-
Format Menu and Command Descriptions
- The main menu for the format utility looks like this.
-
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
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
|
- Here are the descriptions of each submenu and command.
-
Table C-2 format
| Item | Command or Menu? | Allows You To... |
| disk | command | Choose the disk that will be used in subsequent operations (known as the current disk). All of the system's drives are listed. |
| type | command | Identify the manufacturer and model of the current disk. All Solaris-supported drives are listed. Choose the Auto configure option for all SCSI-2 disk drives. |
| partition | menu | Create and modify slices. See "partition Menu" for more information. |
| current | command | Display the following information about the current disk: · device name · manufacturer and model · number of cylinders, alternate cylinders, heads and sectors · bus address
|
| format | command | Format the current disk. Uses the information found in the format.dat file
or prompts you for information if there is no format.dat entry. |
-
Table C-2 format
| Item | Command or Menu? | Allows You To... |
| fdisk | menu | Run the fdisk program. See the fdisk(1M) man page and the Administration Supplement for Solaris Platforms for more information. |
| repair | command | Repair a specific blocks on the disk. |
| label | command | Write a new label to the current disk |
| analyze | menu | Run read, write, compare tests. See "analyze Menu" for more information. |
| defect | menu | Retrieve and print defect lists. See "defect Menu" for more information. |
| backup | command | Search for backup labels. |
| verify | command | Print the following information about the disk:
· device name
· manufacturer and model
· number of cylinders, alternate cylinders, heads and sectors
· bus address
· partition table |
| save | command | Save new disk and partition information. |
| inquiry | command | Print the vendor, product name, and revision level of the current drive |
| volname | command | Label the disk with a new eight character volume name. |
| quit | command | Exit the format menu. |
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>
|
- Here are the descriptions for each command.
-
Table C-3 partition
| The Command... | Allows You To... |
| change 'x' partition | Specify new slice
· identification tag
· permission flags
· starting cylinder
· size |
| select | Choose a predefined slice table. |
| modify | Change the disk slices of the current disk. |
| name | Specify a name for the current slice table. |
-
Table C-3 partition
| The Command... | Allows You To... |
| print | View the current slice table |
| label | Write the slice map and label to the current disk. |
| quit | Exit the partition menu. |
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)
print - display data buffer
setup - set analysis parameters
config - show analysis parameters
quit
analyze>
|
- Here are the descriptions for each command.
-
Table C-4 analyze
| The Command... | Allows You To... |
| read | Read each sector on this disk. Repairs defective blocks as a default. |
| refresh | Read then write data on the disk without harming the data. Repairs defective blocks as a default. |
| test | Write a pattern (0xc6dec6de) to the disk without harming the data. Repairs defective blocks as a default. |
-
Table C-4 analyze
| The Command... | Allows You To... |
| write | Write a pattern (0xc6dec6de) to the disk then read the data on the disk back. Destroys existing data on the disk. Repairs defective blocks as a default. |
| compare | Write a pattern (0xc6dec6de) 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. |
| purge | Write a pattern to the disk then read the data back. The default behavior is that four passes are run. The patterns written to the disk are: pass 0 = 0xaaaaaaaa
Destroys existing data on the disk. Repairs defective blocks as a default.
|
| print | View the data in the read/write buffer. |
| setup | 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: 4
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.
|
| config | View the current analysis parameters. |
| quit | Exit the analyze menu. |
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>
|
- Here are the descriptions for each command.
-
Table C-5 defect
| The Command... | Allows You To... |
| primary | Read the manufacturer's defect list from the disk drive and update the in-memory defect list. |
| grown | Read the grown defect list (defects that have been detected during analysis) and update the in-memory defect list. |
| both | Read both the manufacturer's and grown defect list and update the in-memory defect list. |
| print | View the in-memory defect list. |
| dump | Save the in-memory defect list to a file. |
| quit | Exit the defect menu. |
Files Use by format--format.dat
- The format data, /etc/format.dat, contains:
-
- default 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 has a unit number or controller number not found in the GENERIC configuration file
- 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
format.dat 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 (,).
format.dat Keywords
- The data file contains disk definitions that are read in by format when it starts up. Each definition starts with one of the following keywords: search_path, disk_type, and partition.
-
Table 5-1
| Keyword | Use |
| search_path | Tells format which disks it should search for when it starts up. The list in the default data file contains all the disks in the GENERIC configuration file. If your system has disks that are not in the GENERIC configuration file, add them to the search_path definition in your data file. The data file can contain only one search_path definition. However, this single definition lets you specify all the disks you have in your system. |
| disk_type | Defines 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. |
| partition | Defines 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 recreated slices on any of the disks on your system. Add as many slice definitions to the data file as you need. |
Search Path
-
search_path tells format which disks it should search for when it starts up. The list in the default data file contains all the disks in the GENERIC configuration file. If your system has disks that are not in the GENERIC configuration file, add them to the search_path definition in your data file. The data file can contain only one search_path definition. However, this single definition lets you specify all the disks you have in your system. The disk names are as they appear in the boot messages. Here is an example of the search_path definition:
-
# This is the search path for format. It contains all the disks that
# will be searched for if no disk list is given on the command line.
#
search_path = xy0, xy1, xy2, xy3, xd0, xd1, xd2, xd3, xd4, xd5, xd6, \
xd7, xd8, xd9, xd10, xd11, xd12, xd13, xd14, xd15, sd0, sd1, sd2, sd3
|
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. The following identifiers must also be assigned values in all disk_type definitions:
-
Table C-6 disk_type
| Identifier | Description |
| ctlr | Valid controller type the disk types for the disk type. Currently, the supported values for this assignment are XY450 for Xylogics 450/451 controllers, XD7053 for Xylogics(R) 7053 controllers, MD21 for Emulex(R) MD21 controllers (and embedded SCSI disks), and ACB4000 for Adaptec(R) ACB4000 controllers. |
| ncyl | The number of data cylinders in the disk type. This determines how many logical cylinders of the disk the system will be allowed to access. |
| acyl | The 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. |
| pcyl | 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, but there are some circumstances under which it is not. For instance, the Emulex MD21 controller requires four cylinders for internal controller use, so they must be left off the other assignments. Also, to make disks field-replaceable with other disks, some disks are artificially limited to be the same size as another type. |
| nhead | The number of heads in the disk type. This number is used to calculate the boundaries of the disk media. |
| nsect | 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 is only the data sectors, any spares are not reflected in the assignment. |
| rpm | 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. |
| bpt | The physical number of bytes per track for the disk type. This number is used to calculate the boundaries for defects that are in bytes from index format. |
- Other assignments may be necessary depending on the controller. For XY450/451 controllers, the following assignments are also required:
-
Table C-7 disk_type
| Identifier | Description |
| bps | The total number of bytes per sector, including the header and gaps, in the disk type. This number is necessary to locate defects within a track. See the disk manual for information on how to calculate this number. |
| drive_type | The drive type of the disk type. The drive type is a number between 0 and 3 that the 450/451 controller
uses to identify the disk's geometry. See the controller manual for more information. |
| fmt_time | A number indicating how long it takes to format a given drive. See the controller manual for more
information. |
- For XD7053 controllers, the following assignments are also required:
-
Table C-8 disk_type
| Identifier | Description |
| bps | The total number of bytes per sector, including the header and gaps, in the disk type. This number is necessary to locate defects within a track. See the disk manual for information on how to calculate this number. |
- For MD21 and SCSI controllers, the following assignments are also required:
-
Table C-9 disk_type
| Identifier | Description |
| fmt_time | A number indicating how long it takes to format a given drive. See the controller manual for more
information. |
| cache | A number that controls the operation of the onboard cache while format is operating. See the controller manual for more information. |
| trks_zone | A 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. |
| asect | The 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 = "Fujitsu-M2361 Eagle" \
: ctlr = XY450 : fmt_time = 4 \
: ncyl = 840 : acyl = 2 : pcyl = 842 : nhead = 20 : nsect = 67 \
: rpm = 3600 : bpt = 40960 : bps = 600 : drive_type = 3
disk_type = "CDC EMD 9720" \\
: ctlr = XD7053 \\
: ncyl = 1147 : acyl = 2 : pcyl = 1217 : nhead = 10 : nsect = 48 \
: rpm = 3600 : bpt = 30240 : bps = 613
disk_type = "Micropolis 1355" \
: ctlr = MD21 \
: ncyl = 1018 : acyl = 2 : pcyl = 1024 : nhead = 8 : nsect = 34 \
: rpm = 3600 : bpt = 20832
disk_type = "Fujitsu M2243AS" \
: ctlr = ACB4000 \
: ncyl = 752 : acyl = 2 : pcyl = 754 : nhead = 11 : nsect = 17 \
: rpm = 3600 : bpt = 10416 : skew = 2 : precomp = 754
|
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. The following identifiers must also be assigned values in all slice definitions:
-
Table C-10
| Identifier | Description |
| disk | The 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. |
| ctlr | The controller type disks this slice table can be attached to. Currently, the supported values for this
assignment are XY450 for Xylogics 450/451 controllers, XD7053 for Xylogics 7053 controllers, MD21 for
Emulex MD21 controllers, ACB4000 for Adaptec ACB4000 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 = "Fujitsu-M2351 Eagle" \
: disk = "Fujitsu-M2351 Eagle" : ctlr = XY450 \
: a = 0, 16560 : b = 18, 34040 : c = 0, 772800 : g = 55, 722200
partition = "Micropolis 1355" \
: disk = "Micropolis 1355" : ctlr = MD21 \
: a = 0, 16048 : b = 59, 33456 : c = 0, 276896 : g = 182, 227392
partition = "Toshiba MK 156F" \
: disk = "Toshiba MK 156F" : ctlr = MD21 \
: a = 0, 15980 : b = 47, 33660 : c = 0, 277100 : g = 146, 227460
|
format.dat Location
-
format learns of the location of your data file by the following methods.
-
- If a path name is given with the -x command line option, that file is always used as the data file.
- 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.
- 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.
Associated Man Pages
- The man page associated with the format utility is format(1M)which describes the basic format utility capabilities and provides descriptions of all command line variables.
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.
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 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.
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.
|
|