Cipher Log

Chronicles in Language, Technology, and Law

Getting Time Machine to recognize a snapshot

July 27, 2022

Apple's Time Machine is a decent backup system for home users who don't want to get in over their heads. It's also decent for more advanced users who want a versioned history of backups (ChronoSync or Mac Backup Guru are other options, with the former having great reviews).

Unfortunately, Time Machine does a lot of "magic" -- there are things does things behind the scenes that are necessary to function properly, but which are inscrutable and undocumented. As a result, when things go wrong -- Backups.backupdb backup sets aren't imported or a specific dated snapshot directory isn't recognized -- it's very difficult to fix.

As it turns out, the metadata required to be recognized as a Time Machine snapshot is relatively straightforward. After a bit of trial and error, I wrote some shell scripts to automate the process of fixing Time Machine backups.

Please checkout the tmutils package on my GitHub page. Specifically, the tmimport.sh script should be helpful in getting a backup set recognized by Time Machine, and the tmbless.sh script should be helpful in making a specific dated snapshot directory show up within that backup set.

In fact, the tmbless.sh script is so effective that even a completely arbitrary and fabricated backup can be made to function in Time Machine, being fully recognized, appearing appropriately in the graphical UI, and allowing restore directly to your running system. See the images below for an example.

(Ideally I'd still like a way to thin out snapshots, especially since the "magic" of Time Machine often results in making complete, non-incremental backups whenever you move to a new computer, get a new backup drive, or restore an entire machine. Still playing with things like sudo rsync -aHAXUNDP --link-dest=../X X/ Y/ and so on. Note: the --link-dest parameter is relative to the target directory.)

Labels: ,