Repositories

Like Git, backups live in repositories

Create Repository

General form: kopia repository create <provider> <flags>

# on local filesystem
kopia repository create filesystem --path d:/temp/kopia
 
# to an SFTP destination
kopia repository connect sftp \
        --path=backups \
        --host=sftp.neurrone.com \
        --username Backup \
        --keyfile=backup_ecdsa \
        --override-hostname=T480

This also connects Kopia to the repository that was just created.

Connecting to an existing repository

Use the same flags as create but instead of create use connect:

kopia repository connect filesystem --path d:/temp/kopia

Disconnecting from a repository

kopia repository disconnect

Snapshots

Creating Snapshots

# multiple paths are accepted
kopia snapshot create D:\temp\folder1 D:\temp\folder2

You can create snapshots for different folders, they will be individually tracked.

Mounting

Allows convenient browsing of snapshot contents and is the recommended way to do a restore.

# mounts the latest version of the repository when using the special path "all"
# otherwise, pass in the snapshot id to mount
kopia mount all /tmp/mnt

On Windows, a WebDav server is used for the mounting, replace the last argument with a free drive letter like Z:

Restoring snapshots

To restore the snapshot kf4b323108ef0e38362ad9d482548502e to d:/docs:

kopia restore kf4b323108ef0e38362ad9d482548502e d:/docs

Diffing Snapshots

# use the root ids of the snapshots to get the ids
kopia diff <snapshot1> <snapshot2>

Policies

kopia policy show --global
 
# ignoring files
# On Synology NAS, you probably want to ignore these files
kopia policy set --global --add-dot-ignore @eaDir
kopia policy set --global --add-dot-ignore "#recycle"
 
# set compression globally
kopia policy set --global --compression=s2-default

Connect To Repository With Different User Credentials

kopia repository connect --config-file /path/to/repository.config <usual connect params>
kopia --config-file /path/to/repository.config maintenance run

Setting cache directory

kopia cache set --cache-directory=...

Official Documentation