OS X includes two utilities to verify and repair disks: Disk Utility and fsck (a command-line utility). You can also use these even when your computer starts up fine but you want to check the disk for possible file system issues. For Mac OS X 10.4.3 or later, see the section "About live verification in Mac OS X 10.4.3 or later," below.
Important: If you're using Mac OS X 10.4 or later, you should use Disk Utility instead of fsck, whenever possible.
In some situations, file system errors may prevent your computer from starting up. This can occur after an improper shutdown, forced restart, or power interruption. If your computer shows any of the following symptoms on startup, use a disk repair utility:
- Your computer partially starts but then displays a command line in a text-only environment. You may see the message, "file system dirty, run fsck." Below it, you'll see what's called a command-line prompt, indicated by a number sign (#), that allows you to type a command. If you see this, you'll need to run fsck from the command line (see "Use fsck if necessary," below).
- Your computer starts but doesn't reach the login screen.
- Your computer reaches the login screen but does not load the Desktop after you log in.
If your computer exhibits the above issues, here are some things to try to get your computer back to starting up properly again. If you can't start from the Recovery System or Internet Recovery in OS X Lion or later, see the section "Use fsck," below.
Try Safe Mode
If you're using Mac OS X 10.2 or later, you can start up your computer in Safe Mode, which includes an automatic disk check and repair. If you're using Mac OS X 10.1.5 or earlier, skip to the next section. A Safe Boot, which starts up your computer into Safe Mode, might allow you to start up your computer successfully. To do this, follow these steps:
- Start up in Safe Mode.
- After the system has fully started up, restart your computer again normally.
If your Mac successfully restarts, the issue should be resolved. If the issue continues, try using Disk Utility.
Try Disk Utility
Use these steps to use the Disk Utility app to verify or repair a disk.
- If you're using OS X Lion or later, start the computer from Recovery System or Internet Recovery. If you're using an older version of OS X and your computer came with a Mac OS X Install disc, insert the installation disc and restart the computer while holding the C key instead.
- When your computer finishes starting up, choose Disk Utility from the Utilities window, or from the Installer menu if you're started from an installation disc.
- Click the First Aid tab.
- Click the disclosure triangle to the left of the hard drive icon to display the names of your hard disk volumes and partitions.
- Select your Startup Disk (usually named "Macintosh HD").
- Click Repair. Disk Utility checks and repairs the disk.
Tip: With Mac OS X v10.6 and earlier, always start up your computer from an Install or Restore disc when using Disk Utility to verify or repair your startup volume. Otherwise, you might see some disk error messages.
Use fsck if necessary
The command-line utility fsck can also be used to verify and repair a disk. If you can successfully start up in Safe Mode or use Disk Utility while started up from a disc, you don't need to use fsck. Here are some situations in which fsck may be necessary.
- Your Mac can't be started from the Recovery System or Internet Recovery.
- Your Mac OS X disc isn't available.
- Your optical drive isn't available.
- You can't start with a Safe Boot by holding the Shift key during start up.
Tip: If you use a Mac OS X Extended (Journaled) formatted volume, such as with Mac OS X 10.3 or later, you probably don't need to use fsck. If you do use it for any reason, please be aware that benign error messages can appear.
If you're not sure how your volume is formatted and you can't start up from your Mac OS X volume to find out, type the following command in a command-line interface and then press Return:
diskutil info /
If you see "File System: Journaled HFS+" returned, you have a Journaled volume.
To use fsck, you must use it from the command line. Unlike using your pointer to open an application to do something, you'll need to type a text command at the prompt (#) to tell fsck what to do. The Terminal application (/Applications/Utilities) and single-user mode are two examples of command-line interfaces where you can type these kinds of commands. To use fsck:
- Start up your computer in single-user mode to reach the command line.
Note: If your computer is unresponsive, force it to power off by holding down the power button for several seconds. Then press the power button again to start up the computer.
- At the command-line prompt type:
Press Return. fsck will go through five "phases" and then return information about your disk's use. Once it finishes, it'll display this message if no issue is found:
** The volume (name_of_volume) appears to be OK
If fsck finds issues and alters, repairs, or fixes anything, it displays this message:
***** FILE SYSTEM WAS MODIFIED *****
If this message appears, repeat the fsck command you typed in step 2 until fsck tells you that your volume appears to be OK (first-pass repairs may uncover additional issues, so this is a normal thing to do).
- When fsck reports that your volume is OK, type
rebootat the prompt and then press Return.
Your computer should now start up normally and allow you to log in.
About live verification in Mac OS X 10.4.3 or later
In Mac OS X 10.4.3 or later, you can verify your startup disk while your Mac is started from it. This is known as live verification, and can be used in three different ways.
Option 1: Verify your disk using Disk Utility while started from the startup disk. To find out how to do this, see this article. Please note that live verification does not involve any disk repair, so if verification finds something that should be repaired, start up from your Mac OS X Install disc and use Disk Utility as described above in "Try Disk Utility."
Option 2 (advanced): Use the command line and the command-line utility, diskutil.
- Start up your computer and log in as an administrator.
- Open Terminal (/Applications/Utilities).
- At the prompt, type the following command and then press Return:
diskutil verify /
Note: Don't use this method to check non-startup volumes.
You should see messages such as the following during the disk check:
Could not unmount disk for verification, attempting live verify
Started verify/repair on volume disk0s3 Macintosh HD
Checking HFS Plus volume.
Checking Extents Overflow file.
Checking Catalog file.
Checking multi-linked files.
Checking Catalog hierarchy.
Checking Extended Attributes file.
Checking volume bitmap.
Checking volume information.
The volume Macintosh HD appears to be OK.
Verify/repair finished on volume disk0s3 Macintosh HD
Option 3 (advanced): Use the command line and the
fsck_hfs -l command.
Start up your computer and log in as an administrator.
Open Terminal (/Applications/Utilities).
At the prompt, type the following command and then press Return to determine your filesytem ID:
Look for lines of text that look like this:
Filesystem Size Used Avail Capacity Mounted on
/dev/disk0s3 37G 20G 17G 55% /
/dev/disk0s5 37G 37G 641M 98% /Volumes/Storage
Make a note of the first "disk" name that appears after /dev/, such as "disk0s3." This is your filesystem ID for your startup volume.
At the prompt, type the following command and then press Return:
Then type the following command, where "disk0s3" is your filesystem ID you noted in step 4, then press Return:
sudo fsck_hfs -l /dev/disk0s3
When prompted, enter your admin password, then press Return to begin the verification.
You should see messages like these during the disk check:
** /dev/rdisk0s3 (NO WRITE)
** Root file system
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking multi-linked files.
** Checking Catalog hierarchy.
** Checking Extended Attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume Macintosh HD appears to be OK.
If you're interested in UNIX-style command-line syntax, here's a look at how a couple of flags used above can influence fsck:
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 filesystems that are marked as "clean".