Tuesday, January 8, 2019

Solution for Time Machine “Error While Restoring From the Backup”

Harry Fear (via Maxwell Swadling):

A few hours into the restore (about three-quarters of the way through the data transfer) the restoration would always fail with “An error occurred while restoring from the backup.”


Initially I needed a Finder and Terminal window so I had to setup the new Mac as new with no user data so I could fully access the Time Machine backup to apply the fix. Then I connected the backup to the Mac.


Then I had to delete the problematic folder that was identified in the log[…]


Then go back into Recovery mode on the Mac and reattempt to restore from the modified backup.

7 Comments RSS · Twitter

I've the same problem (also from Mac App Store receipts (in my case from FoldingText.app) in $HOME/Library/Containers/com.foldingtext.FoldingText/Data/Library/Application Support/FoldingText/Receipts) restoring from a (normal) TimeMachine backup. I would be nice if instead of failing you were given the option to ignore the error and continue (at least if the problematic files aren't in /System or /Library where the resulting system might not be operable)...

In my case (as it wasn't on a TimeCapsule) I could just delete the file from the mounted backup drive and then re-attempt the restore.

I wish time machine worked better, I really wanted to use it. I finally gave up after a couple years of issues and moved to an rsync-based backup and it has been great.

I was a SuperDuper and Carbon Copy Cloner user before Time Machine was a feature but at the release of Leopard, I gave it a whirl. Wasn't impressed and I reverted back to CCC. When I switched to Linux, I wrote my own rsync based backup as well. Have three computers backing up to my little Intel NUC server. Works well, but I should have added hard link support. Live and learn.

@Nathan Those solutions do not provide incremental backups, do they?

In the case of Carbon Copy Cloner and my rsync script, yes, they work quite well for incremental copies. In fact, my little script just "ripped off" the backup directory structure of CCC. I have my user folder as it would appear at time of copy, then outside that user folder I have time stamped folders of changed/deleted files from the backup. Something like:
* /BackupDrive/BackupDirectory/MyUserFolder for my files as they appear on my computer's user account.
* /BackupDrive/BackupDirectory/old_2019-01-28_21:30:01 would be a folder for changed/deleted files that are no longer in the canonical backup (MyUserFolder). Each "archived" directory is dated and timestamped (YYYY-MM-DD_HH:MM:SS). Not sure if Mac OS can have colons in their file names, since I use Linux, but you get the gist.

Note, a better way to do the archiving might be to have a complete backup for each revision of the sync, as with Time Machine. You would need to set up rsync to make hard links so only changed/new files are actually written to each backup archive. Each archive folder would be date/time stamped. That way, the unchanged files between backups would just be hard links to an earlier backup but each dated folder would look like a complete backup of /SourceDrive/MyUserFolder at the instance of each sync.

Back to my actual setup, I have three big considerations, my client device may not be able to have a direct connection to a drive, my client device might not always be on during a fixed scheduled backup, and my client device might not be connected to a power source at time of backup. As such:
* SSH takes care of the connection from client to server with attached storage.
* I use anacron for scheduling my backup as it is more flexible than cron. By default anacron runs every hour and from there you can execute scripts daily, weekly, or monthly. Well, it doesn't run every hour, I only need my backup running daily after all, but anacron checks to make sure the daily backup has run on hourly intervals. If it hasn't run yet, my rsync backup script will execute, but if it has already run, then it will be skipped until the next calendar day. As a note to OS X users, while you can certainly figure out cron and possibly even anacron on OS X, there's a native scheduling backend (launchd?) that might be worth looking into.
* Anacron will not run on battery power in its default state, so I have to edit a config file to comment out that section. Once done, everything works more or less flawlessly.

One final note, since my SSH private key is encrypted, I need a way for the rsync script to access the key or the backup will fail. My solution was to use a little tool called keychain (https://www.funtoo.org/Keychain). At login, I set up a prompt to unlock my key, then my scripts can interact with my ssh key or keys for that session. Pretty sure OS X's keychain can perform the same functionality for SSH keys, but I confess to not remembering. It has been a very long time since I looked into using OS X's keychain for SSH. Sorry.

@Nathan Thanks a lot for the detailed answer!

[…] Solution for Time Machine “Error While Restoring From the Backup” […]

Leave a Comment