One of the first tasks that Unix performs when rebooting is a check of
the hard disks to see if they were corrupted (usually the result of a
rude shutdown). The checking program is invoked with the command
fsck. Each file system on the disk, beginning with the root file system, is checked separately. If problems are found in the
root file system, the problem will be corrected and a message to that
effect will appear on the screen. At this point either the system
will reboot itself or it will prompt you to reboot it. You have little
choice in the matter since the system will not run with a corrupted
root file system. If errors are found in other file systems,
the system will also ask you what to do. The questions are rather
cryptic and we find it hard to believe that anyone but a Unix guru
will understand what's being asked. A sample fsck session
is:
/dev/root Fast File System: Volume: ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Free List Bitmap 7378 files 194278 blocks 3974 free
Above, the system was fine; below there are problems:
/dev/usr Fast File System: Volume: ** Phase 1 - Check Blocks and Sizes POSSIBLE FILE SIZE ERROR I=7233 ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts UNREF FILE I=4612 OWNER=root MODE=20000 SIZE=0 MTIME=Nov 18 06:26:47 1991 CLEAR?y Answering yes may remove files.
By dint of this last question, users may feel they are in a ``Catch 22'' situation. If they answer yes to fsck's questions, they will have noncorrupted files, but some files may get lost. If they answer no, the existing files will remain unusable since they are corrupted. Actually, things are not that bad since fcsk places the mangled files or their remnants in the special directory lost+foundat the top of every file system, and you may be able to recover some lost data.
Unless the disk drive has experienced physical damage, as may occur after a voltage spike or a scratched disk, none of your old data files should be affected by the fsck recovery. Those new files you were working on at the time of the crash, as well as files that were open for reading or writing will be affected. While this situation may seem unpalatable, the only realistic option is to hope you have a good backup and let fsck repair the file system.