Does restoring over the top of a previous restore work?


#1

If I restore a snapshot, and then restore a later snapshot the top, will restic:

  1. Only transfer the changed files?
  2. Be willing to overwrite changed files?
  3. Remove deleted files?

If not all of those, is the best option to fuse mount the newer snapshot and then rsync the fuse mount over the older restored snapshot? How efficient will that be on a remote repository like B2?


#2

If restoring into a non-empty directory, with the current restorer code, restic will:

  • overwrite existing files with the content from the repo, while re-downloading it
  • Leave additional files/directories alone

The logic in the restorer is pretty basic right now.

You can try that (please report back if you do!), I’m not entirely sure what rsync uses for detecting changed files. If it’s based on the timestamps only, then that’ll probably work.

That depends a lot on the state of the cache: If it’s hot (because you’ve done the backups on the same host) this probably will be fast, otherwise you have to wait until restic has downloaded all the metadata files.


#3

Thanks for the info. Could be interesting to compare normal restic restore against restic mount+rsync, or using fpsync or one of the tricks to parallelize rsync. In theory restic mount+fpsync should handily beat out restic restore, with 0.9.2 at least. Oh - that assumes that restic mount supports parallel file operations?

rsync uses mod-time and size by default, unless you specify --checksum in which case it uses a 128-bit MD5 (--checksum: skip based on checksum, not mod-time & size).