Restic not detecting file change

I have a VeraCrypt image file that has a size of 8GB. After I make a some small changes using VeraCrypt, I try to back it up using restic backup disk.img, but every time restic fails to detect that the file has been changed. Note that the file name, date/time, and size never change. In fact, only a few kilobytes of the content out of the 8GB change. But I still expect restic will correctly detect the change and correctly dedupe. I am not sure why it doesn’t see the change at all.

  • Version: 0.16.4
  • Command: restic backup C:\disk.img
  • Environment variables: RESTIC_REPOSITORY and RESTIC_PASSWORD
  • OS: Windows 11 Pro
  • Complete output:

repository d0682442 opened (version 2, compression level auto)
using parent snapshot 89ae9a0e
[0:00] 100.00% 37 / 37 index files loaded

Files: 0 new, 0 changed, 1 unmodified
Dirs: 0 new, 1 changed, 0 unmodified
Added to the repository: 296 B (251 B stored)

processed 1 files, 8.000 GiB in 0:03
snapshot d62aa1d1 saved

How come the date/time not changing? I suppose that is what Restic is using to detect file changes (coz scanning the whole file for changes would be rather expensive…)

Hey, welcome to the forum :slight_smile:

If the metadata doesn’t change, restic will treat the file as unchanged:

On Windows, a file is considered unchanged when its path, size and modification time match

https://restic.readthedocs.io/en/stable/040_backup.html#file-change-detection

Normally changing the file involves updating the metadata; it seems odd to me that you’ve a file where the metadata apparently isn’t updating, despite the file changing on-disk. Maybe there’s a way to change that in VeraCrypt?

At any rate, you can use the --force flag to force restic to re-scan the file, which should work around your problem. See the docs page I linked above for more details.

Yes. There is a privacy setting which controls exactly this. See syncthing file scan and files that don't change timestamp, length, or permissions - #6 by gadget - Feature - Syncthing Community Forum .

Indeed it can be turned off in Veracrypt but as it serves its purpose better solution is simply force files rescan when running restic:

restic backup --force

Thank you so much.