# How to automatically sync snapshots to multiple repositories with KopiaUI?

I am looking to save my snapshots to multiple repositories (the same snapshot stored in multiple clouds). I see Synchronization | Kopia. However, I do not see how to do this with KopiaUI. Am I missing something, or is the feature not available in KopiaUI?

EDIT: To anyone reading this, at the time of this writing KopiaUI does not natively support syncing to other repos (the sync-to command). However, you can use the sync-to feature in KopiaUI by doing the following:

1. Create a script (e.g., command or batch file) that has the command in it. For example, in Windows you can create a file sync_to_other_repos.cmd and add the line \path\to\kopia.exe --config-file="\path\to\kopia\repository.config" repository sync-to gcs --credentials-file="\path\to\google_cloud_credentials.json" --bucket="examplebucket" --delete. Note that an easy way to find the path to kopia.exe and the path to your repository.config file can be found by clicking the yellow >_ button in KopiaUI (bottom left of the interface). The example code I give is trying to sync to a Google Cloud Storage bucket. You can sync to any repository supported by Kopia; see Common Commands | Kopia and scroll down to the sync-to section.

2. Edit your KopiaUI repository.config file and change "enableActions": false to "enableActions": true. Save the file and restart KopiaUI.

3. Now edit the policy in KopiaUI for whatever snapshot you want to sync to other repositories, go to Snapshot Actions and add the path to your sync_to_other_repos.cmd file in After Snapshot. You probably also want to set Timeout to a generous amount, if Kopia will be syncing a lot of files to the other repos. If you do not want to use sync_to_other_repos.cmd file as an After Snapshot action, you can run it by yourself at any point you want to sync files to other repos, although you will need to connect to your main repo first.

As far as I understand sync-to is not as reliable as taking independent snapshots to different repos.
What I do with kopiaUI is connecting to two different clouds and I have setup same policies for the the different repos, but of course you can make different policies too.

What is the reason for this statement ?
sync-to is a simple copy action that’s relay on TCP protocol (besides of local filesystem) that guarantee integrity of traffic. If one worry about aborted connection or don’t trust remote storage, you can always connect to that remote repository and run verification on periodic schedule. Running twice or more backup on the same source makes remote repositories unsynchronized between each other and besides of that it creates unnecessary loading on source computer that’s is subject for backup. If you following at least 3-2-1 backup rule, that you have to have at least one local backup, so run actual backup once to a local storage and then sync-to it to remote destination(s)

KopiaUI is a simple wrapper to kopia that doing all backup magic. You can write simplest script that calls kopia with option sync-to and push local repository to offsite locations

Can you help a noob out and explain (1) what script to write and (2) how I could automatically call it from KopiaUI. Can I put the script in Snapshot Actions After Snapshot and KopiaUI will automatically run the script after each snapshot has finished? Is there any reason to NOT call the script after every screenshot?

As @jkowalski wrote himself:

I have few observations:

1. Relying on sync-to as a safety measure has an issue where you may be replicating data corruption (bitrot or bugs) at the source because sync-to is just copying files and not performing consistency checks as it does it.

It is the same as making a backup of a backup.

If you are worried about corruption, wouldn’t it make more sense to have multiple different backup software with different destinations, rather than the same backup software to different destinations?

What if I do both?
Macrium Reflect for Windows, Time Machine for MacOS to local drives and kopiaUI for my files to two different repos in the cloud (Wasabi and Google).

Bro… that is basically what I am doing o_O

To anyone reading this, at the time of this writing KopiaUI does not natively support syncing to other repos (the sync-to command). However, you can use the sync-to feature in KopiaUI by doing the following:

1. Create a script (e.g., command or batch file) that has the command in it. For example, in Windows you can create a file sync_to_other_repos.cmd and add the line \path\to\kopia.exe --config-file="\path\to\kopia\repository.config" repository sync-to gcs --credentials-file="\path\to\google_cloud_credentials.json" --bucket="examplebucket" --delete. Note that an easy way to find the path to kopia.exe and the path to your repository.config file can be found by clicking the yellow >_ button in KopiaUI (bottom left of the interface). The example code I give is trying to sync to a Google Cloud Storage bucket. You can sync to any repository supported by Kopia; see Common Commands | Kopia and scroll down to the sync-to section.

2. Edit your KopiaUI repository.config file and change "enableActions": false to "enableActions": true. Save the file and restart KopiaUI.

3. Now edit the policy in KopiaUI for whatever snapshot you want to sync to other repositories, go to Snapshot Actions and add the path to your sync_to_other_repos.cmd file in After Snapshot. You probably also want to set Timeout to a generous amount, if Kopia will be syncing a lot of files to the other repos. If you do not want to use sync_to_other_repos.cmd file as an After Snapshot action, you can run it by yourself at any point you want to sync files to other repos.

KopiaUI is a simple wrapper to kopia that doing all backup magic.

I don’t think that is correct (if you mean that the UI uses the command-line kopia version).

You can then open task manager, add command line column, find row with kopiaUI and see that’s Im right

AFAIR, it been said in context where OP wanted: synchronize distinct repositories with sync-to the same “remote” repository which is a different use case where sync-to would be inappropriate tool.

sync-to is the same as rsync - just a smart copy tool that simply coping source repository to destination. If one worry about integrity of destination repository (bitrot, network error during sync), then kopia have content verify command and in case of use together with sync-to both repository will be the identical, the same timestamp, the same snapshots… as well verification step can run on remote/destination computer instead of loading multiple time a subject for backup

It is the same as making a backup of a backup.

Exactly. You having multiple synchronized repositories of the same content, but in case if one would do backup multiple times to remote repositories then it won’t be a case