Multiple repositories - newbie doesn't understand yet

I set up 2 repos now, like in:

kopia repository create sftp --username=kopia --host=myhost --path=/somepath/kopia/sftp-repository --keyfile ~/.ssh/id_ed25519 --known-hosts ~/.ssh/known_hosts --external --config-file="sftp_myhost.config"

kopia repository create s3 --endpoint=s3.eu-central-2.wasabisys.com --bucket=1234-mybucket --access-key=LKSEKXxxxxxxxxxx --secret-access-key=Xhxxxx --config-file="wasabi.config"
  • Is that correct? As far as I tested, otherwise I always overwrite “~/.config/kopia/repository*”.
  • If correct, how to use “kopia repository sync-to” now? Could someone provide an example command, please?

thanks all!

follow-up: can I copy the whole ~/.config/kopia to other machines with (for example) ansible? I’d like to rollout repos to my laptops etc

This is the bash script, which syncs the local repo of my Kopia server on my home LAN to a Wasabi Bucket:

#!/bin/sh

# connect to local repo ST7A
kopia repository connect filesystem \
 --path /mnt/kopia/ST7A  \
 --override-username=<user> \
 --override-hostname=<host> \
 --password=******************  \
 --cache-directory=/kopia/cache/ST7AS3 \
 --content-cache-size-mb=5000 \
 --metadata-cache-size-mb=5000 \
 --disable-color

# temporarily suspend quick and full sync
kopia maintenance set \
  --pause-quick=3h \
  --disable-color

# perform repo sync to Wasabi S3
kopia repository sync-to s3 \
 --secret-access-key=D<secret-key> \
 --max-upload-speed=1048576 \
 --access-key=<access-key> \
 --endpoint="s3.eu-central-1.wasabisys.com" \
 --bucket=kopiast7a \
 --delete \
 --update \
 --disable-color

# re-enable quick maintenance
kopia maintenance set \
  --pause-quick=1h \
  --disable-color

# disconnect from local repo
kopia repository disconnect --disable-color

This has been happily synchronizing my local repo for months.

@budy thanks! So no usage of config-files at all. That’s what I wondered all the time: how and if to use the separate repos: create individual config files in ~/.config/kopia? How to refer to them? etc etc

Your script shows a straightforward approach, I might consider connecting by token instead.

But great, this helps me to progress.

Yeah - I am using config files, though only for starting up my Kopia server(s)…

A synced repository has the same policies as the source repo, right?

As far as I understand I have to edit the policy of my (source) sftp-repo to match the GCS-retention policy of the “sync-to” repo.

As the repo is synched, it also inherits all policies, afaik.

Do you think it is needed to pause the all the maintenances AND the schedulled snapshots (if any) ?
Plus we should also check that no schedulled snapshot is already running ?

For safety reasons I am suspending all maintenance jobs on my repo while synching - about ongoing snapshots, I am not sure - however all of my snapshots are done way before the sync starts.