How to Repair a Mac Disk with fsck from Single User Mode

Aug 7, 2013 - 29 Comments

Using Disk Utility through Recovery Mode is the preferred and primary tool for repairing disks on the Mac platform, but if Disk Utility is either unavailable or not able to repair a drive, then Single User Mode and the command line tool fsck should be your next choice.

fsck

The fsck tool is bundled with every Mac, but because it’s accessible exclusively through the command line it may appear complex and sound more intimidating than it really is. Fear not though, because using fsck is actually quite simple, and there are several cases where it can repair a problem with a drive that Disk Utility was unable to.

How to use Single User Mode and fsck to repair a disk

  1. Boot the Mac into Single User Mode by holding down Command+S during system boot after you hear the boot chime, you know you will have successfully entered Single User Mode because you will see a bunch of white text on a black background scroll by
  2. When the Single User boot sequence has finished, you’ll find a small command prompt at the bottom of the screen prefixed by a hash sign (#), when you see that type the following command exactly:
  3. fsck -fy

  4. Once fsck completes, if you see a “File system was modified” message, then you should run “fsck -fy” again until you see a message stating “The volume (name) appears to be OK” – this is standard procedure of using fsck
  5. Type “reboot” to leave Single User Mode and boot the Mac back into OS X as usual

Once OS X is booted again, it can be a good idea to confirm all is well by going back to Disk Utility and running the “Verify” tool to check on the drives health.

Keep in mind that if the ‘fsck’ tool continuously fails or reports errors and Disk Utility is a no go as well, the hard drive itself very well may be failing and on its last legs, so be sure to initiate a back up all of your critical data using Time Machine or your backup method of choice, and aim to get the drive replaced sooner than later.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS X, Tips & Tricks

29 Comments

» Comments RSS Feed

  1. jeniffer brolaney says:

    amazing!! thank you sooo much! i was so mad cuz i bought a used macbook from a private seller and she/he left it logged in. i couldnt download anything. i couldnt change anythiny. for heavens sake i couldnt even get in! anyways thanks! haha(:

    • Sarah Lambert says:

      Sorry to publish as a reply to Jeniffer, but I can’t see a way to post a standalone comment.

      I’m using fsck_hfs on an external unmountable disk which shows up in the Disk Utility but can’t be repaired there. The trouble is it’s bex drive and I don’t know if it’s completed as fsck gives no progress feedback. I loaded the log into a browser (var/log/fsck_hfs.log) and it says:

      /dev/rdisk3s3: ** Checking volume bitmap.
      /dev/rdisk3s3: Volume bitmap needs minor repair for orphaned blocks
      /dev/rdisk3s3: ** Checking volume information.
      /dev/rdisk3s3: Invalid volume free block count
      /dev/rdisk3s3: (It should be 231534230 instead of 232333870)
      /dev/rdisk3s3: Volume header needs minor repair
      /dev/rdisk3s3: (2, 0)
      /dev/rdisk3s3: ** Repairing volume.

      but there is no completion indication. When I try to close terminal, it says it will terminate the running process fsck_hfs. The console was showing 99% CPU usage by this process last night, but this orning it’s zero.

      Can I assume fsck is finished? How else would you know?

      Thanks for any useful information!

      • Roberto says:

        Scroll down past the other comments and there’s a giant standalone comment box. You sound very impatient, not good for running disk repair.

        Unless fsck has finished running, which it will indicate by ceasing running on it’s own, do not assume fsck is done running until it has finished running. Period. Your log clearly shows the volume needs repair, and that fsck is “Repairing volume” that means it is repairing the volume. Be patient, it can take a long time if the drive is large, slow, or failing.

        If you reboot in the middle of fsck running you can damage the disk and cause data loss. I hope you have a good backup handy.

  2. Dimitris says:

    That was easy. The Mac is telling you that once in S.U. Mode!
    The trick is how you find the partitions (names) you might have and fsck them.

  3. Mikko says:

    This was a splendid advice. I used it for a Yosemite system disk.
    The first run of fsck was disappointing:
    ** The volume Macintosh HD could not be repaired.
    *****The volume was modified *****
    But the second run was very promising:
    ** The volume Macintosh HD was repaired successfully.
    *****The volume was modified *****
    And the third run confirmed
    ** The volume Macintosh HD appears to be OK.
    Thank you very much!

  4. Himadri says:

    Thanks a ton…!!!

    This was really an excellent approach… worked for me on my Macbook Pro HD with lately upgraded to OS X Yosemite…I tried to fix the issue using Disk Utility, but it failed to repair the disk…Then I tried with ‘fsck -fy’ and the first time it showed it’s charm….!!!

  5. Allan Ferreira says:

    Fixed!!! Thanks

  6. olka says:

    Thanks, saved my day!

  7. Khnz says:

    Hi mate

    Can you help me out with my MacBook Pro? I try to boot fsck on my mac according to your suggestion when it failed to show the HDD. When I put fsck in, it said command not found. What should I do?
    Thank you

  8. Feno1 says:

    sbin/fsck -fy absolutely worked for me on MB Pro. Well done and thanks for sharing.

  9. Josh. says:

    Hi,

    I’ve had big problems with my macbook, there is no command line prompt after starting up with command S. The last line finishes with ‘errno 5′. I am also unable to start the computer in recovery mode or safe mode, it just gets to the grey mac loading page and stops with the bar half full but never finishes.

    Please any help.

  10. Gian says:

    I’ve been having permission problems since I upgraded my mid 2009 macbook pro with a ssd drive and 8gb ram a few months ago. However what I notice is that after ejecting my external HDD the permission problems reappear and I have to reinstall everything using safe boot and the last backup in time machine. Does anyone have any idea if the external HDD or the new ssd or ram creates the problem? Is something failing?

  11. Alli says:

    Help! I don’t know what to and how to fix my Mac. When I ran the Fsck -fy this is the message I got:

    Running fsck on the boot volume…
    ** Checking Journaled HFS Plus Volume.
    ** Checking extents overflow file.
    ** Checking catalog file.
    Keys out of order
    (4, 25167)
    ** Rebuilding catalog B-tree.
    ** This volume Macintosh HD could not be repaired.
    ***** FILE SYSTEM WAS MODIFIED *****

    I have ran it several times and i still get the message.

  12. Jessica says:

    I’ve bern trying this method, but having trouble. I get to the root# but then I cannot enter any text. Above that a few lines it reads “singleuser boot — fsck not done”. Am I just not giving it enough time to process? I let it run for fifteen minutes. I wasn’t sure what to expect.

    • Mat says:

      fsck scans your entire hard drive, it can take hours. If you don’t have the time to wait, take it to an Apple Store for repair.

  13. Mark says:

    Hi thanks for all the info here! My 09 MacBook pro was updated with a Samsung 512 SSD and 8 Gig memory, it didn’t take the install of Yosemite the first several times when I installed last fall, and now it will not start up, will not let me install back ups from a external drive, I tried disk utility and it says it can’t be repaired I ran a the above mentioned and it says the samething can’t be repaired and invalid volume file, volume directory, volume free block count, it gives the number it should be and the number it is. The volume HD could not be repaired Do you have any suggestions before I call Apple? Thanks!
    Mark

  14. Isabelle says:

    Hello!

    I’m having the same problem as Josh with my iMac:

    “there is no command line prompt after starting up with command S. The last line finishes with ‘errno 5′. I am also unable to start the computer in recovery mode or safe mode, it just gets to the grey mac loading page and stops with the bar half full but never finishes.”

    Can anyone help? Thanks!

  15. Mike says:

    Awesome. It’s fixed. :-) Thanks a million

  16. bettina b says:

    I’m getting the “file system modified” running fsck until I get “The volume Macintosh HD appears to be OK.” and finally, typing reboot and hitting return.

    still getting stuck at the restart screen when trying to turn on my MacBook though. It’s a 2006. You think this means my hardrive is just on its last legs then?

  17. John says:

    I had to install new SSD after HDD failed. How can I run from command line to fix HDD that I now have connected via USB?

  18. Bill Bamford says:

    Brilliant!! After wasting hours trying to get Disk Utility to fix my computer, and talking to Apple Help people in the USA (to no avail) your instructions worked perfectly.
    I’m very grateful

  19. maggie says:

    I tried fsck-fy it says command not found

    Tried sbin/fsck-fy and it says no such file or directory?
    I have a late 2009 imac updated the software and I cannot get it to boot at all, I got the same code 8 in disk utilities
    Anymore suggestions please

    • paul says:

      There needs to be a space between ‘fsck’ and the flag ‘-fy’ so the proper command is “fsck -fy”, not “fsck-fy”, the space in between characters is essential. Command line always requires precise syntax!

      You can also try:

      fsck -f

      If you want to have it more interactive.

  20. maggie says:

    Thank you!
    Re entered it and it’s scrolling really fast the same thing, it says:

    Disk0s2: media is not present.

    And it’s been scrolling that for quite a while, not sure is it should be doing that or how long it should be doing that for (been over an hour already) but fans blowing and mac is pretty hot?
    Any suggestions ?

  21. Simon says:

    I’ve tried both fsck -f and fsck -fy but keep getting that the ‘volume could not be verified completely. Bash-3.2#

    Any advice would be much appreciated thanks

  22. Joel M says:

    Thank you so much! I just ran this and it completely fixed the problems that Disk Utility kept reporting. I’m so glad to know I don’t have to replace my hard drive!

  23. Mary says:

    Hi there, I’m trying out this method now and I’m getting a lot of “invalid node structure” and “invalid record count” on the black and white command lines after entering the fsck -fy command in single mode. Is this normal and should I wait it out?

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates