System Administration Guide: Devices and File Systems

ProcedureHow to Restore a Bad Superblock ( Solaris Express Release)

This procedure is new in the Solaris Express release. If your file system has a bad 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.