fsck stands for File System Consistency Check, a command-line tool to examine and repair the internal structure of a hard drive. Repairing a hard drive with fsck on MacOS will provide highly effective results for users without the need for third-party software.
Note: The fsck tool in Mac operates similarly to the fsck tool found in Linux.
Step 1: Open Terminal (/Applications/Utilities/Terminal.app).
Finding the Hard Drive
Before running fsck, you need to locate the device node and identifier code of the hard drive you want to repair. To do this, you use the diskutil command in Terminal.
Step 1: Launch Terminal (/Applications/Utilities/Terminal.app).
Step 2: Enter the following command and then press Enter:
diskutil list
Step 3
Step 4: Find the location of the hard drive you want to run fsck on and locate the device of that hard drive. It will be in the format /dev/disk1, and you will find this information on the left sidebar of the Terminal window.
Save this information as you will need it to proceed with the next steps.
Run fsck from Single User Mode
Fsck is a powerful utility, however, macOS does not allow running this utility within the operating system. You may think you can run fsck on a non-booting drive, however, this is entirely false: essentially fsck has no function when used within macOS.
You will need to boot into Single User Mode, which is a user interface with only command-line access on macOS.
Step 1: Restart your Mac computer.
Step 2: Press and hold Command + S while restarting your computer until you see text appearing on the screen, then release the keys.
Step 3: Commands will scroll down quickly and stop when you see a command prompt at the bottom corner of the screen saying root#.
If the commands stop scrolling, and you don't see this command prompt, press Enter to display it.
Step 4: To repair the hard drive using fsck on macOS, enter the command below and then press Enter:
/sbin/fsck -fy
The command above runs fsck with the -f flag to force a check on journaled file system like HFS+, as well as the -y flag, automatically answering 'yes' to any prompts fsck may encounter.
Note that the -y flag can be somewhat dangerous: 'Use the -y flag cautiously as it is a free pass to proceed after encountering unlimited basic issues that it has encountered'.'
Step 5: Additionally, you can use fsck to repair non-booting drives, but you need to know the type of file system. For example, if you want to run sfck on /dev/disk2, you can use the command below:
/sbin/fsck_hfs -fy /dev/disk2
The above command will run a sub-version (a version management system) of fsck on the hard drive. Other available file systems include fsck_msdos for FAT file systems, fsck_exfat for checking ExFAT file systems, and fsck_udf for examining UDF file systems.
Step 6: fsck will check the file system and attempt to repair any damage it detects. If no damage is found, fsck will exit and display OK on the screen.
Step 7: After fsck completes the file system check and repair process, enter the reboot command into the command window and press Enter.
Above, Mytour just introduced and guided you on how to repair hard drives using fsck on macOS.
On Windows, users often encounter bad hard drive errors, leading to insufficient disk space and slowing down the entire system. If you encounter this situation, you should promptly address the bad hard drive errors.
Although fsck on Mac is not as powerful as on Linux, this utility is still one of the useful rescue tools to salvage a faulty boot drive or damaged hard drive. To ensure your hard drive always operates robustly, stably, and has plenty of free space, you should regularly clean up your computer's hard drive using a few simple commands. Wish you all success!