System Administration Guide

Repairing a Defective Sector

If a disk on your system has a defective sector, you can repair it by using the instructions in the following procedures. You may become aware of defective sectors when you:

The above console message indicates that block 179 may be bad. Relocate the bad block by using the format utility's repair command or use the analyze command with the repair option enabled.

How to Identify a Defective Sector by Using Surface Analysis

  1. Become superuser.

  2. Unmount the file system in the slice that contains the defective sector.

    See mount(1M) for more information.


    # umount /dev/dsk/device-name
    
  3. Enter the format utility by typing format.


    # format
    
  4. Select the affected disk.


    Specify disk (enter its number):1
    selecting c0t2d0:
    [disk formatted]
    Warning: Current Disk has mounted partitions.
  5. Enter the analyze menu by typing analyze at the format> prompt.


    format> analyze
    
  6. Set up the analysis parameters by typing setup at the analyze> prompt. 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
    
  7. 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
    ^C
    Total of 1 defective blocks repaired.

How to Repair a Defective Sector

  1. Become superuser.

  2. Enter the format utility and select the disk that contains the defective sector.


    # format
    Searching for disks...done
    AVAILABLE DISK SELECTIONS:
        0. c0t2d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
    /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@2,0
        1. c0t3d0 <SUN0535 cyl 1866 alt 2 hd 7 sec 80>
    /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0
    Specify disk (enter its number): 1
    selecting c0t3d0
    [disk formatted]
    format> 
  3. Enter the repair command at the format> prompt.


    format> repair
    
  4. Enter the defective block number.


     Enter absolute block number of defect: 12354
       Ready to repair defect, continue? y
       Repairing block 12354 (18/4/18)...ok.
    format>

    If you are unsure of the format used to identify the defective sector, see "How to Identify a Defective Sector by Using Surface Analysis" for more information.