266 The File System while the update is taking places. (Interrupting these sorts of operations can be like interrupting John McEnroe during a serve: both yield startling and unpredictable results.) No matter! The people who designed the Unix File System didn’t think that the computer would crash very often. Rather than taking the time to design UFS so that it would run fast and keep the disk consistent (it is possible to do this), they designed it simply to run fast. As a result, the hard disk is usually in an inconsistent state. As long as you don’t crash during one of these moments, you’re fine. Orderly Unix shutdowns cause no problems. What about power failures and glitches? What about goonball technicians and other incompetent people unplugging the wrong server in the machine room? What about floods in the sewers of Chicago? Well, you’re left with a wet pile of noodles where your file system used to be. The tool that tries to rebuild your file system from those wet noodles is fsck (pronounced “F- sick,”) the file system consistency checker. It scans the entire file system looking for damage that a crashing Unix typically exacts on its disk. Usu- ally fsck can recover the damage. Sometimes it can’t. (If you’ve been hav- ing intermittent hardware failures, SCSI termination problems, and incomplete block transfers, frequently it can’t.) In any event, fsck can take 5, 10, or 20 minutes to find out. During this time, Unix is literally holding your computer hostage. Here’s a message that was forwarded to UNIX-HATERS by MLY it orig- inally appeared on the Usenet Newsgroup comp.arch in July 1990: Date: 13 Jul 9016:58:55 GMT From: aglew@oberon.crhc.uiuc.edu (Andy Glew)2 Subject: Fast Re-booting Newsgroups: comp.arch A few years ago a customer gave us a 30 second boot after power cycle requirement, for a real-time OS. They wanted 10. This DECstation 3100, with 16MB of memory, and an approxi- mately 300Mb local SCSI disk, took 8:19 (eight minutes and nine- teen seconds) to reboot after powercycle. That included fsck’ing the disk. Time measured from the time I flicked the switch to the time I could log in. 2Forwarded to UNIX-HATERS by Richard Mlynarik.
UFS: The Root of All Evil 267 That may be good by Unix standards, but it’s not great. Modern file systems use journaling, roll-back, and other sorts of file opera- tions invented for large-scale databases to ensure that the information stored on the computer’s hard disk is consistent at all times—just in case the power should fail at an inopportune moment. IBM built this technology into its Journaling File System (first present in AIX V 3 on the RS/6000 workstation). Journaling is in USL’s new Veritas file system. Will journal- ing become prevalent in the Unix world at large? Probably not. After all, it’s nonstandard. Automatic File Corruption Sometimes fsck can’t quite put your file system back together. The follow- ing is typical: