OS rolling back file contents?

Is it possible for OS journaling to role back a file state?

I had a customer who had my app open for 3 weeks, suffered a system crash, and apparently had a data file revert to its state 3 weeks ago. The file is properly closed TextOutputStream saved to a random file name and then atomically swapped with the actual customer data file (using ExchangeFilesMBS). The file saves frequently during app use.

This particular case was OS X 10.12 but I’ve seen oddness with saving of preference files with the same setup on Windows.

Good on you for doing atomic data saving; but AFAiK journaling is not accessible to us as developers; it’s a very low level thing.

If the customer doesn’t have a backup there probably isn’t much you can do. In the future you could take a copy of the existing file before the saved data replaces it. However in this case I don’t know if it would help as the OS has rolled back 3 weeks on that file and may do so for your own internal backup.


So, is it possible that journaling could actual revert a file?

I do keep daily, weekly, monthly backups. Unfortunately due to the apparent file reversion, when it next loaded it ran all the backups again. I need to change to keeping x number of backups instead.

It’s my understanding that journaling can indeed do a rollback, but it’s only triggered when the system reboots and finds that a file is now corrupted.

Interesting. Thanks