System Administration Guide, Volume 1

How to Check File Systems Interactively

  1. Become superuser.

  2. Unmount the local file systems except root (/) and /usr.

    # umountall -l
  3. Check the file system.

    # fsck

    All file systems in the /etc/vfstab file with entries in the fsck pass field greater than zero are checked. You can also specify the mount point directory or /dev/rdsk/device-name as arguments to fsck. Any inconsistency messages are displayed. See "Troubleshooting File System Problems" in System Administration Guide, Volume 2 for information about how to respond to the error message prompts to interactively check one or more UFS file systems.

    Caution - Caution -

    Running fsck on a mounted file system might cause a system to crash if fsck makes any changes, unless stated otherwise, such as running fsck in single-user mode to repair a file system.

  4. If you corrected any errors, type fsck and press Return.

    fsck might not be able to fix all errors in one execution. If you see the message FILE SYSTEM STATE NOT SET TO OKAY, run the command again. If that does not work, see "How to Fix a UFS File System fsck Cannot Repair".

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

    Individual files put in the lost+found directory by fsck 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 with individual files and the file command to identify file types. When whole directories are dumped into lost+found, it is easier to figure out where they belong and move them back.

Example--Checking File Systems Interactively

The following example checks /dev/rdsk/c0t0d0s6 and corrects the incorrect block count.

# fsck /dev/rdsk/c0t0d0s6
checkfilesys: /dev/rdsk/c0t0d0s6
** Phase 1 - Check Block and Sizes
INCORRECT BLOCK COUNT I=2529 (6 should be 2)
** 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%
/dev/rdsk/c0t0d0s6 FILE SYSTEM STATE SET TO OKAY