24

Earlier today my 2009 iMac emitted I/O errors trying to copy files. So I ran disk utility, verify disk to see if anything was amiss. It was. But as it's my startup disk I couldn't repair it, so I tried safe mode. Safe mode worked the very first time, but when I rebooted it shows the progress bar filling up, before halting. Every time I turn it on now, the same progress bar then crash happens. Booting in verbose mode reveals fsck is failing with signal 8.

Using single-user mode, as that's as far as I'm aware the only way I can get any access to the system, I've been running fsck_hfs. However, it always fails. Below is the output from fsck_hfs -d /dev/disk0s2.

** /dev/rdisk0s2
        Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K.
** Root file system
   Executing fsck_hfs (version diskdev_cmds-491.6~3).
** Verifying volume when it is mounted with write access.
** Checking Journaled HFT Plus volume.
** Checking extents overflow file.
** Checking catalog file.
   Missing thread record (id = 9931104)
   Missing thread record (id = 16434146)
   Missing thread record (id = 19370458)
disk0s2: I/O error
hfs_swap_BTNode: offsets 10 and 11 out of order (0x0000, 0x0000)
   Invalid node structure
(4, 115897)
** The volume Macintosh HD could not be verified completely.
        volume check failed with error 7
        volume type is pure HFS+
        primary MDB is at block 0 0x00
        alternate MDB is at block 0 0x00
        primary VHB is at block 2 0x02
        alternate VHB is at block 1952491198 0x74622d5e
        sector size = 512 0x200
        VolumeObject flags = 0x07
        total sectors for volume = 1952591200 0x74622d60
        total sectors for embedded volume = 0 0x00

I absolutely need to be able to boot to use it as an external monitor.

10
  • Which OS X version are you running?
    – nohillside
    Commented Jul 15, 2012 at 14:12
  • Sorry, should have said. It's running Snow Leopard.
    – Max
    Commented Jul 15, 2012 at 14:28
  • 1
    If you still have an Install DVD you can boot from that and run Repair Disk.
    – nohillside
    Commented Jul 15, 2012 at 14:32
  • Never had an install DVD, it came pre-installed. I've been considering trying to burn one with this old laptop I dug out. I've also been considering DiskWarrior, is it likely to be able to fix it?
    – Max
    Commented Jul 15, 2012 at 14:35
  • 1
    And by "launchd'ing" i mean: launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist launchctl load /System/Library/LaunchDaemon/com.apple.DirectoryServices.plist I then did some other stuff, don't know if it was necessary, and then shutdown -h now, and when that didn't work, exit.
    – Max
    Commented Jul 15, 2012 at 14:52

5 Answers 5

5

About three years ago, I ran into the exact same problem you're having. The issue is with the hard drive itself--nothing software related. Take it to the nearest/best Apple repair store and have them replace your hard drive. You can then restore all of your information from your backup. You do back up your computer, don't you?

(Note: if you forgot to back up your computer recently or otherwise cannot access your old files, the repair shop will most likely be able to recover most, if not all, of your data. If the HDD is really badly damaged, however, you're best bet is to send it to DriveSavers for a cleanroom disassembly and data recovery. If you choose that option, however, be prepared to spend several hundred dollars.)

2
  • iFixit has DIY procedures for hard drive replacement. But you need an install DVD or USB stick, that you can borrow from a friend.
    – mouviciel
    Commented Jul 17, 2012 at 9:35
  • You're right, it was a malfunctioning hard drive as opposed to just dodgy entries in the filesystem. I do have backups, specifically Time Machine, but I ended up just using DiskWarrior to create a "preview" of the hard drive, cloning that to an external drive, and booting from the external drive. It's temporary until I get a chance to replace the internal hard drive, but all's working smoothly at the moment.
    – Max
    Commented Jul 21, 2012 at 15:10
15

You can try to force fsck_hfs to rebuild the catalog by running

fsck_hfs -Rc -d /dev/disk0s2

or (if you want to avoid having to answer the prompts)

fsck_hfs -y -Rc -d /dev/disk0s2

Of course this will only fix logical damages and keep failing if the disk itself is damaged.

4
  • 2
    I actually tried it with -r (-Rc doesn't seem to work). It gave the error "invalid node structure" always, and "invalid key length" only 75% of the time.
    – Max
    Commented Jul 15, 2012 at 14:32
  • This doesn't bode well :-(
    – nohillside
    Commented Jul 15, 2012 at 14:37
  • 1
    You saved my day!
    – Max
    Commented Dec 18, 2015 at 23:41
  • Running this command twice fixed my disk when Disk Utility couldn't. Although Disk Utility still reports errors on the filesystem, at least the volume mounted upon rebooting. Thanks!
    – ziggurism
    Commented Jun 18, 2017 at 16:10
8

I found this page via Google and am dropping this here. Suffering the same "invalid node structure" and refusal to boot, I was able to get past the grey screen and boot to my desktop using the following steps:

  1. Boot to single user mode (cmd + s on start)

  2. Mount the failing hdd

    /sbin/mount -uw /

  3. Exit single user mode by typing "exit" at prompt

  4. (Not sure if this step is necessary.) Press the on/off button once.

Doing the above booted my Macbook (running Snow Leopard) to the desktop, bypassing the failing fsck check and allowing me to run an up-to-date time machine backup. YMMV but I hope this helps someone.

3
  • 1
    This combined with the force fsck_hfs worked for me
    – rfabbri
    Commented May 16, 2016 at 18:29
  • 1
    The system may boot to the desktop with the above instructions and look normal, but the partition will likely still be corrupt and cannot be repaired. After the suggested time machine backup, restore from this time machine backup in recovery mode.
    – rfabbri
    Commented May 17, 2016 at 1:21
  • You are a life saver
    – spacetyper
    Commented Dec 28, 2017 at 16:32
3

As far as I can tell:

fsck_hfs -Rc -d /dev/disk0s2

…is not a valid command - the R should be r. So:

fsck_hfs -rc -d /dev/disk0s2

instead.

3
  • 5
    The man page for fsck_hfs (on 10.9 at least) says that -r is synonymous with -Rc.
    – mhucka
    Commented Apr 11, 2014 at 15:19
  • 3
    this should only be a comment to the other answer
    – rfabbri
    Commented May 16, 2016 at 18:30
  • 1
    this answer should definitely be deleted and written in as a comment into the original guy that suggested -Rc.
    – esaruoho
    Commented Jan 27, 2019 at 11:50
0

Just to clear this mess up:

-Rc -fd 

Prompts an error "illegal option --R", where usage should be:

b = physical blocks size
B path =file containing physical blocks numbers to map to paths
c size = cache size
E = exit on major error
d = output debugging info
f = force fsck
l = lkive fsck
m arg = octakl mode used
n = assume a no responsev p = just fixes normal inconsistencies
q = quick check
r = rebuild catalog btree
u = usage
y = assume a yes response

Using :

/sbin/fsck -fy /dev/disk1s2

just didi it for me now!

Hope this helps others too!

LAO

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .