System Administration Guide: Devices and File Systems

ProcedureHow to Check Non-root (/) or Non-/usr File Systems

This procedure assumes that the file system to be checked is unmounted.

For information on restoring a bad superblock, see How to Restore a Bad Superblock.

Steps
  1. Become superuser or assume an equivalent role.

  2. Unmount the local file system first to ensure that there is no activity on the file system.

    Specify the mount point directory or /dev/dsk/device-name as arguments to the fsck command. Any inconsistency messages are displayed.

    For example:


    # umount /export/home
    # fsck /dev/rdsk/c0t0d0s7
    ** /dev/dsk/c0t0d0s7
    ** Last Mounted on /export/home
    .
    .
    .
  3. Correct any reported fsck errors.

    For information about how to respond to the error message prompts while interactively checking one or more UFS file systems, see Chapter 32, Resolving UFS File System Inconsistencies (Tasks), in System Administration Guide: Advanced Administration.

  4. If necessary, run the fsck command again if you see the following messages, FILE SYSTEM STATE NOT SET TO OKAY or FILE SYSTEM MODIFIED.

    The fsck command might be unable to fix all errors in one execution.

    If fsck cannot repair all of the problems after running it several times, see Fixing a UFS File System That the fsck Command Cannot Repair.

  5. Mount the repaired file system to see if there are any files in the lost+found directory.

    Individual files put in the lost+found directory by the fsck command are renamed with their inode numbers. If possible, rename the files and move them where they belong. You might be able to use the grep command to match phrases within individual files and the file command to identify file types.

    Eventually, remove unidentifiable files or directories left in the lost+found directory so it doesn't fill it up unnecessarily.

  6. Rename and move any files put in the lost+found directory.


Example 20–1 Checking Non-root (/) or Non-/usr File Systems Interactively

The following example shows how to check the /dev/rdsk/c0t0d0s6 file system and corrects the incorrect block count. This example assumes that the file system is unmounted.


# fsck /dev/rdsk/c0t0d0s6
** Phase 1 - Check Block and Sizes
INCORRECT BLOCK COUNT I=2529 (6 should be 2)
CORRECT? y

** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Cylinder Groups
929 files, 8928 used, 2851 free (75 frags, 347 blocks, 0.6%
fragmentation)
/dev/rdsk/c0t0d0s6 FILE SYSTEM STATE SET TO OKAY
 
***** FILE SYSTEM WAS MODIFIED *****