# Should I be using snapshot restore or sync-to?

**URL:** <https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079>\
**Category:** Support\
**Created:** [April 30, 2022, 6:35pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079 "2022-04-30T18:35:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Chomey](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/nick_chomey/32/379_2.png) [@Nick\_Chomey](https://kopia.discourse.group/u/Nick_Chomey)\
**Post date:** [April 30, 2022, 6:35pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079/1 "2022-04-30T18:35:55Z")

</div>

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.

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).

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

---

<div class="post-metadata">

**Author:** ![iBackup](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/ibackup/32/355_2.png) [@iBackup](https://kopia.discourse.group/u/iBackup)\
**Post date:** [April 30, 2022, 7:16pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079/2 "2022-04-30T19:16:15Z")

</div>

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)

> [@Nick\_Chomey](#):
>
> 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?

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

---

<div class="post-metadata">

**Author:** ![Nick\_Chomey](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/nick_chomey/32/379_2.png) [@Nick\_Chomey](https://kopia.discourse.group/u/Nick_Chomey)\
**Post date:** [April 30, 2022, 7:33pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079/3 "2022-04-30T19:33:55Z")

</div>

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.

> <https://github.com/kopia/kopia/issues/1535>
>
> I'd like to add a restore mode which, like \`\`--skip-existing\`\` works incremental…, but also \*\*deletes\*\* extra files.
> 
> 1) is this a functionality you'd like to support?
> 2) if yes, should I add a new flag \`\`--mirror\`\`, or should it be a combination of \`\`--skip-existing\`\` and a new flag \`\`--delete-extra\`\` (exact name tbd)?
> 
> \### Use case:
> 
> We use kopia snapshots to copy files between gitlab ci stages. The total size is ~13GB, about 10GB of that is static and does not change between runs.
> 
> Currently we delete everything and do a full, clean restore.
> 
> We could save a lot of time by keeping the directory \_dirty\_ between runs, then using an incremental kopia restore.

---

<div class="post-metadata">

**Author:** ![iBackup](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/ibackup/32/355_2.png) [@iBackup](https://kopia.discourse.group/u/iBackup)\
**Post date:** [April 30, 2022, 8:17pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079/4 "2022-04-30T20:17:01Z")

</div>

> [@Nick\_Chomey](#):
>
> How can I delete any files on the restore destination that do not exist in the snapshot?

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`

---

<div class="post-metadata">

**Author:** ![tcjone](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/tcjone/32/401_2.png) [@tcjone](https://kopia.discourse.group/u/tcjone)\
**Post date:** [May 20, 2022, 4:06pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079/5 "2022-05-20T16:06:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iBackup](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/ibackup/32/355_2.png) [@iBackup](https://kopia.discourse.group/u/iBackup)\
**Post date:** [May 21, 2022, 3:02pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079/6 "2022-05-21T15:02:42Z")

</div>

> [@tcjone](#):
>
> Or is mount clever enough to use the local overlapping chunks, only downloading the delta to generate the mount point?

`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.

> [@tcjone](#):
>
> 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

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

---

<div class="post-metadata">

**Author:** ![tcjone](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/tcjone/32/401_2.png) [@tcjone](https://kopia.discourse.group/u/tcjone)\
**Post date:** [May 21, 2022, 4:09pm UTC](https://kopia.discourse.group/t/should-i-be-using-snapshot-restore-or-sync-to/1079/7 "2022-05-21T16:09:18Z")

</div>

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.
