Fix Time Machine Sparsebundle Network Backup Errors

[UPDATE – The post below is mostly for people using a USB hard drive attached to an Airport Extreme – if your sparsebundle is on a network drive or NAS, please see my modified post here.]

I use an external hard drive attached via USB to an Airport Extreme N for my Time Machine backups. This effectively works for the four household computers.

Occasionally though, things go wrong – very wrong. You will be stuck with ‘Making Disk Available’ or ‘Invalid Sibling Link’ … but there is a fix.

Another error you may see is “Time Machine completed a verification of your backups. To improve reliability, Time Machine must create a new backup for you.” This can also be fixed by following the below.

First, disconnect the external disk from the Airport Extreme and attach to your Mac via Firewire (or USB).

At the top level of the drive are the various sparsebundles that make up your individual computer backups.

Do not double click on these sparsebundles or try to repair with Disk Utility.

We are going to use the same underlying tools as Disk Utility but from the command line.

Second, open Terminal and then switch to root by typing

sudo su -

and then enter your password. Now type

hdiutil attach -nomount -noverify -noautofsck /Volumes/{name of your disk}/{name of}.sparsebundle

You will then see something like

/dev/diskx Apple_partition_scheme
/dev/diskxs1 Apple_partition_map
/dev/diskxs2 Apple_HFSX

Where x is the disk id for the external disk. You are interested in the one labeled Apple_HFSX or Apple_HFS. It might be 2, 3, 4 or higher.

Depending on the state of the disk, the filesystem check might run anyway. If you see or hear disk activity after running this command, just wait for it to finish, or type

tail -f /var/log/fsck_hfs.log

and wait until you see it give up. Type Control-C to exit the tail command.

Now type

fsck_hfs -drfy /dev/diskxs2

Make sure to replace x with whatever number your disk is from the output above.

The letters “drfy” tell the filecheck utility different things. d for ‘Show Debug’ – r for ‘Rebuild Catalog Tree’ – f for ‘Force’ and y for assume ‘yes’ to any prompts.

Now go do something for an hour or two. When you come back the last output you will see is

‘The Volume was repaired successfully’

Now you need to type

hdiutil detach /dev/diskxs2

You can redo the above for any other Time Machine sparsebundles while you have the disk attached to your computer, or now you can eject the external disk from your computer the normal way and re-attach the external disk to your Airport.

One final thing. Since 10.6.3, Time Machine will verify backups and if a problem is found will prompt you to erase the old backup and start a new one. The above procedure will recover the backup. You need to do a couple things first.

1. The sparsebundle will be locked, and you cannot unlock it from the Finder. Once again, as root from the command line type

chflags -R nouchg /Volumes/{name of your disk}/{name of}.sparsebundle

If the sparsebundle failed verification, it was also renamed to the date of verification failure. You can rename it with the command line as well

mv /Volumes/{name of your disk}/{name of}_YYYY-MM-DD.sparsebundle /Volumes/{name of your disk}/{name of}.sparsebundle

Then proceed as above. When complete, you need to edit an plist file within the sparsebundle that records the state of the backup. On the top level of the sparsebundle find a file called com.apple.TimeMachine.MachineID.plist. Edit it and remove these two nodes

<key>RecoveryBackupDeclinedDate</key>
<date>{whatever-the-date}</date>

Finally you want to change

<key>VerificationState</key>
<integer>2</integer>

to

<key>VerificationState</key>
<integer>0</integer>

Now you can reconnect the drive to your Airport Extreme and start up Time Machine. It will do a Verification and then proceed with backups as normal.

68 thoughts on “Fix Time Machine Sparsebundle Network Backup Errors

  1. After the third line the Output somewhere says “BTree rebuild requested but writing disabled”, is that normal???

Comments are closed.