next up previous contents
Next: Mounting File Systems Up: Managing Storage Previous: Creating File Systems   Contents

Checking File Systems

The fsck program checks UFS file systems and performs corrections to grant disk integrity. fsck can correct inconsistencies such as unreferenced inodes, missing blocks in the free list, or incorrect counts in the superblock.

File system corruption is caused by improper shutdown, hardware and power supply failures, unproper physically write protect of a mounted file system, a mounted file system going off line, or missing synchronization before shutdown.

fsck is run at boot noninteractively, making any safe corrections. If an unexpected inconsistency is detected, fsck exits leaving the system in single-user mode, and asking manual rerun, which allows yes or no anwser to fsck prompts. fsck syntax is:

/usr/sbin/fsck[options ...] [file_system ...]

If a file system is not specified, all the file systems in /etc/fstab are checked. File systems must be specified as raw devices.

N.B. The root file system must be checked in single-user mode and must be mounted read only. To go to single-user mode, use the shutdown command.

Note that fsck is used only for UFS. AdvFS uses write-ahead logging instead and the recovery log for inconsistencies and corrections at mount.

If a UFS file system mount operation fails with a FATAL ERROR message and fsck cannot recover damaged i-nodes and file lost+found is missing or unusable, the system will boot in single user. To restart the system do:


# mount -a
# cd /etc
# ed fstab
.... comment out problem disk
# reboot


next up previous contents
Next: Mounting File Systems Up: Managing Storage Previous: Creating File Systems   Contents
luvisetto
2001-10-02