13.2. File System Corruption after Power Outage or System Crash

Although Linux is a stable operating system, should it happen to crash unexpectantly (perhaps due to a kernel bug, or perhaps due to a power outage), your file system(s) will not have been unmounted and therefore will be automatically checked for errors when Linux is restarted.

Most of the time, any file system problems are minor ones caused by file buffers not being written to the disk, such as deleted inodes still marked in use. In the majority of cases, the file system check will be able to detect and repair such anomolies automatically, and upon completion the Linux boot process will continue normally.

Should a file system problem be more severe (such problems tend to be caused by faulty hardware such as a bad hard drive or memory chip; something to keep in mind should file system corruption happen frequently), the file system check may not be able to repair the problem automatically. This is usually, but not always, the case when the root file system itself is corrupted. In this case, the Red Hat boot process will display an error message and drop you into a shell, allowing you to attempt file system repairs manually.

As the recovery shell unmounts all file systems, and then mounts the root file system "read-only", you will be able to perform full file system checks using the appropriate utilities. Likely you will be able to run e2fsck on the corrupted file system(s) which should hopefully resolve all the problems found.

After you have (hopefully) repaired any file system problems, simply exit the shell to have Linux reboot the system and attempt a subsequent restart.

Naturally, to be prepared for situations such as a non-recoverable file system problem, you should have one or more of the following things available to you:

  • The boot/root emergency disk set, AND/OR

  • The LILO emergency boot disk, AND

  • A recent backup copy of your important files -- just in case!