Disk I/O Errors - all hail the Internets and powerful unix tools
In case some other unlucky soul gets the same problem, here’s a writeup of what and how, and the fix that worked for me.
Having kernel[0] I/O Error on disk0s2, Invalid key length messages in the syslog of my MacBook, and a beyond sluggish and barely running system because everything else was waiting for failing disk I/O, here’s what I did to recover:
- 1) Boot into single user mode by pressing cmd-S on boot
- 2) Run /sbin/fsck -fy to check and try to repair the filesystem. When it fails, it will give you a basic diagnostic.
(The options: f is for forcing the check even if the system itself thinks it’s ok, -y is for attempting to repair any errors found without questions (Man fsck)
Here’s the fun stuff I got:
Invalid key length, and then on a second run, Invalid node structure. Fun times.

Some more googling on the “Invalid node structure” from my iPhone led me to a tip in this thread on macosxhints.com: A DIY solution to an invalid node structure problem. (always read down and go through the comments on posts like these, the proposed solution in the initial post is seldom the only or best trick)
- 3) Run /sbin/fsck_hfs -ypr /dev/disk0s2 where disk0s2 is the partition your previous log messages and fsck-runs are reporting the errors.
(The r option rebuilds the catalog file if there is space, the p option auto-fixes some simpler errors on the filesystem. y again is an automatic yes to any attempt to repair encountered errors. (Man fsck_hfs)
This run told me the node structure needed minor repair, which was carried out.
- Run /sbin/fsck -fy again
…and pray that like for me, it now ran without errors, ending with the comforting message “The drive seems to be OK”.
Thanks to some patience, some google skills and a basic understanding about harddrives and how data is organised (thank you DSV), I did not need install disks, a reinstall, a new hard drive or days of lost worktime and possibly lost data. Sweet!
Some thoughts after his little exercise:
- Tailing syslog on my desktop with Geek Tool is a really good idea. Even when other apps don’t start, I can glance at the log and get some hints and warnings about the state of my system.
- Wow the iPhone is a godsend when stuff like this happens. Having it ready to google for solutions when the laptop is not responding is really something that has solved similiar problems for me many times. It’s like a second computer. I’ve ssh:ed into my old machine that had graphics problems, googled for tons of good stuff to solve problems, and could also whine about my horrors on Twitter. Who needs a netbook?
If anyone wants to fill in the details of the how and why of fsck and why the fsck_hfs worked, feel free to comment.

