How to verify and repair your hard disk in OS X

DiskUtilityIconXHard disk maintenance is one of the few regular maintenance routines that I recommend people do for their Macs. Your hard drive’s formatting is the structure used by the system to store and retrieve every file saved to the drive. In most Mac systems, the boot drive will be using Apple’s Mac OS Extended (HFS+) filesystem format, which is a collection of fast-access “B-tree” databases that store where a file is located on your drive, its logical hierarchical organization, and attributes such as file ownership and access permissions.

If damage occurs to your filesystem structure, then data-access problems can occur, leading to slowdowns, hangs, or crashes. In more severe cases, filesystem corruption can result in continual data corruption, meaning that data written to the drive can be irrecoverably damaged.

In many cases, corruption to the filesystem can start as a small issue, but then grow as additional damage occurs or perpetuates from the original corruption. Therefore, it is best to regularly ensure the filesystem on your Mac is healthy, especially if you have ever lost power or had to force-restart your Mac.

For the routines below, keep in mind that you can only verify the boot volume, and will not be able to repair it. To do this, you will have to boot to Recovery Mode () or to another partition other than your boot volume.

Disk Utility

Disk Utility in OS X

With your drives selected in Disk Utility, clicking Verify Disk will check them for errors. Note the Repair option will be available for all drives except for the boot drive.

The first option for checking the hard drive is Apple’s Disk Utility program, located in the Applications > Utilities folder. To use this, follow these steps:

  1. Open Disk Utility
  2. Select your desired drive in the sidebar
  3. Go to the “First Aid” tab (it should be the default one)
  4. Click the Verify Disk button

Note that in step 2 above, you can select multiple drives (or all of them) to verify or repair them all at once. To do this, hold the Command key to add or remove additional drives to the selection by clicking them, or press Command-A to select all drives in the list.

Terminal

While Disk Utility is the most intuitive approach for checking your drive, you can also do so in the OS X Terminal using either the “diskutil” command, in the following manner:

1. Open the Terminal and run the following command:

diskutil list

In the output, find the name of your volume in the NAME column, and then note its identity in the IDENTIFIER column (this will be something like “disk0” or “disk1″—do not worry about the “s1” or “s2” components of the identifier).

2. Now run the following command using the proper identifier to check the drive’s partition scheme, replacing “DRIVEID” with that you determined from the command above:

diskutil verifyDisk DRIVEID

3. Next, run the following command using the proper volume name determined above in place of “VOLUMENAME”

diskutil verifyVolume VOLUMENAME

Note that if the volume name has spaces in it, then you will either need to encase the name in quotes, or use a back-slash to escape the space character, such as the following:

diskutil verifyVolume “Macintosh HD”
diskutil verifyVolume Macintosh\ HD

If your volume name has odd characters in it (such as emoji) that cause problems when typed in the Terminal, then you can specify the volume using the full identifier (using the “s1” or “s2” that were disregarded above), or if you are trying to target the boot drive only, then you can use a single forward slash to specify the root device:

diskutil verifyVolume disk0s2
diskutil verifyVolume /

Single-User mode

In addition to diskutil, OS X includes the “fsck” command, which similarly can check and repair your drive. This command is available if you boot to Singe-User mode in OS X by holding the Command-S keys at startup. The differences when running this command are that you will need to specify the disk file by its full path (in the /dev directory), such as the following examples.

sudo fsck_hfs -f /dev/disk0s2
sudo f sck_hfs -fy /dev/disk0s2

Preventing Corruption

Even though with added features like Journaling, Apple’s HFS+ filesystem is fairly stable, it can still become corrupted in the event you experience a power outage, or have to force-restart your system (especially during boot-up, or otherwise when the disk is being actively read and written to). Therefore, to help prevent filesystem corruption, avoid holding the power button to force-restart your system as much as possible.

For external drives you use with your system, be sure to properly eject them before unplugging them. If the drives sometimes unmount unexpectedly, then try rearranging how they are attached to your system, replace cables, and avoid daisy-chaining them together. In addition, be sure to use an external power supply for the drive, if one was provided by the manufacturer.

11 thoughts on “How to verify and repair your hard disk in OS X

  1. Pingback: prix sac louis vuitton

  2. Pingback: How to fix deep formatting problems with OS X drives | MacIssues

  3. UK Data Recovery Professionals

    There is a vast knowledge about how to verify and repair your hard disk in OS X. One question is arise that are you auto repair hard drive in safe mode. In our daily life there are so many software for repair hard disk automatically.

  4. Philip Booth

    In our daily life Hard disk maintenance Hard disk maintenance is one of the few regular maintenance routines. If hard disk damage it broken the file system structure, as a result data-access problem occurred. Here discuss the whole process how a hard disk should maintained.

  5. Kaye R. Jenkins

    It is a best solution to get back your corrupted MDB file and all objects. If you want to buy this software, then you can go on this site :- http://www.filesrecoverytool.com/access-file-recovery.html

  6. The Data Hospital

    The Apple disk utility program is very efficient to recover the lost data in hard disk in OS X. the “diskutil” command is a very good command to scan the hard disk in OS X. Here the steps to recover the hard drive is very informative and good to learn. Nice post.

  7. Nate

    I’m trying to Verify and Repair my disk after attempting to install Yosemite and it saying it was damaged. How long should I expect this to take?

  8. Sarah Cooper

    As my hard drive was badly corrupt, it got stuck when I tried to repair my drive with the help of Disk Utility ‘First Aid’ option. Then I tried Stellar Volume repair software which had resolved the issues of bad sector and at last I could be able to access my hard drive successfully.

Comments are closed.