Back to blog
Jun 2018·2 min readAI-translated

Time Machine -5058

#8058#error#timemachine

Problem

Worst case scenario: the backup goes haywire. Normally I back up IT projects twice. My cron job runs automatically every day at 24:00 and creates a local backup of my localhost, i.e. all virtual hosts, and keeps the last 5 days. Backups older than 5 days are deleted automatically. In my particular case I hadn't edited my JavaScript source files for the last 5 days, but of course (correspondingly identical) backups were still being made. So far, so good, failure by design. About 7 days ago, however, I changed quite a bit in my compiler, and during development I must have messed something up with my "cat" command so that the source files were emptied. I didn't notice until this noon, when I wanted to change something in a source file and realized: there's nothing left. Long story short: the last 5 backups were all identical - identically empty, that is. (At least I learned from it: from now on the cron job checks whether a change was made in the project - if not, no backup is started.) So, next step: open the Time Machine backup. Copy the source files, CMD + V on my local desktop and...

"The operation can't be completed because an unexpected error occurred (error code -8058)."

The implications of this error message only dawned on me after a few seconds: no backup of the files available anymore. A solution had to be found.

Solution

Google offers a few solutions for this error:

  1. macuser.de - Time Machine restore doesn't work - Apple suggests a PRAM reset. Of course. Doesn't help
  2. support.apple.com - Repair Time Capsule - Could help - but I don't use a Time Capsule, only Time Machine with a third-party hard drive (which is so abysmal that I don't want to name its maker, WesternDigital... damn).
  3. support.apple.com/kb/TA23761 - From 2006, but could help. So: Utilities - Disk Utility - Time Machine - Repair. Result: system corrupt - can't be repaired - bad luck.

The solution for me looked a bit different. This article from MacWorld helped me (thanks)!

  1. Using the terminal and the command tmutil destinationinfo you can find out where exactly the Time Machine backup is located. For me that is afp://David@MyCloud._afpovertcp._tcp.local./TimeCapsule
  2. Mount the volume with mount -t afp://David@MyCloud._afpovertcp._tcp.local/TimeCapsule
  3. We change into /Volumes/ with cd /Volumes/ and should find a folder there with the backups; for me that was "Time Machine-Backups", which contains a folder called "Backups.backupdb", which we now enter with cd Time Machine-Backups/Backups.backupdb
  4. Here you find the complete backup structure sorted by date and time of the backup, and it's now easy to get around error 5058 by copying the needed files to the current drive via "cp".

TL;DR

  1. Open the terminal
  2. tmutil destinationinfo
  3. mount -t PATH_OF_THE_TIMECAPSULE
  4. Change into the mounted folder & copy the files
NewerConverting Seconds to Days, Hours, Minutes and SecondsOlderScrollblur