A recent discussion in Macworld's Mac 911 forum revolves around whether fsck (filesystem consistency check) runs when the Mac first boots. Though the subject may be more appropriate for a bar bet, there appears to be enough confusion about the matter that it's worth addressing here.
As ably explained by my colleague, Dan Frakes, a limited form of fsck is run when the Mac first starts up unless it boots from a CD or into single-user mode. In these cases, no form of fsck is automatically run.
When the Mac boots normally, fsck -p is run. According to the fsck man page (as quoted by Dan):
The kernel takes care that only a restricted class of innocuous filesystem inconsistencies can happen unless hardware or software failures intervene. These are limited to the following:
Unreferenced inodes Link counts in inodes too large Missing blocks in the free map Blocks in the free map also in files Counts in the super-block wrong
These are the only inconsistencies that fsck with the -p option will correct
But wait, there's more.
According to Apple, you don't need to boot into single user mode and run fsck if your drive is journaled (as it is by default under Mac OS X 10.3). Apple tells us:
With a journaled volume you do not need to start up into single user mode. When a volume is made available to the file system, the journal is replayed and the file system brought up to a consistent state. If you do run fsck, it is best if you use -n and -f flags so that it will not actually modify the volume. Options explanation from fsck man page:
-n Assume a no response to all questions asked by fsck except for 'CONTINUE?', which is assumed to be affirmative; do not open the file system for writing.
-f Force the check.
When you boot into Safe Boot mode (by holding down the Shift key when you boot the Mac), the Mac runs fsck -fy, a check identical to what Disk Utility performs.
See you at the bar!