Sunday, April 16, 2006

OS X Safe Boot: easiest way to repair disk (fsck replacement)

It's oddly hard to find a clear explanation of what safe boot does, and how it compares to repairs using disk utility (boot DVD) or fsck:
Care and Feeding of Panther

... Under Jaguar, you could run an FSCK from here to manually fix system problems (see the earlier article 'Care and Feeding of Jaguar' if you are running any of the various iterations of Jaguar 10.2.x). Unfortunately, with the introduction of Panther, Apple included a feature called 'Journaling.' Journaling is a system that keeps track of your file and directory information. If something goes wrong, your system might be able to be reconstructed from the 'journaled' information collected prior to the crash. It's actually a pretty cool feature, and it may keep you from ever even noticing that your system had severe problems and fixed them!

The unfortunate part is that this journaling behavior also makes the old Single User Mode FSCK maneuver unworkable. You can force the FSCK in Single User Mode with a little extra code, but you are quite likely to encounter erroneous error messages such that the system seems to have problems but really doesn't. The FSCK routine may not give you a clear idea of whether or not your system is actually fixed.

Luckily, there's a better way to do this. If you reboot your system into what is called a 'Safe Boot' (by holding down the Shift key after the 'bong' like the old Disable Extensions in OS 9), you will see the words Safe Boot in the loading box. When you boot into Safe Boot, Panther automatically runs a complete FSCK during the load process. It may be a slow boot into Safe Boot, because the FSCK running in the process takes quite a long time. It may even be necessary to reboot and run Safe Boot a couple of times, since FSCK may fix one thing one time and then find yet another thing the second time.

It's particularly important to run this Safe Boot FSCK process if your system has had a total lockout like a ten-minute spinning pizza. If you have had to force re-boot your system without shutting it down properly, it is quite likely that certain temp files have gotten corrupted. This may not show up as a problem today, but a week from now, you could get really nasty behavior and even unexplained crashing. Save yourself a little trouble and quickly run Safe Boot if this happens to you.
Despite running a journaled system I do get minor errors on occasion. I think it's worth doing this after major system updates as a maintenance step.

No comments: