Mac OS X – Time Machine backup fails verification – What can I do to save the history?

Posted on

QUESTION :

How do I make Time Machine to make a new complete backup without losing older versions of backed up files?

Verbose:

I am using the Time Machine backup on my OS X (Snow Leopard) to backup the whole computer to an external drive. I especially like the “history”, i.e. the feature that allows you to restore the older version of a file.

Problem: I had some data corruption on my external backup drive, I repaired it with the System Tool for doing that, it found some faults. I had the disk tool repair the external drive. After that, the external drive was OK and I could use Time Machine again.

I let Time Machine do one more backup.

Now I made a verification according to Verifying Time Machine backups,

namely along

sudo diff -qr . $HOME/Desktop 2>&1 | tee $HOME/timemachine-diff.log

However: After doing the command above, several differences and missing files were reported, approx. 200 files in sum.

Whereas some of the missing files were cache or excluded directories, the differences do bother me, especially as some important documents from me are listed as differing.

How can I make sure that the data on the external drive is synced correctly?

  • Is it possible to have Time Machine to do a complete new backup without losing the history?

  • Or to have Time Machine compare all files for differences and re-write all files that are different?

  • Or can I set some flags on the files that do not match to have them copied again? (like the archive-flag in Windows/Dos). I’d rather not touch the files because I would like to keep the date of last change/date of creation)

Thank you for your thoughts!

ANSWER :

Time Machine uses FSEvents to tell in which directories files were added, changed or deleted after a certain time. (There’s a good explanation at Ars Technica.) Even when somehow forcing OS X to rebuild the FSEvents database, I think Time Machine will still only consider changes that happened after the date of the last backup. I think it simply assumes all older backups are valid, and discards older files as it assumes it already copied them.

Even if FSEvents tells Time Machine that something in a folder has changed, a nice in-depth article at Quarter Life Crisis claims:

Time Machine considers two files to be identical if their path and dates and size are the same.

Hence, modifying a file while not changing file size or date, keeps Time Machine oblivious of file changes. But maybe that only applies to comparing the last backup against the current state on disk. If you do not see the file in the last backup at all, then Time Machine cannot compare the current file to the last backup either. Or, if the folder has not changed for a long time, then Time Machine will skip it altogether. So, maybe you just need to make Time Machine process that file’s folder again. Simply add a file to that same folder and remove it, which will add the name of that folder to the FSEvents database. Then, when Time Machine runs, it will surely know that the folder needs processing. If it then only looks at files that were created after the last backup then this won’t help you. But maybe it really checks the existence of each file in that folder, hence copying the missing files to the backup after all. Just give it a try.

If just poking the folder doesn’t work, then all you can do is change the file date. If you’re okay with that, then the touch command can do that:

touch my-file