I’ve had my poor man’s apple time capsule running for a little over six months now, and recently Time Machine started spewing errors.

I tried running a Disk Utility “repair” on the affected volume to no avail.  Something about an “invalid sibling link”.

Apparently, it doesn’t like it when you close your Macbook’s lid too many times during an active backup session.  (I do it all the time).

What to do what to do… ah, just fsck it.

Jthon wrote up a fscking awesome tutorial which mentioned to run fsck_hfs with the -rf parameters:

darkstar:~ horto$ cd /Volumes
darkstar:Volumes horto$ ls -lF
total 72
lrwxr-xr-x  1 root   admin      1 Apr  6 22:26 OSX@ -> /
drwxrwxrwx  1 horto  staff  16384 Mar 20 11:23 Volume_1/
drwx——  1 horto  staff  16384 Feb 12 12:32 Volume_2/
darkstar:Volumes horto$ cd Volume_2
darkstar:Volume_2 horto$ ls -lF
total 21166
drwx——  1 horto  staff     16384 Feb  9 20:38 backups/
-rwx——  1 horto  staff      1778 Feb 12 12:31 fun_plug*
-rwx——  1 horto  staff  10801937 Oct 18  2008 fun_plug.tgz*
drwx——  1 horto  staff     16384 Oct 27  2008 hackbook_001b639c705d.sparsebundle/
darkstar:Volume_2 horto$ hdiutil attach -nomount -readwrite hackbook_001b639c705d.sparsebundle
hdiutil: attach failed - Operation timed out

It failed.  Don’t know why.  Tried again and it worked immediately:

darkstar:Volume_2 horto$ hdiutil attach -nomount -readwrite hackbook_001b639c705d.sparsebundle
/dev/disk1              Apple_partition_scheme
/dev/disk1s1            Apple_partition_map
/dev/disk1s3            Apple_HFS

The sparse root bundle was mounted as /dev/disk1s3.  Mine is listed as an Apple_HFS volume, whereas Jthon’s is listed as an Apple_HFSX volume.  I’m not sure why, but it doesn’t seem to matter.

Anyhow, let’s fsck with it.  (Note:  The following command took quite a bit of time to run):

darkstar:Volume_2 horto$ fsck_hfs -rf /dev/disk1s3
** /dev/rdisk1s3
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Rebuilding Catalog B-tree.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
Incorrect number of thread records
(4, 32269)
** Checking multi-linked files.
Incorrect number of file hard links
** Checking Catalog hierarchy.
Invalid directory item count
(It should be 1802 instead of 1817)
** Checking Extended Attributes file.
Incorrect number of Extended Attributes
(It should be 918088 instead of 918080)
** Checking multi-linked directories.
** Checking volume bitmap.
** Checking volume information.
Invalid volume free block count
(It should be 54047184 instead of 54350738)
Volume Header needs minor repair
(2, 0)
** Repairing volume.
Indirect node 1701210 needs link count adjustment
(It should be 2 instead of 1)
Indirect node 1701232 needs link count adjustment

<…about 200 lines of this broken inode crap…>


** 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.
Volume Bit Map needs minor repair
** Checking volume information.
Volume Header needs minor repair
(6, 0)
** 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.
Volume Bit Map needs minor repair
** Checking volume information.
Volume Header needs minor repair
(6, 0)
** The volume flux_capacitor could not be repaired after 3 attempts.
darkstar:Volume_2 horto$

Uh oh…epic fail.

I spent the next little while tearing my hair out, cursing the fact that I might have to delete and re-create the sparsebundle again.

On a whim, the next morning I decided to try the process again.  To my surprise, when I came back I saw that it worked!

darkstar:Volume_2 horto$ fsck_hfs -rf /dev/disk2s3
** /dev/rdisk2s3
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Rebuilding Catalog B-tree.
** 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.
Volume Header needs minor repair
(2, 0)
** 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 flux_capacitor was repaired successfully.

Woah! All is good!  :)

I then detached the Volume:

darkstar:~ horto$ hdiutil detach /dev/disk2s3
“disk2″ unmounted.
“disk2″ ejected.
darkstar:~ horto$ umount /Volumes/Volume_2/
darkstar:~ horto$ ls -lF /Volumes/
total 8
lrwxr-xr-x 1 root admin 1 Apr 6 22:26 OSX@ -> /

And turned Time Machine back on, and clicked “Start backup now”. The backup completed successfully!

apple, time machine, time capsule, NAS, dns, 323, dns-323, time machine error, backup volume read only, reformat, wtf, fsck


5 Comments to “Fixing a corrupted Time Machine backup”  

  1. 1 Marc

    Hi,

    This 2nd time working thing is quite strange (on hdiutil attach and fsck)… As I’m experiencing the same pb on my MacBookPro 802.11G NAS TimeMachine, i’ll try your hint this evening !

    Thanks for sharing your experience !
    Marc

  2. 2 Cmos

    I intend to use ur excellent instructions to setup time machine w/ a DNS-323. After the fsck have you had any more problems? Also, if I configure Appletalk on the 323 nas will it work better/faster and will I be able to see the drive when booting from the osx DVD to do a bare metal restore?

  3. 3 Cmos

    Thanks dude, worked great!

  4. 4 Venky

    Didn’t work for me :( Any other way to repair?

    venky-s-macbook:Volume_1 venky$ hdiutil attach -nomount -readwrite venky-s-macbook_001ec2134cf7.sparsebundle
    /dev/disk2 Apple_partition_scheme
    /dev/disk2s1 Apple_partition_map
    /dev/disk2s2 Apple_HFS
    venky-s-macbook:Volume_1 venky$ fsck_hfs -rf /dev/disk2s2
    ** /dev/rdisk2s2
    ** Checking Journaled HFS Plus volume.
    ** Checking Extents Overflow file.
    ** Checking Catalog file.
    ** Rebuilding Catalog B-tree.
    ** The volume blue_backup could not be repaired.
    venky-s-macbook:Volume_1 venky$ fsck_hfs -rf /dev/disk2s2
    ** /dev/rdisk2s2
    ** Checking Journaled HFS Plus volume.
    ** Checking Extents Overflow file.
    ** Checking Catalog file.
    ** Rebuilding Catalog B-tree.
    ** The volume blue_backup could not be repaired.

  5. 5 Nozel

    I have a different problem. I recently shut down my DNS-323. After restart time machine doesn’t work. I don’t see the file in Finder either, but Timemachine says it’s there. When I check the Volumes in Terminal I see Volume_1-1 in stead of Volume_1. Any ideas how to fix that?

Leave a Reply