Fixing corrupt Time Machine Sparsebundles

I use Time Machine on my MacBooks as part of my backup plan. However, it backs up over the wireless network to an external USB drive on my Mac Pro, and¬†occasionally¬†there are problems. A couple times now, I’ve gotten an error where Time Machine says it cannot back up because the drive is read only. When you look through the logs, you see that the drive is read only because the sparsebundle is corrupt.

I tried running Disk Utility on the image, but it fails out with an “Invalid Sibling” error. Upon further research, I found this:

Here’s an overview of the steps:

Turn off Time Machine!

Next, you must attach the sparsebundle without mounting it.

hdiutil attach -nomount -readwrite Bhaal_0011247e3338.sparsebundle

This process took quite awhile for my 200GB image. Next, We need to run fsck_hfs on the sparsebundle. You will want to replace “disk1s2” with the disk number in the result of hdiutil.

fsck_hfs -rf /dev/disk1s2

Now, fsck_hfs took FOREVER. Literally around 24 hours. But, when all was said and done, it all worked again, and it sure beat having to start the backup over on my MacBook.