How to Change Kopia Default Folder

Hi,

I tried to change the default folder location for better administration, when running kopia as a service.

When I run kopia on CLI with:

kopia repo connect s3...

then repository.config ist stored in my user %appdata%\roaming\kopia. Also Cache Folder is stored there (default).

I changed cache folder and it worked - but changed back to %appdata% (still don’t know why).

Ich tried to connect (after #kopia repo disconnect) with:

kopia repo connect s3 ... --config-file "c:\kopia\repository.config"

→ Message: connected to repository

After that the file was stored on that new place without error. And the content of that file is the same like on %APPDATA%.

But…

When I check with

kopia repo status

ERROR open repository: repository is not connected…

Ich checked documentation and cannot find out, what’s wrong https://kopia.io/docs/reference/command-line/#configuration-file

Reconnect without flag: Everything fine again.

Any Ideas?

If you want to use custom config file location/name you have to always provide --config-file flag to kopia CLI commands.

Alternatively you can set KOPIA_CONFIG_PATH environment variable.

Thank you forfast reply.

Both is not working for me.
First like mentioned above.

With path variable (and without --config-file):

ERROR error connecting to repository: unable to write config file: error writing file: cannot replace "c:\\temp\\" with tempfile "c:\\temp\\349391638": replace c:\temp\349391638 c:\temp\: Access is denied.

What does he wants to do with “replace”; strange…
There is no access problem from my point of view…

With path variable and --config-file it worked (file was created) but after repo status, same again:

ERROR error connecting to repository: unable to write config file: error writing file: cannot replace “c:\temp\” with tempfile “c:\temp\349391638”: replace c:\temp\349391638 c:\temp: Access is denied.

This is not kopia problem. You have to sort out permissions on your OS. User running kopia has to have permission to access file you configure.

Also your post is not very clear what exactly you are doing. Post all commands and their output for maybe somebody to try to help.

Thank You.

I found my mistake now, which once again contributes to the basic understanding. Took me a while to figure it out, although the solution is simple.

First of all, it was interesting to see why a repository is “open” even though there is no process. An open repository is simply the fact that the repository.config is there.

My first mistake:

Connect to Repo:

C:\kopia>kopia repository connect filesystem --path e:\kopia --config-file d:\kopia\repo.config

→ Success File was created

Check Status:

C:\kopia>kopia repository status
ERROR open repository: repository is not connected. See https://kopia.io/docs/repositories/

Via ProcessMonitor I could see that %APPDATA% is still being used.

So (my mistake) I had to use:

kopia repository status --config-file d:\kopia\repository.config

→ SUCCESS

My stupidity!

In order to get this to work statically, I tested the environment variable again. Here I had the error that I had only specified the path. But the file has to go here:

Variable: KOPIA_CONFIG_PATH
Value: d:\kopia\repository.config

Now all is working fine, also with (or without ;-))

kopia repository status
1 Like

Sometimes it is hard indeed to get to the bottom of all nitty gritty details. Thank you for sharing. Can be useful for others with similar issue(s).