System Administration Guide: Basic Administration

Restoring a Bad 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 the copies.

For more information about the superblock, see The 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 Superblock

  1. Become superuser or assume an equivalent role.

  2. Determine whether the bad superblock is in the root (/) or /usr file system and select one of the following:

    1. Stop the system and boot from the network or a locally-connected CD if the bad superblock is in the root (/) or /usr file system.

      From a locally-connected CD, use the following command:

      ok boot -s cdrom

      From the network where a boot or install server is already setup, use the following command:

      ok boot -s net

      If you need help stopping the system, see SPARC: How to Stop the System for Recovery Purposes or IA: How to Stop a System for Recovery Purposes.

    2. Change to a directory outside the damaged file system and unmount the file system if the bad superblock is not in the root (/) or /usr file system.

      # umount /mount-point

      Caution – Caution –

      Be sure to use the newfs -N in the next step. If you omit the -N option, you will create a new, empty file system.

  3. Display the superblock values with the newfs -N command.

    # newfs -N /dev/rdsk/device-name

    The output of this command 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 Custom File System Parameters.

  4. Provide an alternate superblock with 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—Restoring a Bad Superblock

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)
/dev/rdsk/c0t3d0s7 FILE SYSTEM STATE SET TO OKAY