Example--Seeing If a File System Needs Checking

How to Check File Systems Interactively

Become superuser.

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

# umountall -l

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 -

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.

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.

Preening UFS File Systems

The preen option to fsck (fsck -o p) checks UFS file systems and automatically fixes the simple
problems that normally result from an unexpected system shutdown. It exits
immediately if it encounters a problem that requires operator intervention.
The preen option also permits parallel checking of file
systems.

You can run fsck with the -o p option
to preen the file systems after an unclean shutdown. In this mode, fsck does not look at the clean flag and does a full check. These
actions are a subset of the actions that fsck takes when
it runs interactively.

How to Preen a File System

Become superuser.

Unmount the file system.

# umountmount-point

Check a UFS file system with the preen option.

# fsck -o p /dev/rdsk/device-name

You can preen individual file systems by using mount-point or /dev/rdsk/device-name
as arguments to fsck.