[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
System Management Guide: Operating System and Devices

Fixing a Damaged File System

To fix a damaged file system, you must diagnose the problem and then repair it. The fsck command performs the low-level diagnosing and repairing.

Prerequisites

Procedure

  1. Assess file system damage by running the fsck command. In the following example, the fsck command checks the unmounted file system located on the /dev/hd1 device:
    fsck /dev/hd1
    The fsck command checks and interactively repairs inconsistent file systems. Normally, the file system is consistent, and the fsck command merely reports on the number of files, used blocks, and free blocks in the file system. If the file system is inconsistent, the fsck command displays information about the inconsistencies found and prompts you for permission to repair them. The fsck command is conservative in its repair efforts and tries to avoid actions that might result in the loss of valid data. In certain cases, however, the fsck command recommends the destruction of a damaged file. Refer to the fsck command for a list of inconsistences that fsck checks for.

  2. If the file system cannot be repaired, restore it from backup.

    The following example restores an entire file system backup on the /dev/hd1 device. It destroys and replaces any file system previously stored on the /dev/hd1 device. If the backup was made using incremental file system backups, restore the backups in increasing backup-level order (for example, 0, 1, 2).

    mkfs /dev/hd1
    mount /dev/hd1 /filesys
    cd /filesys
    restore -r

    The mkfs command makes a new file system on the specified device. The command initializes the volume label, file system label, and startup block. For more information about restoring a file system from backup, refer to "Restoring Individual User Files" .

    When using smit restore to restore an entire file system, enter the target directory, restore device (other than /dev/rfd0), and number of blocks to read in a single input operation.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]