I recently bought a Time Capsule from Apple. This wondrous device’s basic function is to provide automated incremental wireless backups of all your Macs using Mac OS X Leopard’s Time Machine; it’s a fantastic invention that makes backing up so easy that perhaps now, finally, home computer users will start protecting their data. (Unfortunately people never seem to realise how valuable their information is until they lose all their baby photos or accounts.) It also provides fast wireless-n networking, Gigabit Ethernet on each of its 4 network ports, a USB2 port for wireless printing or wireless Network Attached Storage (NAS), IPv6, amongst several other features, and is generally an remarkable device.
Unfortunately, it’s not all roses. When the backups are working, it’s brilliant ? indeed, it’s backing up my laptop right now: I can just about hear it whirring away and the Time Machine icon in my menu is rotating ? but when you get the dreaded “Backup Failed” message, that’s when things get interesting?
The Time Capsule works by using a sparse image, which is a space-efficient disk image. (It’s actually a ‘Sparse Bundle’.) It mounts this automatically before it runs the backup, which is why you may notice a drive in the Finder called ‘Backup of (your machine name)’ when Time Machine is running, then unmounts it when it’s finished. Here’s where the errors can occur: if the network connection is broken while this image is mounted or if there’s an error writing data to it it can become damaged. Usually it’ll then refuse to unmount and will just sit there glumly in the Finder’s sidebar and on your Desktop while you try to eject it.
So here we are. Time Machine’s just informed you that
I’ve encountered this a couple of times now, too, and it’s hellishly annoying. I’m hoping Apple will make the Time Capsule’s backup procedure more robust, because as it stands it’s not good enough: most people will end up deleting the sparse image to get their backups working, which is unacceptable. However, it is possible to repair without any 3rd party utilities.
Here’s how to fix it:
Before we start, I strongly recommend connecting via gigabit ethernet rather that wirelessly as it’ll be much, much faster. Also, you need to know what you’re doing, if you’re uncomfortable running any of the below procedures you’d be better off getting help from an Apple Genius.
- Reboot the Time Capsule (either with Airport Utility, or by pulling the plug), as it always seems to have gone a little weird post-corrupted-sparseimage.
- On your Mac(s), turn off Time Machine until you’ve finished this repair.
- Connect to the Time Capsule’s Airdisk and find the duff sparseimage. (If you can’t do this, you may need to enable Disk Sharing using the Airport Utility first.
- Mount the sparseimage (by double-clicking). If it won’t mount, repair it as much as possible using Disk Utility (which will repair it a little, then fail. If you run it again, all subsequent attempts get partway through and crash). If you’re comfortable with Terminal, navigate to where the spareimage is located and run hdiutil mount -nomount -noautofsck -noverify -noautoopen yoursparseimagename
- Once it’s mounting, open up a Terminal. Type
diskutil list
and press return. It should produce something similar to this:
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *111.8 Gi disk0
1: EFI 200.0 Mi disk0s1
2: Apple_HFS Stef 111.5 Gi disk0s2
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: Apple_partition_scheme *463.8 Gi disk2
1: Apple_partition_map 31.5 Ki disk2s1
2: Apple_HFSX Backup of Stef's Laptop 463.8 Gi disk2s2
Notice how the Time Capsule is /dev/disk2 and the sparseimage is disk2s2
Right, we want to repair this sparseimage. From the Terminal, run fsck_hfs -r /dev/disk2s2
making sure to replace the disk2s2 part with whatever was listed when you typed the above step.
fsck will now run on the sparseimage and should repair it without crashing (unlike Disk Utility). It’ll run through and repair, then run another pass to confirm the repair. This will take a good while, in the order of 2-3 hours using gigabit ethernet. If you must use wireless, run it overnight as it’ll probably take 6 hours or more.
The output will be similar to this:
** /dev/rdisk2s2
** Checking Journaled HFS Plus volume.
** Detected a case-sensitive catalog.
** Checking Extents Overflow file.
** Checking Catalog file.
** Rebuilding Catalog B-tree.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Detected a case-sensitive catalog.
** Checking Extents Overflow file.
** Checking Catalog file.
Incorrect number of thread records
(4, 30440)
Incorrect number of thread records
(4, 30440)
** Checking multi-linked files.
Incorrect number of file hard links
** Checking Catalog hierarchy.
Invalid directory item count
(It should be 40301 instead of 40302)
Missing thread record (id = 3043439)
Invalid directory item count
(It should be 0 instead of 1)
** Checking Extended Attributes file.
Incorrect number of Extended Attributes
(It should be 1797762 instead of 1797752)
Incorrect number of Access Control Lists
(It should be 1793798 instead of 1793788)
** 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 99681536 instead of 99959337)
Volume Header needs minor repair
(2, 0)
** Repairing volume.
Previous ID in a hard link chain is incorrect (id = 1867367)
(It should be 0 instead of 1968526)
Invalid first link in hard link chain (id = 1296542)
(It should be 1867367 instead of 3043451)
Next ID in a hard link chain is incorrect (id = 1867367)
(It should be 1968526 instead of 0)
Previous ID in a hard link chain is incorrect (id = 1968526)
(It should be 1867367 instead of 2148720)
Next ID in a hard link chain is incorrect (id = 1968526)
--- edit, removing hundreds of similar lines ---
Invalid first link in hard link chain (id = 3031389)
(It should be 3041877 instead of 3043456)
Indirect node 3031389 needs link count adjustment
(It should be 1 instead of 2)
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Detected a case-sensitive catalog.
** 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 Backup of Stef's Laptop was repaired successfully.
You can now turn Time Machine back on on your Mac. Run a backup and it should now work again. Phew.
Hope that helps!
Leave a Reply