Using fsck for file system maintenance in Mac OS X

When the computer cannot start up normally, you may need to use fsck for disk repair. In some situations, file system errors may prevent the computer from starting up to a normal state. This could occur after improper shutdown, forced restart, or power interruption.

The fsck utility is run from the command line. This means that you must type a text command at a prompt (#), rather than using the mouse pointer to open an application. Examples include Mac OS X’s Terminal application and single-user mode.

Start in single-user mode to reach the command line. Note: If necessary, perform a forced restart as described in the Emergency Troubleshooting Handbook that came with your computer. On desktop computers, this is generally achieved by pressing the reset/interrupt button, which is marked with a triangle. On portable computers, this is generally achieved by pressing the Command-Control-power keys. If a portable computer does not respond to this method, you may need to reset the Power Manager.

– At the command-line prompt, type: /sbin/fsck -fy
– Press Return.

The fsck utility will go through five “phases” then return information about the disk’s utilization and fragmentation. Once the check is finished, if no issue is found, you should see “** The volume (name of volume) appears to be OK.”

If fsck alters, repairs, or fixes anything, it will display the message:
***** FILE SYSTEM WAS MODIFIED *****

Important: If this message appears, repeat the fsck command until it no longer appears. It’s okay if you need to do several “passes” of fsck, because first-pass repairs may uncover additional issues.

When fsck reports that, “** The volume (name of volume) appears to be OK.”, type: reboot

Press Return. The computer should start up normally and allow you to log in.

Additional information:
The -y flag tells fsck that you want to answer “yes” to all questions about fixing, repairing, or salvaging information. This is the optimal approach, as answering “no” to any question causes fsck to stop. You cannot determine that all necessary repairs have been made until fsck completes and gives its final report. The -f flag forces fsck to check “clean” filesystems when preening.

This information excerpted from Apple’s “Using Disk Utility and fsck for file system maintenance in Mac OS X” document #106214. More info here.

16 Comments

  1. Haven’t used fsck since I upgraded to Panther. Good to know if anything else fails but I would first recommend starting up with Alsoft’s DiskWarrior and have it repair the directory. It is the single most useful piece of software I have ever come across.

  2. Disk Warrior also isn’t a “cure all”

    Sure it rebuilds the directory, but there is a lot more than a directory that needs to be repaired and maintained.

    And DW is very expensive for what little it does, many shills being paid off to promote it.

  3. You need to use a wired (USB) keyboard in single-user mode (e.g. to run fsck); wireless (Bluetooth) won’t work. Probably the same booting from a DiskWarrier CD but I’m not paying Alsoft to get one for my iMac G5. Instead, I used BootCD to create an emergency boot CD with DW copied to it in case I can’t boot from a FireWire volume to run DW.

  4. jshuteye,

    What about orphaned links, which were not mentioned in the piece to which you linked? I occasionally experience odd behavior (mixed-up icons, Expos� acting flaky) which logging out will not correct, but which is cured by running fsck -f (which reports orphaned links). It’s entirely possible that the glitches are caused by third-party utilities (WindowShade, Butler, Ittec among others) which have become indispensible to me, but I’m willing to trade the inconvenience of doing an occasional fsck for the productivity increases that these utilities give me. Don’t be so quick to dismiss it by assuming that journaling is a cure-all.

  5. I had to fsck myself just the other day after downloading Virex from .Mac – stupid idea as my poor old blueberry iBook couldn’t boot after a restart! A quick fsck and all was back to normal… I’ve since deleted this useless piece of software as it also caused a “You must restart your computer…” kernel panic!! Viruses might not be a problem for Macs, but it seems virus killers are, for me at least!

  6. If the “/sbin/fsck -fy” command is too hard to remember when tragedy strikes and panic sets in, you can repair the hard drive by using the Disk Utility on DISK 1 of your OS X reinstall disks.

    Insert Disk 1.
    Restart the computer and hold down the “c” key to boot from the CD.
    Quit the Installer.
    In the pull down menus you’ll find “Disk Utility”.
    Follow the instructions for “Repair Disk’.
    It too can be run several times until you have an error-free drive.

  7. “C” booting from Panther cd #1 or Techtool or Disk Warrior cannot be done if you have a 6800 Ultra or GT as the drivers are not present on these boot cds.

    Make sure you have a clone of your boot drive on standby.

    Again MDN you fscking don’t have a clue yet. :p

  8. I’m just betting the good folks at MDN wanted to see how many regulars they could get to use “fsck” without them having to make any modifications, given the previous comments in another thread about their modifying posts from time to time in this manner. Pretty fscking sneaky, MDN!

Reader Feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.