Home > Wiki Tips

Fsck: How to Use Fsck Command to Repair Hard Drive on Mac?

Updated on Thursday, December 26, 2024

Written by

Anna Yuan

Approved by

Jessica Shee

English Deutsch

Summary: This post is a simple guide about what fsck is and how to use the fsck command to repair your Mac internal hard disk or any other external hard disk. It also talks about the cases when you need to run fsck.

 Is this annoying you sometimes? Your MacBook fails to boot or Mac is stuck on the loading screen due to a corrupted startup volume or your external hard disk can't work normally because of file system issues.

Don't panic. This post tells you how to run fsck on Mac to repair the internal and external hard disks and related information about the fsck command.

What does fsck mean

fsck (file system consistency check) is a tool for checking the consistency of a file system in Unix and Unix-like operating systems, such as Linux and macOS. And there is a similar command named CHKDSK existing in Microsoft Windows and its ancestor, MS-DOS.

The main function of fsck is to check and repair file system problems. So you can run fsck manually to check your Mac internal disk or external hard drive and repair it if any problem has been found.

However, running fsck requires the familiarity of the command-line interface. As any command can make changes to a file system, so you need to be careful when using the fsck command.

When to run fsck on Mac

The Mac will signal the use of fsck if it has run into issues and needs your attention to fix them. So if you notice the following signs upon startup then your Mac may have encountered issues with the file system and it needs repairing. Watch out for these signs:

  • If the Mac boots up partially and then shows a message asking you to run fsck, then this usually displays a command-line prompt, indicated by a number sign (#). As the command line suggests, you need to run fsck manually.
  • Your Mac failed to display the login screen after booting.
  • Your Mac isn't able to load the desktop after you have logged in.

Besides, if your external hard drive stops working suddenly, or becomes corrupted, unmountable, unreadable, and inaccessible on Mac, using fsck to repair external hard drive on Mac is highly recommended.

How to use fsck on Mac to repair a hard drive

If you have run into one of the above situations, it is recommended to use the fsck command now. Also, fsck is highly recommended when Disk Utility First Aid or Mac Safe Mode failed to fix your Mac internal disk or external hard disk.

Run fsck on Mac to repair internal hard drive:

1. Start or restart your Mac, hold down Command + S key combinations together to boot into Mac Single User Mode.

2. 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#.

3. Type the following command and then press Enter key:

/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.  

Your Mac will run a diagnostic on your internal drive, and attempt to repair any damage it finds.

If 'FILE SYSTEM WAS MODIFIED' appears on the screen, it means one or more problems have been found and repaired. Since additional issues may exist after a repair is made, you should rerun fsck until you see the message: The volume (name of your volume )appears to be OK.

4. This means your hard disk has no problems now. Simply type 'reboot' and then press Return to restart your Mac.

Run fsck on Mac to repair external hard drive:

  1. Open Launchpad > Other > Terminal.
  2. Type in the following command, then press Enter to list all the connected drives on your Mac currently.diskutil list
  3. According to the disk information, Locate the disk you want to run fsck on and find its device identifier. It will look like '/dev/disk2'. You need to write this information down somewhere or take a picture of it since you'll need it in the next steps.  
  4. Restart your Mac and hold down Command + S keys to boot your Mac into Single User Mode.
  5. This time type in the following command then, press Enter./sbin/fsck_hfs -fy /dev/disk2  
    You need to replace 'hfs' with the true file system of your external hard drive as well as replace the drive identifier with the one you just located in step 3.
  6. When fsck is finished checking and repairing the errors in your external hard drive, type 'reboot' into the command prompt and press Enter to restart your Mac.