Invalid node structure under Mac OS X 10.5 Leopard

So my Finder froze up today during a Time Machine backup operation.  After trying several standard tricks to get my Finder back, I finally rebooted.  Upon rebooting, Timebook, my Time Machine drive, wasn’t mounting.


This wouldn’t have made me so nervous, but my iMac had a drive freak out about two months ago, and I had to recover fully from a Time Machine backup.  So there was a better chance than not that both could die on me if I didn’t get this fixed soon enough.

Upon running Disk Utility, I received the always hair-raising Invalid Node structure.

From the logs;

Apr  7 10:39:19 magneto Disk Utility[456]: Invalid node structure^[
Apr  7 10:39:19 magneto Disk Utility[456]: Volume check failed.
Apr  7 10:39:19 magneto Disk Utility[456]: Error: Filesystem verify or repair failed.
Apr  7 10:39:19 magneto Disk Utility[456]:
Apr  7 10:39:19 magneto Disk Utility[456]: Disk Utility stopped verifying “Timebook” because the following error was encountered:\n\nFilesystem verify or repair failed.
Apr  7 10:39:19 magneto Disk Utility[456]:
Apr  7 10:39:24 magneto Disk Utility[456]: Verify and Repair volume “Timebook”
Apr  7 10:39:24 magneto Disk Utility[456]: Starting repair tool:
Apr  7 10:39:24 magneto Disk Utility[456]: Checking Journaled HFS Plus volume.
Apr  7 10:39:24 magneto Disk Utility[456]: Checking Extents Overflow file.
Apr  7 10:39:24 magneto Disk Utility[456]: Checking Catalog file.
Apr  7 10:41:02 magneto Disk Utility[456]: Invalid node structure^[
Apr  7 10:41:02 magneto Disk Utility[456]: Volume check failed.
Apr  7 10:41:02 magneto Disk Utility[456]: Error: Filesystem verify or repair failed.
Apr  7 10:41:02 magneto Disk Utility[456]:
Apr  7 10:41:02 magneto Disk Utility[456]: Disk Utility stopped repairing “Timebook” because the following error was encountered:\n\nFilesystem verify or repair failed.

When you do a Google search, some sites suggest using the command line utility fsck_hfs with the -y option (assume Yes to every question.. if you run an fsck on a damaged filesystem you’ll usually see why this is a good idea).  That didn’t work for me, it would just crap out again the same way Disk Utility had.  What DID work was the following.. (after a sudo su –)

# fsck_hfs -rf /dev/disk1s3

Now, a lot of people suggest Diskwarrior to fix this problem.  I agree this is probably a good idea for Mac disk maintenance tasks.  The problem; Disk Warrior is $99 USD, and I’m cheap.  Hell, the Timebook was on or about $99 USD.  Disk Warrior will have to wait, but I will likely invest in it in the future.

After I ran the fsck command with the -f flag (to force fsck to check `clean’ filesystems when preening.. don’t ask me how or why this works over a -ry) the drive was mountable from Disk Utility. The first Time Machine run had this error in the console though, but I think it’s harmless.

Apr  7 19:13:02 magneto /System/Library/CoreServices/backupd[1000]: Starting standard backup
Apr  7 19:13:03 magneto /System/Library/CoreServices/backupd[1000]: Backing up to: /Volumes/Timebook/Backups.backupdb
Apr  7 19:13:07 magneto /System/Library/CoreServices/backupd[1000]: Event store UUIDs don't match for volume: Macintosh HD
Apr  7 19:13:07 magneto /System/Library/CoreServices/backupd[1000]: Node requires deep traversal:/

Here’s the full text of the command output below, for reference;

magneto:~ root# fsck_hfs -rf /dev/disk1s3
** /dev/rdisk1s3
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Rebuilding Catalog B-tree.
   Invalid node structure
(4, 75586)
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
   Incorrect number of thread records
(4, 32659)
** Checking multi-linked files.
   Incorrect number of file hard links
** Checking Catalog hierarchy.
   Invalid directory item count
   (It should be 1178851 instead of 1178880)
** Checking Extended Attributes file.
   Incorrect number of Extended Attributes
   (It should be 1690486 instead of 1690462)
   Incorrect number of Access Control Lists
   (It should be 1690472 instead of 1690448)
   Invalid leaf record count
   (It should be 3699221 instead of 3699235)
** Checking multi-linked directories.
   Incorrect number of directory hard links
** Checking volume bitmap.
   Volume Bit Map needs minor repair
** Checking volume information.
   Invalid volume free block count
   (It should be 36497060 instead of 29689387)
   Volume Header needs minor repair
(2, 0)
** Repairing volume.
   Orphaned file hard link (id = 8785918)
   Orphaned file hard link (id = 8785919)
   Orphaned file hard link (id = 8785920)
   Orphaned file hard link (id = 8785921)
[[ message repeated etc ...]]
   Orphaned file hard link (id = 11098150)
   Invalid first link in hard link chain (id = 11995430)
   (It should be 12024532 instead of 12023278)
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking multi-linked files.
** Checking Catalog hierarchy.
** Checking Extended Attributes file.
   Invalid map node
(8, 61440)
** Checking multi-linked directories.
** Checking volume bitmap.
** Checking volume information.
** Repairing volume.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking multi-linked files.
** Checking Catalog hierarchy.
** Checking Extended Attributes file.
** Checking multi-linked directories.
** Checking volume bitmap.
** Checking volume information.
** The volume Timebook was repaired successfully.

Update: Jan 4, 2010 – While doing some digging, I found this article at Jthon’s Place that describes how to fix a corrupted Time Machine backup.  NICE!

  1. Fantastic! I’ve no idea what you’ve done here – I don’t understand it – but I followed what you’ve done and it sorted my Mac. You’re a legend – many thanks for posting!!!

  2. I concur…you are a genius….wish I had seen this before I wasted $108 on DiskWarrior with no +ve “results”. My Startup drive gave up with “Invalid node structure”. Your instructions saved the drive and my investment.

  3. Thanks for the kudos, fellas! I posted this with the intention of saving people from losing hair (after this problem caused me to rip some of mine out!) and I’m glad to hear it’s helping :)

  4. Let me add my thanks for a happy ending to a worrying few hours.

    In my case, the symptom was Migration Assistant hanging (or at least taking forever) while performing its initial scan of my old Intel Macbook Pro running 10.4, in preparation for migration to a new Macbook Pro running 10.5. I tried both Disk Utility and the old fsck -yf incantantion, and received the infamous “Invalid node structure” message. I followed your recipe to the letter (except that my problem was with the root filesystem /dev/disk0s2) and the corrupted catalog info was automagically repaired as above. Migration Assistant then worked flawlessly.

    So with the customary wisdom of hindsight, my advice to the paranoid is: before running Migration Assistant, do a full backup of the old machine, then run Disk Utility to make sure there are no subtle problems with your main filesystem before invoking Migration Assistant. Many thanks once again!

  5. Great information…i wish i was smart enough to understand it. i wonder if you might know where i can find it translated into a dumbed-down english version for those of us that love our macs b/c they’re EASY – NOT b/c we’re cool. thank you 😉

  6. Question: What if you want to run that on an external disk? How do you specify which disk to run that repair on? It actually was a boot disk from another mac that completely failed (that is, the mac failed (motherboard, I think), but the drive seems mostly alright. I’d like to recover it so I can salvage that dat from that drive.


    • @jon: Running it on an external drive is what I did too; I found the Disk Identifier by opening Disk Utility, clicking on the busted drive (which still should show up in Disk Utility even if it does not mount) and hitting the Info button at the top. So your external drive, if it’s the only external drive you’re plugging in, will likely show up as;

      Disk Identifier : disk1

      Which means on the command line you’ll be using /dev/disk1s3. The part where “s3″ starts specifies a BSD style disk slice (it’s the BSD version of a partition). You could also try s1, s2, etc instead.

      There is likely a more artful way of finding that information out, if I can figure that out I’ll certainly update this article.


  7. To chime in with my experience, doing ‘fsck_hfs -rf /dev/rdisk0s2′ (from the Terminal, after booting with to the install DVD) resulted in “cannot repair drive after 3 attempts’. However, it *did* repair enough of the drive that running Disk Utiiity’s “repair” afterwards was successful. Before running ‘fsck_hfs -rf’, Disk Utility not only couldn’t repair the drive, but also couldn’t verify it.

    I ended up having to reinstall Mac OS X (archive and install) to get my Mac to actually boot, but that’s no big deal, and all my files seem to be just fine. Sure beats completely wiping the drive.

    Thank you for posting your ‘fsck_hfs -rf’ tip. Although it didn’t solve my problem directly, it still saved the day.

  8. This post saved my day too! Thanks!

    Regarding Jon’s question about finding the disk identifier, one can run this command in Terminal:

    diskutil list

    Which will output something like this:

    0: GUID_partition_scheme *465.8 Gi disk0
    1: EFI 200.0 Mi disk0s1
    2: Apple_RAID 465.4 Gi disk0s2
    3: Apple_Boot Boot OSX 128.0 Mi disk0s3
    0: GUID_partition_scheme *465.8 Gi disk1
    1: EFI 200.0 Mi disk1s1
    2: Apple_RAID 465.4 Gi disk1s2
    3: Apple_Boot Boot OSX 128.0 Mi disk1s3
    0: GUID_partition_scheme *232.9 Gi disk2
    1: EFI 200.0 Mi disk2s1
    2: Apple_RAID 232.6 Gi disk2s2
    3: Apple_Boot Boot OSX 128.0 Mi disk2s3
    0: GUID_partition_scheme *232.9 Gi disk3
    1: EFI 200.0 Mi disk3s1
    2: Apple_RAID 232.6 Gi disk3s2
    3: Apple_Boot Boot OSX 128.0 Mi disk3s3
    0: Apple_HFS MediaBKUP *930.9 Gi disk4
    0: Apple_HFS Serveur *232.6 Gi disk5
    0: GUID_partition_scheme *465.8 Gi disk6
    1: EFI 200.0 Mi disk6s1
    2: Apple_RAID 465.4 Gi disk6s2
    3: Apple_Boot Boot OSX 128.0 Mi disk6s3
    0: GUID_partition_scheme *465.8 Gi disk7
    1: EFI 200.0 Mi disk7s1
    2: Apple_RAID 465.4 Gi disk7s2
    3: Apple_Boot Boot OSX 128.0 Mi disk7s3
    0: GUID_partition_scheme *465.8 Gi disk8
    1: EFI 200.0 Mi disk8s1
    2: Apple_RAID 465.4 Gi disk8s2
    3: Apple_Boot Boot OSX 128.0 Mi disk8s3
    0: GUID_partition_scheme *465.8 Gi disk9
    1: EFI 200.0 Mi disk9s1
    2: Apple_RAID 465.4 Gi disk9s2
    3: Apple_Boot Boot OSX 128.0 Mi disk9s3
    0: GUID_partition_scheme *931.5 Gi disk10
    1: EFI 200.0 Mi disk10s1
    2: Apple_HFS BKUP 931.2 Gi disk10s2
    0: Donnees *930.9 Gi disk11
    serveur01:~ adminti$

  9. I have never been motivated enough to reply to a posting before…ever…but this saved my bacon!! Doing ‘fsck_hfs -rf /dev/rdisk0s2′ (in safe mode) resulted in “cannot repair drive after 3 attempts”. Regardless, the system still rebooted without any issues. I am currently updating my backup via time machine! As noted above I don’t have any idea what these command lines do…but they work!

  10. This post and everyone’s contribution was excellent! This was much better than any apple posts that i was able to find.

    Fredeni, your post about creating the list was excellent as it allowed me to see what i needed to put in my command. Note that it is the disk that has HFS in it’s description indicates the disk you want to use.

    I had to run the command 5 times before it finally repaired my disk completely. The first 3 times, it gave me the message that it could not repair my disk, the 4th time i got the message “cannot repair drive after 3 attempts” and the 5th time it told me that the disk was repaired. I did a verify disk from the disk utility and that gave me the clean bill of health. I am still wondering how reliable the disk will be now that it is repaired, but at least i can do a final back up. What do you think, how reliable is a disk once it is repaired.

    For those that are interested, i did find this link which tells you a bit more about the command function that is proposed here:

    I am not going to pretend that it cleared it all up for me, but at least gave me a bit more background as to the process. This is what convinced me that i should run the process several times.

  11. Thank you all so much for this information. I kept getting the dreaded spinning beachball while using my new MacBook. DiskUtil revealed error messages about “invalid node” and “invalid sibling link” errors. I ran DiskUtil from the Mac OSX disc several times, and the program would report that the volume was repaired, but then the errors would return a day or two later.

    I took your advice today; from the terminal program in the utilities folder, I typed in “diskutil list” and learned that my HFS files are on disk0s2. I then booted in safe mode (Command-S) during startup and ran

    #fsck_hfs -rf /dev/disk0s2

    Fsck_hfs revealed several errors and resolved them; I then ran DiskUtil again and it also found errors and reasolved them. I then ran fsck_hfs again, and more errors (though fewer in number) were resolved. My final run of DiskUtil revealed no errors this time.

    I’m hoping I’m out of the woods now. I’m pretty sure all these problems came from unpacking an RAR file that was corrupted. It hung up my Mac and I had to do a hard boot. The problems surfaced soon after.

    Thanks again for your input. I decided to write up my experience here for others searching on those error messages.

  12. I’ve been trying all sorts of suggestions out, but when I try to access the space where my external hard drive gets weird, permission is denied. Does anyone know how I can get past that? thanks:

    fsck_hfs -rf /dev/rdisk0s3
    Can’t open /dev/rdisk0s3: Permission denied
    Macintosh-4:~ kerry$

    • Oh, Kerry, you have to “sudo” to the privileged user.

      So the full command, from the shell, would be;

      “sudo fsck_hfs -rf /dev/rdisk0s3″

      It will prompt you for your password, and from that you should be rolling.

  13. I have got Windows as well on my Macbook (using refit), a few days back apparently Macdrive Software evaluation version expired and after that I was unable to boot into Mac. Inserting the Boot Disk gave the infamous invalid node structure message with Disk UItility unable to verify the disk. You command seems to be working so far – it is repairing the volume (disks1 in my case which I figured by trial and error, saw the diskutil command in one of the comments afterwards..). It has detected missing directory record which seems to be the only one that is different from your output. Fingers crossed..Hoping that it would save my day as well as it has done for fellow commenters!

  14. Sorry that was disk0s1 above. It says now that the Volume cannot be repaired after 3 attempts. am gonna try using Disk Utility now and see if it can verify the disk!

  15. Fantastic. This saved me a load of heartache. Thank you.
    i had to run fsck_hfs -rf 4 times (in safe mode) in total to clean up the file system, and I wouldn’t have known that running it more than once would help without some of the comments above.

  16. I have never posted to a website before but I must say AMAZING!! why this isn’t posted on every board where people are having this problem is a shame. This worked fantastic!!!! I ran it the first time and it said it could not repair so I just ran it a second time and repair succeeded!!! Then I ran a fsck -yf just to make sure it was clean and it comes up “The volume Macintosh HD appears to be ok. Rebooted and everything is back to normal. YOU ARE MY HERO!

  17. It’s Christmas Day and my iMac developed the “invalid node” issue. At startup a bar appears at the bottom, twice, but before it gets “filled up” the iMac switches off. Trying to boot from the OS X install disk and then Disk Utility revealed the “invalid node” problem. I can only boot into Bootcamp and use Windows (Isn’t it ironic?) Safe mode does not work. Question: how do get to Terminal in this situation? Many thanks.

    • I’d grab the 10.5 disks; either your install disks or a copy of Leopard. You can boot into Leopard (I think) by inserting the CD, rebooting, and holding down C.

      From there, a terminal should be one of the tools available for you to use. As always, use caution when doing this procedure. Measure twice cut once.

  18. I wish this would help, but it wont work for me. I had a power outage and my g4 wouldnt boot. Managed to track the problem down to “invalid leaf record count” error. Despite running 1st aid and fsck -fy and getting a repaired drive message, it still wont boot sucessfully. I’ve tried several permutations/combinations of your command line with no luck. Heres what I see after running disk util list;
    #: type name size identifier
    0=apple_partition_scheme *26.6gb disk0s0
    1=apple_partition_map 31.5kb disk0s1
    2-apple_driver43 28.0kb disk0s2
    3=apple_driver43 28.0kb disk0s3
    4=apple_driver_ATA 28.0kb disk0s4
    5=apple_driver_ATA 28.8kb disk0s5
    6=apple_FWDriver 256.0kb disk0s6
    7=apple_driver_IOkit 256.0kb disk0s7
    8=apple_patches 256.0kb disk0s8
    9=apple_hfs Tiger 26.4gb disk0s10
    After running your command line I get this message;
    Usage: fsck_hfs [-dfl m[mode]npgruy] special device
    d= output debugging info
    l= live fsck (lock down and test only)
    m arg= octal mode used when creating lost+found directory
    n= assume a no response
    p= just fix normal inconsistencies
    q= quick check returns clean dirty or failure
    r= rebuild catalog btree
    u= usage
    y= assume a yes response
    I presume the above are the selection of choices I have, but i’ve no idea how to properly writ the command line. Hopefully i’ve given you the info you require to help me out of this jam.
    With gratitude,

  19. This is fantastic!

    Stellar recovery was a total waste of time, took a whole day then crashed, they sent me a new version which also took a day to index. I then had 3x instances of the volume, which I could not recover from. I also had to wrestle to get the money back guarantee, the VISA transaction was not a refund, rather a reverse transaction; VISA deducted 2x fees from me :(

    I ran the command 1x, it stated volume could not be repaired after 3 attempts. I then used Disk Utility for 100% result.

    Thank you very much for the post.

  20. Simon. I had tiger 10.4.1 on my hard drive before the crash. So far, the only dvd i’ve been able to obtain is 1 for a 15 inch g4 powerbook with version 10.2.3. dvd version1.0 I’ve been able to run disk 1st aid from the dvd as I mentioned.
    I even tried removing the problematic hd and installing it as a slave in this mac , but I couldnt get any results, as i’ve never done it b4, and after multiple jumper settings gave up.
    If I were to try installing this older version, what are the odds it would work? I presume all my photos and desktop folders would be lost in the overwrite?
    Thanks much for the help, it means a lot that you’ve taken time out of your holidays to answer, should you ever find yourself in Ottawa, and needing a bike(s) to ride around, i’d be happy to provide them.

    • @rick – Personally I wouldn’t revert back to 10.2.3, I don’t think that’ll get you good results. If you re-install with 10.2.3 you’ll also likely have to reformat the drive, so you’ll lose the data.

      As a real hail-Mary pass if you can get access to a Mac with 10.5 or 10.6 and a drive enclosure you can recover it that way; by extracting the drive and hooking it up via USB to another functional host. I was just at an Apple store, I should have checked to see if I could get access to a terminal from the demo machines (although I envision myself being “escorted out” in that scenario 😉 )

  21. I have similar problems to those listed by previous responders…but when I try and run the fsck_hfs command I am informed that my drive is still mounted. I try and unmount it using the “unmount” command (gathered from somewhere else on the web) and I get a “command not found” message. I seem to be stuck. Help!

    • @peter; The command you’re looking for is umount.

      usage: umount [-fv] [-t fstypelist] special | node
      umount -a[fv] [-h host] [-t fstypelist]

      You may have to do a umount -f on the drive in question.

  22. Well, I have hit this problem twice. First time I hadn’t found this blog entry. I have run the command multiple (>1 dozen) times, including with the -d parameter to see what the errors are, but I have had zero luck. I am heading to the apple store later today after I spin by my office to grab my time machine backup. Key reason for posting here is to pose a question about a trend, though the two times that this has happened to me don’t exactly make a statistically significant sample.

    This condition has happened twice for me. Both times was just after returning from a trip. Key aspects of my trips:
    Time zone changing – I adjusted timezones on my computer to reflect my destination and returned the timezone upon my return.

    Now, I have made this trip repeatedly in between failures, but it may be worth noting.

  23. You are the man!

    My wife came up to me today and said “I think the mac has some problems…” fsck -fy no love.
    fsck_hfs -rf /dev/disk0s0 and all was good with the world.

    Had a jungledisk backup to fall back on, but it made me super happy to be able to have the mac book back up.

  24. What if the disk not mounting is the Start Up disk? I tried running this but it say:

    “the volume XXX cannot be repaired when it is in use”

    I tried booting from the Installation DVDs but then it wont allow me to run “sudo”…

    Any advice?

    Thanks in advance!!

    • I’m going to have to try this when I get home; if you’ve got a shell prompt with a “#” in it, you’re already root (the administrative user) so you won’t have to sudo.

  25. This is like the feel good post of the decade. So many catastrophes avoided. I am thankful to have found this post. I happy to report:
    ** The volume Macintosh HD was repaired successfully.
    A collection of insight from the post author and all the commenters’ has made this issue go away peacefully.

    FYI: I used fsck_hfs -rf dev/disk1s2, while booted from the 10.5 install DVD. The command output read almost same as authors in post. Total time for command to complete was about 30 min.
    Thanks everyone!

  26. Worked for me too. Had a friend whose iMac wouldn’t boot. She took it to the Apple Store, was told the hard drive died. She was under AppleCare, so they replaced the hard drive.

    Asked her to get the old hard drive back from Apple. She didn’t have a current backup.

    Plugged her old drive into my USB Drive Dock. Wouldn’t mount. Disk Utility and Drive Genius came up with the Node Error.

    Googled it – most links said to use DiskWarrior. Didn’t want to spend $99.

    Kept searching and came across the fsck command. Googled that and found this post.

    Ran diskutil info to get drive info. Ran fsck_hfs command – “Could not be repaired after three attempts”. Ran Disk Utility. Disk repaired. Was able to mount.

    Only four files were corrupted – two photos and two songs.

  27. Please help me, I am running a macbook 10.5.8 and I have the invalid node structure problem, this is all a bit technical for me, can someone please give me an idiots guide to running this wonderful script. I wasted 99 dollars on diskwarrior with no success. My hard drive is playing up and disc utility wont fix it. if someone could tell me how to bring up the prompt to run the command and the exact command I need to enter that will really help me.

    I hope someone has the time to guide an old timer like me.

  28. After a bit of trial & error, I successfully repaired my main volume. I first booted with the OS X install disk and went into Terminal from there, with no results. I then booted into safe mode and did the “fsck” from there… it worked! Needless to say, I owe you my life! Thanks so much for sharing this! Oh, and by the way, my Mac Book Pro is now ten times faster than it was before… I mean, it’s like new again! Thanks!

  29. THANK YOU!! You are a true saint! I had an issue with a failed install of MS Office 2011 on my MBPro and it blew out my OS X partition. All I was left with was the Boot Camp partition Windows 7 (which led straight to a BSOD). the OS X install disk just churned away and failed so I created a Das Boot flash drive (and still had to boot that in single-user mode) and spent hours trying to use fsck -fy and fsck_hfs -fy Nothing was working and I was just inches from wiping the hard drive and starting over. Your post saved me much heartache and a great deal of lost data. THANK YOU!!

  30. All I can say is thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you! Almost lost 10,000 photos (the backup drive failed as well) and couldn’t afford Disk Warrior (spent it all on christmas gifts). This worked like a dream. Why in all of the internet is yours the only one with a solution? Tell me, are you really just a techie guardian angel in disguise.

  31. Tried this and it gives “(NO WRITE)” and then it says “The Macintosh HD was found corrupt and needs to be repaired.”
    It does nothing else, so this is usless for my “invalid node structure” error. Using 10.6.5.

Leave a Reply