{"id":806,"date":"2020-05-31T12:02:39","date_gmt":"2020-05-31T18:02:39","guid":{"rendered":"http:\/\/www.schwie.com\/brad\/?p=806"},"modified":"2022-11-28T22:34:40","modified_gmt":"2022-11-29T04:34:40","slug":"time-machine-backupbundle-repair","status":"publish","type":"post","link":"https:\/\/www.schwie.com\/brad\/?p=806","title":{"rendered":"Time Machine .backupbundle repair"},"content":{"rendered":"On my macbookpro12,1, Time Machine could no longer do backups and I wanted to start a new archive. I didn&#8217;t want to lose my previously backed up files nor did I want to start a new backup from scratch as it takes several hours. To repair the existing backup stored on our Time Capsule, I tried using instructions on this <a href=\"https:\/\/expobrain.net\/2016\/12\/10\/fix-corrupted-time-machine-spase-bundles\/\">guy&#8217;s blog<\/a>.<br \/><br \/>\r\n\r\nSadly, fsck_hfs couldn&#8217;t repair my .backupbundle\/sparsebundle, so I had to start over anyway! This has happened to me and others a few times in the past, so maybe the instructions above will be useful later. Better yet, copying and pasting the commands above gets old, so I may try the shell script here:\r\n\r\n<a href=\"https:\/\/gist.github.com\/ahknight\/dec202583a910756c6d9\">https:\/\/gist.github.com\/ahknight\/dec202583a910756c6d9<\/a>\r\n\r\nIt also <a href=\"https:\/\/n8henrie.com\/2018\/11\/fix-no-write-operation-not-permitted-when-repairing-time-machine-sparsebundle\/\">might help to add &#8220;fsck_hfs&#8221; to your full disk allowed<\/a> list in System Preferences->Security->Privacy->Full Disk Access.\r\n\r\nFinally, others have asked me about scheduling Time Machine backups. I may give <a href=\"https:\/\/homeittechstuff.blogspot.com\/2020\/\">these instructions<\/a> a shot at some point, as it may relieve the issues that caused me to write this post.<p>\r\n\r\n<p>** UPDATE 7-8-2020 **<BR>\r\nThis issue came up again with the backups created by my MacBook Pro today. Instead of running all the steps and advice above, I turned to <a href=\"https:\/\/www.schwie.com\/brad\/wp-content\/uploads\/2020\/05\/TimeMachineRepairScript.sh_.zip\">this shell script<\/a>, which I perused on another site (sorry, I&#8217;d love to credit the author, but I can&#8217;t seem to find them). I store this script on another machine on my network that has access to the Time Capsul so it can do the dirty work as it seems to run for a while. Here are the updated steps:<p>\r\n\r\n0. Disable Time Machine on your Mac, in my case from my MacBook Pro -> go to System Preferences&#8230;->Time Machine->uncheck box for &#8220;Back Up Automatically&#8221;.<p>\r\n1. Open a Terminal window and navigate to the directory where you saved the .sh script referenced above, in my case the desktop:<p>\r\n\r\n<pre>schwie:~ bradschwie$ cd Desktop\r\nschwie:~ bradschwie$ chmod +x TimeMachineRepairScript.sh\r\nschwie:~ bradschwie$ .\/TimeMachineRepairScript.sh<\/pre><p>\r\n(don&#8217;t press enter yet and leave this window open, we&#8217;ll be coming back to it in Step 4)<p>\r\n\r\n2. Connect to a server on my network (Mac mini) and connect to the Time Capsule&#8217;s disk: In a Finder window, look in the left hand pane under &#8220;Shared&#8221;, click the name of your Time Capsule, and then click &#8220;Connect As&#8230;&#8221;<p>\r\n3. When the Time Capsule&#8217;s disk mounts, click the &#8220;Data&#8221; folder, locate the name of your backup and drag its icon to the Terminal window in Step 1 and release.<p>\r\n4. Press return in the Terminal window.<p>\r\n5. After the script successfully completes repair of the backup, reenable Time Machine on your Mac.<p>\r\n\r\n@@ I can&#8217;t remember where I got the script linked above, but if you run it from the Mac where your Time Machine backups originate, you could enable and disable Time Machine using (steps 0 and 5) using <a href=\"https:\/\/github.com\/chase-miller\/time-machine-sparce-bundle-fix\">information<\/a> from these <a href=\"https:\/\/gist.github.com\/pmeulen\/2bb9099244f4fa9585f052c9df8a13cc\">folks<\/a>.<p>\r\n\r\n** UPDATE 7-19-2020 **<br>\r\nIt happened again today and the script once again worked. Not sure why this keeps happening, except I think it may have to do with me putting the Mac to sleep while its in the middle of a backup. Maybe I should start restricting Time Machine to do its backups between 2am and 5am? Here&#8217;s the successful script output and my Time Machine is back in action:<p>\r\n\r\n<pre>schwie:Desktop bradschwie$ .\/TimeMachineRepairScript.sh \/Volumes\/Data\/MacBook\\ Pro.backupbundle\r\n+ IMAGE='\/Volumes\/Data\/MacBook Pro.backupbundle'\r\n+ '[' -z '\/Volumes\/Data\/MacBook Pro.backupbundle' ']'\r\n+ chflags -v nouchg '\/Volumes\/Data\/MacBook Pro.backupbundle'\r\n\/Volumes\/Data\/MacBook Pro.backupbundle\r\n+ chflags -v nouchg '\/Volumes\/Data\/MacBook Pro.backupbundle\/token'\r\n\/Volumes\/Data\/MacBook Pro.backupbundle\/token\r\n+ chflags -v nouchg '\/Volumes\/Data\/MacBook Pro.backupbundle\/bands'\r\n+ \/usr\/libexec\/PlistBuddy -c 'Delete :RecoveryBackupDeclinedDate' '\/Volumes\/Data\/MacBook Pro.backupbundle\/com.apple.TimeMachine.MachineID.plist'\r\n+ \/usr\/libexec\/PlistBuddy -c 'Set :VerificationState 0' '\/Volumes\/Data\/MacBook Pro.backupbundle\/com.apple.TimeMachine.MachineID.plist'\r\n+ set -e\r\n++ hdiutil attach -nomount -noverify -noautofsck '\/Volumes\/Data\/MacBook Pro.backupbundle'\r\n++ awk '\/HFS\/ {print $1}'\r\n+ DEV=\/dev\/disk4s2\r\n+ echo '\/Volumes\/Data\/MacBook Pro.backupbundle -> \/dev\/disk4s2'\r\n\/Volumes\/Data\/MacBook Pro.backupbundle -> \/dev\/disk4s2\r\n+ fsck_hfs -fy -c 8gb \/dev\/disk4s2\r\n** \/dev\/rdisk4s2\r\n   Executing fsck_hfs (version hfs-407.50.6).\r\n** Checking Journaled HFS Plus volume.\r\n** Detected a case-sensitive volume.\r\n   The volume name is Time Machine Backups\r\n** Checking extents overflow file.\r\n** Checking catalog file.\r\n** Checking multi-linked files.\r\n** Checking catalog hierarchy.\r\n** Checking extended attributes file.\r\n** Checking multi-linked directories.\r\n** Checking volume bitmap.\r\n** Checking volume information.\r\n** The volume Time Machine Backups appears to be OK.\r\n+ hdiutil detach \/dev\/disk4s2\r\n\"disk4\" unmounted.\r\n\"disk4\" ejected.<\/pre>\r\n\r\n<p>** UPDATE 8-17-2020 **<br>\r\nSo, it happened again today and the script once again worked. Not sure why this keeps happening, but after running the script and continuing backups with Time Machine, a long clean seems to occur.\r\n\r\n<p>** UPDATE 6-28-2021 **<br>\r\nYesterday, I had to abort my MacBook Pro&#8217;s Time Machine backup 2\/3&#8217;s of the way into it. After aborting, Time Machine told me it was having problems with Time Capsule, so I followed the instructions above and kicked off the script.\r\n<p>** UPDATE 6-30-2021 **<br>\r\nThe script took two days to finish up while running on a machine connected via gigabit ethernet, here&#8217;s the successful output:<p>\r\n<a href=\"https:\/\/www.schwie.com\/brad\/wp-content\/uploads\/2021\/06\/script_output.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.schwie.com\/brad\/wp-content\/uploads\/2021\/06\/script_output-292x300.png\" alt=\"\" width=\"292\" height=\"300\" class=\"alignnone size-medium wp-image-1107\" srcset=\"https:\/\/www.schwie.com\/brad\/wp-content\/uploads\/2021\/06\/script_output-292x300.png 292w, https:\/\/www.schwie.com\/brad\/wp-content\/uploads\/2021\/06\/script_output-995x1024.png 995w, https:\/\/www.schwie.com\/brad\/wp-content\/uploads\/2021\/06\/script_output-768x790.png 768w, https:\/\/www.schwie.com\/brad\/wp-content\/uploads\/2021\/06\/script_output.png 1010w\" sizes=\"auto, (max-width: 292px) 100vw, 292px\" \/><\/a>\r\n","protected":false},"excerpt":{"rendered":"<p>On my macbookpro12,1, Time Machine could no longer do backups and I wanted to start a new archive. I didn&#8217;t want to lose my previously backed up files nor did I want to start a new backup from scratch as &hellip; <a href=\"https:\/\/www.schwie.com\/brad\/?p=806\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-806","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=806"}],"version-history":[{"count":28,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/806\/revisions"}],"predecessor-version":[{"id":1475,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/806\/revisions\/1475"}],"wp:attachment":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}