Should I be using snapshot restore or sync-to?

I just discovered kopia after realizing that restic doesn’t do what I need it to do.

I’d like to backup data from an Ubuntu 20.04 VPS to OneDrive, via rclone. I assume that both restic and kopia do this adequately (with kopia offering compression as well).

My issue with restic is that if I want to restore a snapshot to the VPS filesystem

  1. it downloads and overwrites all files, regardless of whether they have changed.

    It appears that I could use kopia snapshot restore --skip-existing to avoid downloading and overwriting files that already exist. Is that correct? But what does “exist” mean? Is it an exact (file size and/or modified date and/or hash) match?

  2. if there are new files in the restore destination (my VPS) directory that aren’t in the rclone:onedrive snapshot, they stay in the directory rather than being wiped out (such that the directory would be returned to the state that it was in when I took the snapshot).

    Which mechanism (and flags) will handle this? It seems like sync-to rclone --delete handles this appropriately, but am I misunderstanding how sync-to works? It isn’t clear to me whether it can restore files like this or whether it only syncs between kopia repositories.

    If I can’t use sync-to, then is there a flag for restore that will delete any extraneous/new files in the VPS destination?

Or should I just connect to the repo and use rclone sync for all of this? If that’s the case, then I’m in the same boat as with restic and will just test them both out to see how they differ

If you would run kopia --help-long, you would find all answers there.

Shortly sync-to is not about restoration, but about synchronization backup repository to another/other repositories (basically making extra duplicate of existing one backup)

That’s what help says about it:

When restoring to a target path that already has existing data, by default
the restore will attempt to overwrite, unless one or more of the following
flags has been set (to prevent overwrite of each type):
–no-overwrite-files --no-overwrite-directories --no-overwrite-symlinks

Thanks for the clarification on sync-to.

But my 2nd issue remains unaddressed.

How can I delete any files on the restore destination that do not exist in the snapshot?

I just found this issue in Github asking for this feature, so I suspect it can’t be done and am stuck mounting the repo and using rclone sync.

Mount backup and use rsync with option --delete that will remove non existent files on target, or if you on windows then robocopy with option /mir

1 Like

Doesn’t this mean I won’t gain any of the advantages of delta copying? Or is mount clever enough to use the local overlapping chunks, only downloading the delta to generate the mount point?

If I have a directory of 1000 big jpgs, I don’t want to download them all just to revert to a previous snapshot where there were only 980 jpgs. The ones that don’t belong should just be deleted.

Mount works in the same way as on Unix based machines as well as in Windows. When you plugged some USB storage, mount do NOT copy anything, it just represent external file system where user is responsible to choose what he want to copy.

Think about kopia’s mounted volume in the same way as external USB flash drive, you are responsible what you want to copy from repository

Oh interesting. So mount is really a no-cost operation that just requires the index, and I can use a third party delta copy tool.

Adds an extra step, but isn’t the worst way of handling this.