How to move an existing sftp-based repository to another server?
I have a repo in serverA:~kopia/upload
Is it OK to rsync the directory over to serverB:~kopia/upload … and adjust the kopia-clients to the new server?
Or is it better to somehow use kopia itself to “clone” the repo from A to B? Hints very welcome.
EDIT: additional fact: serverA syncs the sftp-repo to GCS. I have to keep that working on serverB as well.
Kopia repos are “self-contained”. As long as you don’t change the underlying filesystem, e.g. move from local fs to S3, you can simply copy the whole repo anywhere else and use your client to connect to that repo. All you need to do is to “Connect to new repo” in Kopia UI and remove the old one.
Note, that you’ll need your repo password for that, but that should be kept safe anyway.
Thanks for explaining.
In the meantime I decided to make multiple steps:
the current productive setup does:
- client snapshots into sftp-repo1 on server1
- server1 syncs sftp-repo1 to GCS-repo1
I added a 2nd sftp-repo to server2 and currently sync sftp-repo1 to sftp-repo2.
By doing so I can create the new repo without touching my working scripts and jobs etc
As soon as the sync is complete I plan to:
- re-wire the client-jobs to point to sftp-repo2
- move the sync-to-GCS-job to server2
Better safe than sorry. Hints welcome.
ps: server1 is planned to be removed, that’s why …
Unfortunately I hit issues on my way.
I created the sftp-repo like:
# kopia repository create sftp --path=kopia/upload --host=host2 --username=kopia --sftp-password=kopi123 --known-hosts=/root/.ssh/known_hosts
I can sync there from server1.
If I try to connect to the repo from server3, I get:
# kopia repository connect sftp --path=kopia/upload --host=host2 --username=kopia --sftp-password=kopi123 --known-hosts=/root/.ssh/known_hosts
ERROR failed to open repository: unable to create format manager: invalid repository password
ERROR error connecting to repository: unable to create format manager: invalid repository password
I checked the passwort, copied from the same source … Maybe it doesn’t work because the sync from server is running in parallel?
Ad password: solved. After “sync to sftp” the password of the target repository is the same as the password of the source repository! So the password of the “repository create sftp” step is gone then.
As soon as you understand that, it’s clear. But it took me a while. Might be worth mentioning somewhere in the docs (maybe it is mentioned, I don’t remember reading this).