Skip to content

Instantly share code, notes, and snippets.

@Mossuru777
Last active April 10, 2019 02:55
Show Gist options
  • Save Mossuru777/eb2c2438f7aada54088b to your computer and use it in GitHub Desktop.
Save Mossuru777/eb2c2438f7aada54088b to your computer and use it in GitHub Desktop.
Repair TimeMachine Backup

Repair TimeMachine Backup

  1. Mount TimeMachine volume from Finder.

  2. Unlock Target Machine's Backup sparsebundle.

    sudo chflags -R nouchg /Volumes/{TimeMachine Volume Name}/{Target Machine's Name}.sparsebundle
    
  3. Attach sparsebundle then Listing Backup Volume.

    hdiutil attach -nomount -noverify -noautofsck /Volumes/{TimeMachine Volume Name}/{Target Machine's Name}.sparsebundle
    
  4. Repair backup volume.

    fsck_hfs -drfy /dev/disk2s2
    
    • Note: (Mojave~)
      Before running this command, you need to add /sbin/fsck_hfs to System Preferences -> Security & Privacy -> Full Disk Access.
  5. Detach backup sparsebundle.

    hdiutil detach /dev/disk2s2
    
  6. Fix TimeMachine state flag in following file.

    /Volumes/{TimeMachine Volume Name}/{Target Machine's Name}.sparsebundle/com.apple.TimeMachine.MachineID.plist
    
    • Delete following lines.

      <key>RecoveryBackupDeclinedDate</key>
      <date>{Date}</date>
    • Replace following lines.

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

      to

      <key>VerificationState</key>
      <integer>0</integer>
  7. That's all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment