How to Repair Hard Disks with fsck on macOS

Photo of Mac home screen

When your hard drive starts to fail, Disk Utility offers some useful disk repair tools. But if they don’t get it done for you, you may want to turn to one of the big guns: fsck. fsck, which stands for “File System Consistency Check,” is a command-line tool that reviews and repairs the underlying structure of a hard drive. The fsck tool in Mac is the same as the one found in Linux. This article focuses on Mac’s user interface and covers how to repair macOS hard disks with fsck – both mechanical and solid state drives (SSDs).

What Are the Signs of a Hard Drive Failing?

Usually, you’ll notice that a hard drive is failing on your Mac early on. Below are three of the most common signs:

1. Crashes

If nothing’s wrong with your Mac’s drives, the device will usually run smoothly. It’s a surefire sign that you need to look into an issue if you suddenly begin dealing with crashes.

Your device could crash because of incompatible files and folders, while overheating may also result in your device not working properly. Software errors could lead to the same.

2. Disk Errors

Another sign that your hard drive is failing is disk errors on your Mac.

These signs include your drive suddenly being unrecognizable to your computer, sluggish performance, and random ejections.

3. Error Messages

If you see error messages on your Mac, it’s often a certain sign that you should look at the state of your hard drive.

In many cases, you’ll see messages related to apps quitting unexpectedly or unexpected errors stopping your device from completing a certain task.

Repair Mac Hard Disks Fsck Macbook Pro

4. S.M.A.R.T. Issues

S.M.A.R.T. means Self Monitoring Analysis and Reporting Technology System. It’s used to keep track of the health of your mechanical drives.

If you’re having problems in this area, your device will warn you with a message saying that your disk has S.M.A.R.T. issues. Common contributors to this issue include mechanical failures and excessive humidity.

5. Programs Stop Running Properly

When you use your Mac, your device will store many of the apps and programs you use on your hard drive.

If this begins to fail, you may begin to notice that your programs stop running as smoothly. Your Mac may take longer to load, or you could struggle to open apps that you use regularly.

6. Files on Your Mac Become Corrupt

Another sign that your hard drive is failing is your files becoming corrupt.

Corruptions often occur during the writing phase. If a disk has stopped working properly, you may find that you can no longer use certain files or documents.

Mechanical Drives Making Strange Noises

Some level of noise from your Mac is normal, especially if you’re running programs that take up a lot of energy. What isn’t normal, however, is hearing sounds like clicking and grinding.

If you hear these noises, it’s a sign that the Mac’s mechanical drives aren’t working properly. And if left unaddressed over time, these could cause significant damage to the drive.

Finding the Right Disk

Before you can run fsck, you’ll need to find the device node and identifier of the disk you want to target. We’ll use Terminal’s diskutil command to accomplish that.

1. Open Terminal (/Applications/Utilities/Terminal.app).

2. Type the following command, then press “Enter.”

diskutil list
terminal-diskutil-list

3. This will produce a list of all the currently connected drives, both mounted and unmounted.

terminal-diskutil-list-result

4. Locate the disk you want to run fsck on and find its device identifier. It will look like “/dev/disk1”, and will be found along the left margin of the Terminal window. Write this information down somewhere since you’ll need it in the next steps.

terminal-diskutil-list-result-2

Running fsck from Single User Mode

macOS won’t let you run fsck from inside the operating system. You’ll need to reboot into Single User mode, which is a stripped-down, text-only, superuser interface for macOS.

1. Open the Apple menu and select “Restart.”

Mac Restart Menu

2. Hold down Command + S while your computer restarts. You can release the keys once you see white text start to appear on the startup screen.

3. Some white text will scroll by quickly. When it stops, you’ll see a command prompt at the bottom of the screen that says root#.

If the text stops scrolling, but you don’t see this prompt, press the “Enter” key once to reveal it.

fsck-single-user-mode-1

4. To repair the boot disk, type the following command, then press “Enter.”

/sbin/fsck -fy

This runs fsck with the -f flag, which forces it to check journaled file systems like HFS+, as well as the -y flag, which automatically says “yes” to any prompts that fsck may encounter.

fsck-single-user-mode-2

5. You can also use fsck to repair non-boot disks, but you’ll need to know the filesystem type. For example, if I wanted to run fsck on “/dev/disk2,” I would use the following command:

/sbin/fsck_hfs -fy /dev/disk2
fsck-single-user-mode-3

That command will run the HFS sub-version of fsck on that drive. Other available filesystems include fsck_msdos, which runs on FAT file systems; fsck_exfat, which examines ExFAT filesystems; and fsck_udf, which looks at UDF file systems.

6. fsck will check the file system and attempt to repair any damage that it finds. If it finds no damage, it will exit with “OK.”

7. When fsck is finished checking and repairing the filesystem, type reboot into the command prompt and press “Enter.”

Frequently Asked Questions

1. Can I repair my Mac hard disks without using fsck?

Yes, you can also use Disk Utility to repair a hard drive on your Mac. To do this, go to Spotlight (magnifying glass in the toolbar), search for “Disk Utility,” and click on Disk Utility.app.

Select “First Aid” and choose “Run.” Your Mac will search for problems and fix any that arise.

2. How long will it take to repair a disk using fsck on Mac?

The time it takes to repair the disk itself will depend on the extent of the damage and the size of your drive, plus whether your drive is full or not.

You can tell how damaged your Mac disk is by using Disk Utility; if it’s damaged beyond repair, a message will tell you that you have a fatal hardware error.

3. Is fsck safe to run on Mac devices?

When using fsck to repair your Mac hard drive, it’s important to remember that you may lose some of your files, since the command seeks to repair file systems that it checks and deems necessary to repair. As you may not know which important files fall into this category beforehand, it’s crucial that you back everything up beforehand.

Wrapping Up

fsck on the Mac isn’t as powerful as fsck on Linux, but it can still be a lifesaver if you end up with a corrupted boot disk or damaged hard drive. Read on to learn the things you should do before and after reformatting your hard drive on a Mac.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox