fsck: Repair startup disk file system on Mac

If the hard drive in your Mac begins to weaken and appears to be damaged, then Disk Utility is likely to get you stuck. Here it is necessary to pull out the command fsck, which stands for "File System Consistency Check". However, this is only possible to a limited extent via the terminal and can only be carried out in single user mode for an internal hard drive from which the macOS operating system is executed. Does that all sound very extensive and like many new terms? Don't worry, you can use the following guide to repair the startup disk file system on Mac!

Update: Repair access rights with new macOS systems

The instructions here seem to only work up to macOS Mojave. Since macOS Catalina, Apple has created a separate volume for the system and made it write-protected. As a result, the commands, the commands mentioned below, no longer work.

How it works under the operating system versions macOS Catalina, Big Sur and Monterey is here in the article " Repair access rights on macOS Big Sur and Monterey"explains. All people with a system prior to macOS Catalina can now just read on ...

Repair the file system of the startup disk on the Mac - it works with the fsck command in single user mode;)

Repair the file system of the startup disk on the Mac - it works with the fsck command in single user mode;)

Preview: Single user mode uses the English key layout

Before I get to the detailed explanations about single user mode, fsck and Co., here is a short but important note: In the mode shown, the Mac uses English not only for output, but also for input. This means, among other things, that the English keyboard layout is used. Accordingly, when entering Z and Y are swapped; and the hyphen “-” is not in its usual place between the period and the right shift key, but where the ß is on the German keyboard. But don't panic, you don't have to remember that, I'll show the commands in both layouts below;)

Check Mac hard drive for errors in Disk Utility

The hard disk utility can be found in the Applications -> Utilities folder, via the Launchpad or via Spotlight search (cmd + space bar). If you want to check a hard drive for errors, select it and click it with the right mouse button (tap on the trackpad with two fingers). Then you choose Start first aid ... out. Now you confirm the whole thing and after a few minutes you may be shown one or the other errors.

In the macOS disk utility you can go to troubleshooting. However, you cannot fully fix the errors in the file system of the start volume (boot hard disk).

In the macOS disk utility you can go to troubleshooting. However, you cannot fully fix the errors in the file system of the start volume (boot hard disk).

fsck: Repair Mac File System in Single User Mode

Perhaps at the end of the “First Aid” for the Mac hard drive you will be suggested to put the Mac into recovery mode with cmd + R when restarting. But you can ignore that. Instead, you should restart your Mac (or turn it off and on again), but then cmd + p Hold down (⌘ + S). When white letters appear on the black display, you can let go of the buttons.

You may now see a lot of white text scrolling through. If it stops and the cursor (small, white rectangle) appears after root #, you can start. If that doesn't happen, press Enter once; then the display should be correct. And then you do the following:

  1. The command for the first File System Consistency Check is (English layout):
    / sbin / fsck -yf

    on a German keyboard you press these keys:

    -sbin-fsck ßzf
  2. Confirm the entry with Enter and wait for the end of the check or its evaluation
  3. If there are still errors or if the check shows that there are errors, enter this command again and confirm with Enter:
    fsck -yf

    on the keyboard with German design:

    fsck ßzf
  4. Repeat step 3 until the message “The Volume Macintosh HD was repaired successfully” appears at the end
  5. Quit the Single User Mode with this entry, which you confirm with Enter (then the Mac restarts normally with macOS):
    exit

Repair specific Mac hard drive using the fsck command

In the special case that you have installed several hard drives in your Mac, iMac or MacBook, there is of course also the option of addressing and repairing individual storage drives. So if you do not (only) want to repair the file system on the Mac's startup disk, but also on other hard drives, then proceed as follows:

  1. Starts the on macOS Port (Programs -> Utilities or similar)
  2. Call up the list of your hard drives and memories with this command:
    disktil list
  3. Now the hard disks are listed, by default with names like / dev / disk0, / dev / disk1 and so on
  4. Make a note of the name of the hard drive you are talking about, as well as the file system, which you can find in the TYPE column (or alternatively in the hard disk utility)
  5. Closes the terminal
The hard drive list in the terminal looks something like this after the command suchenil list.

The hard drive list in the terminal looks something like this after the command suchenil list.

So you now have the identification and the file system (APFS, HFS + or exFAT) of the hard drive that you want to repair. You then restart the Mac and press cmd + S to get into single user mode. As described above, when the white font appears on a black background, release the keys and wait until root # and the cursor rectangle appear. Then it goes on like this:

  1. Enter the following command for a drive with HFS + and ID "0" and confirm it with Enter:
    / sbin / fsck_hfs -fy / dev / disk0

    or in the German layout:

    -sbin-fsck? hfs ßfz -dev-disk0
  2. Alternatively, enter the following for this hard drive with APFS:
    / sbin / fsck_apfs -fy / dev / disk0

    or in the German layout:

    -sbin-fsck? apfs ßfz -dev-disk0
  3. For a hard drive with exFAT the command is of course:
    / sbin / fsck_exfat -fy / dev / disk0

    or in the German layout:

    -sbin-fsck? exfat ßfz -dev-disk0
  4. If there are still errors, you can enter the command several times and confirm it
  5. End the session either with the exit command shown above or with:
    reboot

Note: The question mark "?" Is not a placeholder, but the German character for the underscore "_" written in the English layout - so press Shift + ß for this. 

The single user mode appears tiny on the Retina MacBook

The font may appear very small in single-user mode on an Apple MacBook, Apple MacBook Pro or Apple MacBook Air with Retina display. This is probably due to the fact that this mode is not designed for retina resolution, but for coarser or older displays. Unfortunately, this also means that - if you do not recognize the entry correctly - you have to pay particular attention to the fact that your entries are correct. I wish you success! And if you found a bug in the instructions above, please leave a comment.

-
 

30 comments

  1. Matthew Imkamp says:

    Hey supi, yesterday I tried it out quite a bit in single-user mode. a partition zickt around with me. Try everything tomorrow and then get in touch
    Kind regards
    Matthias

  2. Matthias says:

    So, puzzles solved. Minimum: A backup (I always have at least two), a little guide, using the recovery mode in the terminal to create a new Fusiondrive (careful, everything will be deleted) and restore everything.
    As always with this action, you need good nerves and backups. Thanks to Hannes Gnad from the apple factory, it was actually very easy https://support.apple.com/de-de/HT207584
    Everything is new in May. Funny that the problem described is not directly linked to this solution. In any case: Catalina runs - felt faster than Mojave. may also be due to the new system, which just did not take over all errors.

    • sir appleot says:

      Thank you for your feedback. The problems are always so specific that it's great to get the solution back from the readers. Surely someone else will be happy to receive your report shortly. I think it is going faster, it could be because of the complete restart. Most of the time there are things that caused problems beforehand and that were then not taken over.

  3. Jan says:

    Hello Sir Apfelot,
    I followed your instructions and after using "fsck -yf" several times I still get the error message "Snapshot is invalid". I had received a similar message from Disk Utility. The reason is probably the attempt to install a security update for MacOS Mojave: - /

    Can you help me?

    gruß
    Jan

    • sir appleot says:

      Hello Jan! I looked through the post in the Apple forum here worked. There are two clues there:
      1. The Time Machine snapshots could be the cause here. If you do this with the terminal command

      tmutil deleteLocalSnapshots * snapshot_date *

      all removed, the problem probably no longer exists.
      2. You must execute the fsck command in single-user mode and must not have entered any other command beforehand.
      Maybe you will try the two things out?

  4. Samir says:

    Hallo,
    I have now run the fsck -yf command in single mode on my imac for sure 20 times….
    it always appears
    diskOs2: I / 0 error.
    Filsystem cannot be checked

    my hard drive is now gone :-(
    Thanks for your answer

    • Jen Kleinholz says:

      Hello Samir! Yes, unfortunately it looks like there is a hardware defect. :-( Do you have a backup?

    • MacOldie says:

      My MacBook Pro (mid-2010), 1TB Hybrid-HD did not go beyond the completed progress bar during the startup process. Restarted 3 times and then it went back to the login page and I was able to use the MBP. The disk utility started immediately. > No mistakes. Then I wanted to be on the safe side and start the MPB from the Unix shell (then I found the necessary start procedure from Sir-Apfelot). So it was done twice. Always with the result: no mistakes, everything is OK. - But why did the normal system start hang up twice ??? Does anyone have a guess?

      • Jen Kleinholz says:

        Hello MacOldie! You could boot again and then hold down CMD + V. Then the Mac starts in "Verbose Mode" and informs you in tiny letters about what it is doing while it boots. It then gets stuck somewhere and these last lines, which are output there, would be interesting for troubleshooting. Another attempt would be: restart and hold SHIFT. Then it boots in safe mode and leaves out some drivers and extensions. When it boots up cleanly, you know that it was some of these things. Then the search continues. : D Get in touch if you could find out anything.

  5. Patrick says:

    Hello Jens, I can log in when I start my Mac, but the start aborts shortly before the end and the screen turns white. After a few seconds it shuts down and I'm back at the login window. When I get the command / sbin / fsck -fy that the volume Mac HD appears as ok and it has been modified. When I log in again and want to start the Mac, I'm back to the same point as at the beginning. Do you have any advice on what I could do? Think I've had this problem since an update at the beginning of December.

    • Jen Kleinholz says:

      Hello Patrick! Can you still get into the recovery partition with CMD + R when booting? If so, I would try to install macOS over it. It is possible that something broke during the update that can be repaired in this way.

      Note: Installing over it will not damage anything and will not overwrite any of your data or settings.

  6. Fox says:

    Hello!
    Today I wanted to install Big Sur on my MB Pro Late 2013 and the disk utility gives the error “invalid key order (63); object map is invalid ".
    I have already executed the FSCK command several times as described here, but nothing changes.
    Is there any other way than a complete reinstallation? Otherwise the Mac runs perfectly, it just can't update.

    Thank you!

    • Jen Kleinholz says:

      Hello fox! I couldn't find out what the error message was saying in a hurry. But I would try the following way: Install macOS Big Sur on an APFS formatted external hard drive and then use the migration assistant to transfer all the data. Then you have a "quick" reinstallation. Searching for the cause of such errors is usually not very promising.

  7. Jens Owe Petersen says:

    Hi Jens,

    I proceeded as described above, but always received the following message:

    option -f is not implemented, ignoring error: container / dev / rdisk2 is mounted with write access

    I came across the command and your site because I have been trying to install Bootcamp on my IMac 2013 in vain for days and want to avoid a cleaninstall.

    I would be more than grateful for any idea.

    • Jen Kleinholz says:

      Hello Jens Owe! I would proceed as follows: Make a backup of your system on an external disk (bootable with Carbon Copy Cloner or SuperDuper, for example). Then boot from the external hard drive and provide the internal one with boot camp and then copy your system back from the external hard drive to the fresh partition for macOS. Then you bypassed a CleanInstall and still put a "fresh" boot camp on it.

  8. Pablo says:

    Hello Jens, me again….

    I installed Monterey and have several problems. Now I wanted to follow your advice but after I enter cmd + S the white font also runs down but I don't get to enter the command Fsck because the Mac will restart immediately ..... Do you have an idea?

    gruß

    Pablo

    • Jen Kleinholz says:

      Hello Pablo! I assume you have an M1 Mac? Then there is no longer this mode. It is best to start in recovery mode (hold down CMD + R when restarting) and then go to the terminal via utilities. You can then enter the fsck command there. I hope it helps!

      • Pablo says:

        Hi Jens,
        no, I still chose the Intel processor because I built in more memory. As I said, the white font runs down. I got that far but then the restart always started. I didn't get around to typing the command.

        I had already run CMD + R and started the hard disk utility but no errors were apparent.

        Even with the Intel version you can enter the Fsck command when you are in the terminal?

        gruß

        Pablo

  9. jjm says:

    fsck does not seem to work on BigSure laptops anymore !?

    • Jen Kleinholz says:

      Hello jjm! You're right. A different approach is now recommended by Apple:
      sudo diskutil resetUserPermissions / 'id -u'

      then comes if necessary. the "Error -69841", which you can fix with the following two commands:
      chflags -R nouchg ~
      sudo diskutil resetUserPermissions / 'id -u'

      I think I have to write a detailed article on this.

  10. Bülent says:

    Hello Jens, really great article and explained in great detail.
    Can you maybe help me with my problem?
    I followed your instructions exactly the same way, but I still cannot delete the internal SSD hard drive.
    Regards
    Bülent

    • Jen Kleinholz says:

      Hello Bülent! You may need to look under Programs> Utilities> Startup Security Utility. There it should be selected that the Mac is allowed to boot from external media. Then you would have to Boot Mac in recovery mode and there delete the volume in the disk utility. You cannot erase the entire hard drive because the Mac booted from the recovery partition on the hard drive. If that were possible, the Mac would no longer be able to start. Alternatively, you can clone the system to an external disk, then boot from it and then delete the internal disk. I hope that was explained in a reasonably understandable way. : D

  11. Stephen K says:

    Hello Jens, I booted my Macbook (Catalina) in single user mode and am currently trying to do a check with / sbin / fsck -yf ...

    Then get the irritating warning:
    warning: option -f is not implemented, ignoring
    error: container / dev / rdisk1 is mounted with write access.

    It does not seem possible to make a list of discussions to find the correct drive, if necessary.
    The first line of the error message:
    Unable to run because unable to use the Disk Management framework.
    Common reasons include, but are not limited to, the Disk Arbitration
    framework being unavailable due to being booted in single-user mode.

    Is Apple doing something new here that your instructions have not yet taken into account?
    Or am I doing something wrong here. It all looks so simple in your instructions.

    Regards,
    Stefan

  12. Stephen K says:

    Hello Jens, thanks for the reply and the link. Is with fsck and the repair of access rights, as with apples and pears. You can't compare. Stumbled upon your blog entry on fsck in single user mode and thought your instructions were good. Perhaps it would be useful to point out that it is no longer possible from macOS xy if you get a message about this. Your decision, of course. I think it's great how you solved the description with the English keyboard layout. Some of you will probably stumble when you suddenly have a slash instead of a hyphae. Many greetings, Stefan

    • Jen Kleinholz says:

      Hi Stefan! Yes, I made up for the hint in the post. With the new systems, the macOS area can no longer be changed by the user. That is why you can only change the access rights in the user folder. If you want to do something on the system, you can actually only install over it. fsck no longer makes sense in this context ...

Leave a Comment

Your e-mail address will not be published. Required fields are marked with * .