B.6. Fixing the Disk

Chia sẻ: Tuan Nghia | Ngày: | Loại File: PDF | Số trang:6

lượt xem

B.6. Fixing the Disk

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

B.6. Fixing the Disk The 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.

Chủ đề:

Nội dung Text: B.6. Fixing the Disk

  1. B.6. Fixing the Disk The 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 egofsckis a powerful and useful troubleshooting tool that can cure all kinds of strange ills, including these problems, among others: • Your Mac freezes during startup, either before or after the Login screen. • The startup process interrupts itself with the appearance of the text-only command line. • You get the "applications showing up as folders" problem. B.6.1. Method 1: Disk Utility The 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 fix the disk it'son(except for permissions repairs, described at the beginning of this appendix).That's why you have to restart the computer from the Leopard installation disc (or another startup disk), and run Disk Utility from there. The process goes like this: 1. Start up the Mac from the Leopard DVD. The best way to do that is to insert the disc and then restart the Mac while holding down the C key. You wind up, after some time, at the Mac OS X Installer screen. Don't be fooled— installing Mac OS X isnotwhat you want to do here. Don't click Continue!
  2. 2. Choose Utilities Disk Utility. That's the unexpected step. After a moment, the Disk Utility screen appears. Tip: You could also skip steps 1 and 2 by starting up from an external hard drive, like an iPod onto which you've installed Mac OS X. Just run its own copy of Disk Utility to check yourMac'shard drive. 3. Click the disk or disk partition you want to fix, click the First Aid tab, and then click Repair Disk. The Mac whirls into action, checking a list of very technical disk-formatting parameters. If you see the message, "The volume 'Macintosh HD' appears to be OK, "that's meant to begoodnews. 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. 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.6.2. Method 2: fsck at the Console Disk Utility isn't of much use when you can't find the Leopard DVD, when your DVD driveisn'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 programfsck, for which Disk Utility is little more than a pretty faceplate. Like any Unix program,fsckruns at the command line. You launch it from the all-text, black Unix screen by typingfsckand pressing Enter. (As discussed in the box on the facing page, you can also usefsck -f.) You can't, however, just runfsckin 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.
  3. B.6.2.1. Single-user mode( -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. POWER USERS' CLINIC Journaling vs. fsck Mac OS X 10.5 comes withjournalingturned on. As noted on Section A.6 journaling means that the Mac keeps a diary about every tiny bit of hard drive activity. In event of a crash or freeze, the Mac knows precisely what was going on at the time, and precisely which files might have been damaged. In theory, then, you'll never need fsck at all. After all, there's nothing to check. The Mac's journaling software is always on top of things—and, if the journal indicates that there was trouble saving a file, Mac OS X can finish or undo the change. Even Apple concedes, however, that in the real world, things can still go wrong, even with journaling turned on. That's why, when you attempt to usefsckas described on these pages, a message will inform you that, hey, you don'tneedto repair your disk. Thanks to journaling, there's no damage to repair. If you decide to proceed on the off chance that something's gone wrong behind your journal's back, just use the-fflag to force the disk check, like this: fsck -f. Note, however, that you may see a series of phony error messages when you do this. If you see any of these messages, you should ignore them: • "Volume bitmap needs minor repair" • "Invalid volume free block count" or "block count changed from XX to YY" • "Volume header needs minor repair" • "Incorrect block count for file"
  4. If you see anyothererror messages, though, let fsck go ahead and repair them. All of these techniques take you into console mode, shown in Figure B-3. In console 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. Figure B-3. In console mode, your entire screen is a command line interface. Unix jockeys can go to town here. Everyone else can timidly type fsck -y after the localhost:/ root # prompt—see this prompt on the very last line?—and hope for the best. To get there in times of startup troubleshooting, press -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.3.) 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. FREQUENTLY ASKED QUESTION Viruses? What Viruses? One great thing about the old Mac OS was that there were hardly any viruses to worry about—all of the nasties seemed to be written for Windows. But now that we're using Unix, which has been around for 30 years and has a huge user base, is it time to worry again? Nope. There are even fewer viruses for Unix than for the Mac OS. You still need to be careful with Word and Excel macro viruses, of course. If you open a Word or Excel attachment sent by email from someone else, and a big fat dialog box warns you that it contains macros, simply click Disable
  5. Macros and get on with your life. And you still need an antivirus program for Windows if you run it on your Mac (Chapter 8). Otherwise, you have little to worry about. After six years, there hasn't been one single Mac OS X virus outbreak—partly because virus writers have a smaller "audience" in Mac fans, and partly because Mac OS X is more difficult to hack. Sleep well. At the localhost # prompt, type fsck -y (note the space before the hyphen) and press Enter. (The y means "yes," as in "yes, I want you to fix any problems automatically.") If the Mac refuses because journaling is turned on (Section A.6), you can also typefsck -fy to force the disk check. Tip: You've probably gone to this trouble for the sake of running fsck, the Unix disk- checking program. But you can also use ls, cd, rm, or any of the other Unix commands described in Chapter 16. 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: • The volume Macintosh HD appears to be OK. All is well. Type exit and press Return to proceed to the usual Login screen and desktop. • File system was modified. A good sign, but just a beginning. You need to run the program again. Onefsck pass often repairs only one layer of problems, leaving another to be patched in the next pass. Type fsck -ya second time, a third time, and so on, until you finally arrive at a "disk appears to be OK" message. Typeexit at the prompt and press Return to get back to the familiar world of icons and windows. TROUBLESHOOTING MOMENT The Reinstall When some component is missing, your troubleshooting steps have failed, and Mac OS X continues to act up, consider reinstalling Mac OS X. That's not a big deal at all. It involves inserting the Leopard DVD, restarting the Mac, pressing the C key as the computer starts up, and proceeding with the
  6. installer as described in Appendix A. The good news is that the standard Mac OS X installation (as opposed to the radical "Erase and Install" option) doesn't touch your files, folders, or settings. It simply patches what-ever holes have opened up in the Unix undercarriage of your operating system—which, every now and then, does you a world of good. And what if you've updated your DVD's copy of Leopard with little updates— Mac OS X 10.5.1, 10.5.2, and so on? In that case, you'll have to do a clean install (that is, an "Archive & Install" as described in Appendix A). It gives you a brand-new Mac OS X System folder, neatly retiring the previous one (and, in fact, renaming it Previous System Folder). Yes, your new, virginal System folder isn't the latest version of Mac OS X. But that's OK—Software Update will offer you all of the updaters since your Mac OS X DVD was pressed. (If you were smart enough to save these updaters as described on Section 9.22, you won't even have to download them from the Web again.) In no time (all right, in 35 minutes), you'll be right back where you were, this time without the glitches.
Đồng bộ tài khoản