System information
Chapter 12. File System Check
Filesystems may be checked for consistency, and optionally repaired, with filesystem-specific
userspace tools. These tools are often referred to as fsck tools, where fsck is a shortened version
of file system check.
Note
These filesystem checkers only guarantee metadata consistency across the filesystem; they
have no awareness of the actual data contained within the filesystem and are not data
recovery tools.
Filesystem inconsistencies can occur for various reasons, including but not limited to hardware
errors, storage administration errors, and software bugs.
Before modern metadata-journaling filesystems became common, a filesystem check was required
any time a system crashed or lost power. This was because a filesystem update could have been
interrupted, leading to an inconsistent state. As a result, a filesystem check is traditionally run on
each filesystem listed in /etc/fstab at boot-time. For journaling filesystems, this is usually a very
short operation, because the filesystem's metadata journaling ensures consistency even after a
crash.
However, there are times when a filesystem inconsistency or corruption may occur, even for
journaling filesystems. When this happens, the filesystem checker must be used to repair the
filesystem. The following will provide best practices and other useful information when performing
this procedure.
Important
Red Hat does not recommend this unles the machine does not boot, the file system is extremely
large, or the file system is on remote storage. It is possible to disable file system check at boot
by setting the sixth field in /etc/fstab to 0.
12.1. Best Pract ices for fsck
Generally, running the filesystem check and repair tool can be expected to automatically repair at
least some of the inconsistencies it finds. In some cases, severely damaged inodes or directories may
be discarded if they cannot be repaired. Significant changes to the filesystem may occur. To ensure
that unexpected or undesirable changes are not permanently made, perform the following
precautionary steps:
Dry ru n
Most filesystem checkers have a mode of operation which checks but does not repair the
filesystem. In this mode, the checker will print any errors that it finds and actions that it
would have taken, without actually modifying the filesystem.
Chapt er 1 2 . File Syst em Check
85