JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: Devices and File Systems     Oracle Solaris 10 1/13 Information Library
search filter icon
search icon

Document Information

Preface

1.  Managing Removable Media (Overview/Tasks)

2.  Writing CDs and DVDs (Tasks)

3.  Managing Devices (Tasks)

4.  Dynamically Configuring Devices (Tasks)

5.  Managing USB Devices (Tasks)

6.  Using InfiniBand Devices (Overview/Tasks)

7.  Managing Disks (Overview)

8.  Managing Disk Use (Tasks)

9.  Administering Disks (Tasks)

10.  SPARC: Setting Up Disks (Tasks)

11.  x86: Setting Up Disks (Tasks)

12.  Configuring Oracle Solaris iSCSI Targets (Tasks)

13.  The format Utility (Reference)

14.  Managing File Systems (Overview)

15.  Creating and Mounting File Systems (Tasks)

16.  Configuring Additional Swap Space (Tasks)

17.  Checking UFS File System Consistency (Tasks)

UFS File System Consistency

Enhancements to UFS File System Utilities (fsck, mkfs, and newfs)

Automatic Search for Backup Superblocks

fsck Reports When it Needs to be Rerun

New fsck Messages Regarding Extended Attributes

Better Handling of Duplicate Blocks or Fragments

How the UFS File System State Is Recorded

What the fsck Command Checks and Tries to Repair

Why UFS File System Inconsistencies Might Occur

UFS Components That Are Checked for Consistency

Superblock Checks

File System Size and Inode List Size Checks

Free Block Checks

Free Inode Checks

Inodes

Format and Type of Inodes

Link Count Checks

Duplicate Block Checks

Bad Block Number Checks

Inode Size Checks

Indirect Blocks

Data Blocks

Directory Unallocated Checks

Bad Inode Number Checks

Incorrect "." and ".." Entry Checks

Disconnected Directories

Regular Data Blocks

fsck Summary Message

Interactively Checking and Repairing a UFS File System

How to Check the UFS root (/), /usr, or /var File Systems From an Alternate Boot Device

How to Check Other UFS File Systems (Not root (/), /usr, or /var)

Preening UFS File Systems

How to Preen a UFS File System

Fixing a UFS File System That the fsck Command Cannot Repair

Restoring a Bad UFS Superblock

How to Restore a Bad UFS Superblock (Solaris 10 6/06 Release)

How to Restore a Bad Superblock (Solaris 8, 9, and 10 Releases)

Syntax and Options for the fsck Command

18.  UFS File System (Reference)

19.  Backing Up and Restoring UFS File Systems (Overview/Tasks)

20.  Using UFS Snapshots (Tasks)

21.  Copying Files and File Systems (Tasks)

22.  Managing Tape Drives (Tasks)

23.  UFS Backup and Restore Commands (Reference)

Index

Restoring a Bad UFS Superblock

When the superblock of a file system becomes damaged, you must restore it. The fsck command tells you when a superblock is bad. Fortunately, copies of the superblock are stored within a file system.

You can use the fsck -o b command to replace the superblock with one of these copies or use fsck's automatic search for backup superblocks feature. For more information about this feature, see Automatic Search for Backup Superblocks.

For more information about the superblock, see Superblock.

If the superblock in the root (/) file system becomes damaged and you cannot restore it, you have two choices:

How to Restore a Bad UFS Superblock (Solaris 10 6/06 Release)

If your file system has a bad UFS superblock, fsck automatically calculates an alternative superblock as seen in the following messages:

BAD SUPERBLOCK AT ...

LOOK FOR ALTERNATE SUPERBLOCKS WITH MKFS? 
LOOK FOR ALTERNATE SUPERBLOCKS WITH NEWFS?

Caution

Caution - If a file system with a damaged superblock was created with newfs or mkfs customized parameters, such as ntrack or nsect, using fsck's automatically calculated superblock for the repair process could irreparably damage your file system.

In the case of a file system that was created with customized parameters and it has a bad superblock, fsck provides the following prompt to cancel the fsck session:

CANCEL FILESYSTEM CHECK?

Canceling the fsck session would be an appropriate response if this file system was created with customized parameters or if there is some other concern about running fsck on this file system.


  1. Become superuser or assume an equivalent role.
  2. Check the file system with the suspected bad superblock.
    # fsck /dev/rdsk/c0t1d0s0
    
    ** /dev/rdsk/c0t1d0s0
    
    BAD SUPERBLOCK at ...
  3. Determine how the file system was created and select one of the following:
    • The file system was created with the newfs command.

      • fsck responds that all superblocks are corrupt and it must use a generic superblock. Answer the fsck prompts as described in the example below.


        Caution

        Caution - Do not use this option if the file system was created with customized parameters. This option should only be used as a last resort. Be prepared to restore the file system from a backup copy.


        # fsck /dev/dsk/c1t2d0s0
        ** /dev/rdsk/c1t2d0s0
        BAD SUPERBLOCK AT BLOCK 16: BLOCK SIZE LARGER THAN MAXIMUM SUPPORTED
        
        LOOK FOR ALTERNATE SUPERBLOCKS WITH MKFS? no
        
        
        LOOK FOR ALTERNATE SUPERBLOCKS WITH NEWFS? yes
        
        SEARCH FOR ALTERNATE SUPERBLOCKS FAILED.
        
        USE GENERIC SUPERBLOCK FROM MKFS? no
        
        
        USE GENERIC SUPERBLOCK FROM NEWFS? yes
        
        CALCULATED GENERIC SUPERBLOCK WITH NEWFS
        If filesystem was created with manually-specified geometry, using
        auto-discovered superblock may result in irrecoverable damage to
        filesystem and user data.
        
        CANCEL FILESYSTEM CHECK? no
        
        ** Last Mounted on
        ** Phase 1 - Check Blocks and Sizes
        ** Phase 2 - Check Pathnames
        ** Phase 3a - Check Connectivity
        ** Phase 3b - Verify Shadows/ACLs
        ** Phase 4 - Check Reference Counts
        ** Phase 5 - Check Cylinder Groups
        CORRECT GLOBAL SUMMARY
        SALVAGE? y
        
        
        UPDATE STANDARD SUPERBLOCK? y
        
        81 files, 3609 used, 244678 free (6 frags, 30584 blocks, 0.0% fragmentation)
        
        ***** FILE SYSTEM WAS MODIFIED *****
      • fsck responds that it found an alternate superblock with a message similar to the following:

        FOUND ALTERNATE SUPERBLOCK 32 WITH NEWFS

        With this fsck scenario, follow the prompts as shown in Automatic Search for Backup Superblocks.

    • The file system was created with the mkfs command.

      • fsck responds that all superblocks are corrupt and must use a generic superblock. Answer the fsck prompts as described in the example below.


        Caution

        Caution - Do not use this option if the file system was created with customized parameters. This option should only be used as a last resort. Be prepared to restore the file system from a backup copy.


        # fsck /dev/dsk/c1t2d0s0
        ** /dev/rdsk/c1t2d0s0
        BAD SUPERBLOCK AT BLOCK 16: BLOCK SIZE LARGER THAN MAXIMUM SUPPORTED
        
        LOOK FOR ALTERNATE SUPERBLOCKS WITH MKFS? yes
        
        
        LOOK FOR ALTERNATE SUPERBLOCKS WITH NEWFS? no
        
        SEARCH FOR ALTERNATE SUPERBLOCKS FAILED.
        
        USE GENERIC SUPERBLOCK FROM MKFS? yes
        
        CALCULATED GENERIC SUPERBLOCK WITH MKFS
        If filesystem was created with manually-specified geometry, using
        auto-discovered superblock may result in irrecoverable damage to
        filesystem and user data.
        
        CANCEL FILESYSTEM CHECK? no
        
        ** Last Mounted on
        ** Phase 1 - Check Blocks and Sizes
        ** Phase 2 - Check Pathnames
        ** Phase 3a - Check Connectivity
        ** Phase 3b - Verify Shadows/ACLs
        ** Phase 4 - Check Reference Counts
        ** Phase 5 - Check Cylinder Groups
        CORRECT GLOBAL SUMMARY
        SALVAGE? y
        
        
        UPDATE STANDARD SUPERBLOCK? y
        
        81 files, 3609 used, 243605 free (117 frags, 30436 blocks, 0.0% fragmentation)
      • fsck responds that it found an alternate superblock with a message similar to the following:

        FOUND ALTERNATE SUPERBLOCK 32 WITH MKFS

        With this fsck scenario, follow the prompts as shown in Automatic Search for Backup Superblocks.

  4. Answer the prompts to salvage and restore the superblock.

    There is no need to rerun fsck when you see the following message:

    ***** FILE SYSTEM WAS MODIFIED *****

    However, it doesn't harm the file system to rerun fsck after this message. This message is just informational about fsck's corrective actions.

How to Restore a Bad Superblock (Solaris 8, 9, and 10 Releases)

  1. Become superuser or assume an equivalent role.
  2. Determine whether the bad superblock is in the root (/), /usr, or /var file system and select one of the following:
  3. Display the superblock values by using the newfs -N command.
    # newfs -N /dev/rdsk/device-name

    The command output displays the block numbers that were used for the superblock copies when the newfs command created the file system, unless the file system was created with special parameters. For information on creating a customized file system, see Customizing UFS File System Parameters.

  4. Provide an alternate superblock by using the fsck command.
    # fsck -F ufs -o b=block-number /dev/rdsk/device-name

    The fsck command uses the alternate superblock you specify to restore the primary superblock. You can always try 32 as an alternate block. Or, use any of the alternate blocks shown by the newfs -N command.

Example 17-3 Restoring a Bad Superblock (Solaris 8, 9, and 10 Releases)

The following example shows how to restore the superblock copy 5264.

# newfs -N /dev/rdsk/c0t3d0s7
/dev/rdsk/c0t3d0s7: 163944 sectors in 506 cylinders of 9 tracks, 36 sectors
 83.9MB in 32 cyl groups (16 c/g, 2.65MB/g, 1216 i/g)
super-block backups (for fsck -b #) at:
 32, 5264, 10496, 15728, 20960, 26192, 31424, 36656, 41888,
 47120, 52352, 57584, 62816, 68048, 73280, 78512, 82976, 88208,
 93440, 98672, 103904, 109136, 114368, 119600, 124832, 130064, 135296,
 140528, 145760, 150992, 156224, 161456,
# fsck -F ufs -o b=5264 /dev/rdsk/c0t3d0s7
Alternate superblock location: 5264.
** /dev/rdsk/c0t3d0s7
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
36 files, 867 used, 75712 free (16 frags, 9462 blocks, 0.0% fragmentation)

***** FILE SYSTEM WAS MODIFIED *****
#