< Day Day Up > |
B.9. Fixing the DiskThe beauty of Mac OS X's design is that the operating system itself is frozen in its perfect, pristine state, impervious to conflicting system extensions, clueless Mac users, and other sources of disaster. That's the theory, anyway. But what happens if something goes wrong with the complex software that operates the hard drive itself?
Fortunately, Mac OS X comes with its own disk-repair program. In the familiar Mac universe of icons and menus , it takes the form of a program in Applications Utilities called Disk Utility. In the barren world of Terminal and the command line interface, there's a utility that works just as well but bears a different name : fsck (for file system check). In any case, running Disk Utility or its alter ego fsck is a powerful and useful troubleshooting tool that can cure all kinds of strange ills, including these problems, among others:
B.9.1. Method 1: Disk UtilityThe easiest way to check your disk is to use the Disk Utility program. Use this method if your Mac can, indeed, start up. (See Method 2 if you can't even get that far.) Disk Utility can't check the disk it's on (except for permissions checks, described at the beginning of this appendix). That's why you have to restart the computer from the Tiger installation disc (or another startup disk), and run Disk Utility from there. The process goes like this:
If you see the message, "The volume 'Macintosh HD' appears to be OK," that's meant to be good news. Believe it or not, that cautious statement is as definitive an affirmation as Disk Utility is capable of making about the health of your disk. Note: Don't be alarmed. The message's last line says "Repair completed" whether or not any repairing was done at all. Disk Utility may also tell you that the disk is damaged, but that it can't help you. In that case, you need a more heavy-duty disk-repair program like Drive 10 (www.micromat.com) or DiskWarrior (www.alsoft.com). B.9.2. Method 2: fsck at the ConsoleDisk Utility isn't of much use when you can't find the Tiger DVD, when your CD drive isn't working, or when you're in a hurry to get past the startup problems that are plaguing your machine. In these cases, you'll be glad that you can boot into the Mac's raw Unix underlayer to perform some diagnostic (and healing) commands. Specifically, you'll be glad that you can run the Unix program fsck , for which Disk Utility is little more than a pretty faceplate. Like any Unix program, fsck runs at the command line. You launch it from the alltext, black Unix screen by typing fsck and pressing Enter. (As discussed in the box on the facing page, you can also use fsck -f .) You can't, however, just run fsck in Terminal. You have to run it when the usual arsenal of graphic-interface programs ”like the Finder and its invisible suite of accessory programs ”isn't running. B.9.2.1. Single- user mode (c-S at startup)The Terminal program is the best known form of Mac OS X's command line, but it's not the only one. In fact, there are several other ways to get there.
In general, you don't hear them mentioned except in the context of troubleshooting, because the Terminal program offers many more convenient features for doing the same thing. And because it's contained in a Mac OS X “style window, Terminal is not so disorienting as the three methods you're about to read. All of these techniques take you into console mode , shown in Figure B-3. In con sole mode, Unix takes over your screen completely, showing white type against black, no windows or icons in sight. Abandon the mouse, all ye who enter here; in console mode, you can't do anything but type commands. To get there in times of startup troubleshooting, press c-S while the Mac is starting up. (If you're stuck at the frozen remnants of a previous startup attempt, you may first have to force-restart your Mac; see the tip on Section B.4.) Instead of arriving at the usual desktop, you see technical-looking text scrolling up a black screen as the Mac runs its various startup routines. When it finally stops at the localhost # prompt, you're ready to type commands. You're now in what's called single-user mode , meaning that the Unix multiple-accounts software has yet to load. You won't be asked to log in. At the localhost # prompt, type fsck -y (note the space before the hyphen) and press Enter. (They means "yes," as in "yes, I want you to fix any problems automatically.") If the Mac refuses because journaling is turned on (Section B.8.5), you can also type fsck-fy to force the disk check. Tip: You've probably gone to this trouble for the sake of running fsck , the Unix diskchecking program. But you can also use ls, cd, rm , or any of the other Unix commands described in Chapters 16 and 17. Now the file system check program takes over, running through five sets of tests. When it's complete, you'll see one of two messages:
|
< Day Day Up > |