Backup file with Kopia and Rclone to Storj

Because of Storj lack of support MOVE, check it out here: https://kopia.discourse.group/t/experimenting-with-rclone/304/5

Step 1 Setup personal S3 compatible bucket on Storj

Therefore, for the best compatibility, I configured bucket with my own custom passphrase with S3 compatible Access Key with the same custom passphrase.

Step 2, Setup Rclone with S3 compatible target and mount it.

rclone mount --vfs-cache-mode writes storj-s3:jp4 /mnt/storj-s3 --daemon --allow-non-empty

Step 3, Setup kopia backup file to local file system

https://kopia.io/docs/repositories/#local-storage

# Setup kopia backup on your local machine
kopia repository create filesystem --path /root/tmp-backup-server/

>
Enter password to create new repository:
Re-enter password for verification:
Initializing repository with:
  block hash:          BLAKE2B-256-128
  encryption:          AES256-GCM-HMAC-SHA256
  splitter:            DYNAMIC-4M-BUZHASH
Connected to repository.

# Connect to kopia repo
kopia repository connect filesystem --path /root/tmp-backup-server/

Check Kopia current status

kopia repository status
Config file:         /root/.config/kopia/repository.config
Description:         Repository in Filesystem: /root/tmp-backup-server/
Hostname:            jp4
Username:            root
Read-only:           false

Storage type:        filesystem
Storage config:      {
                       "path": "/root/tmp-backup-server/",
                       "dirShards": null,
                       "fileMode": 384,
                       "dirMode": 448
                     }

Unique ID:           00a89dc324c4de4fxxxxxx7f9fdf3eaaf98dd3c
Hash:                BLAKE2B-256-128
Encryption:          AES256-GCM-HMAC-SHA256
Splitter:            DYNAMIC-4M-BUZHASH
Format version:      1
Max pack length:     20 MiB

Create Kopia snapshot and sync Rclone to Storj


# https://kopia.io/docs/getting-started/#creating-initial-snapshot

kopia snapshot create /data/wwwroot
rclone sync /root/tmp-backup-server/ storj-s3:jp4/kopia -v -c

Grep repository with Unique ID and mount

mkdir /tmp/mnt

## Grep snapshot ID and mount
kopia mount $(kopia snapshot list | tail -1 |awk '{print $4}') /tmp/mnt &

# Cd into directory
cd /tmp/mnt

Kopia delete snapshot

## List all snapshot
kopia snapshot list -m

>root@xxx:/data/wwwroot
  2021-08-24 18:42:59 CST kad87db458ecf6656eb17fc40053a51ae 10 GB drwxr-xr-x manifest:63465ec8b4c11ef89e09d211ce2ea1e2 files:195320 dirs:26901 (latest-1,annual-1,monthly-1,weekly-1,daily-1,hourly-1)

## Delete snapshot 
kopia snapshot delete kad87db458ecf6656eb17fc40053a51ae --delete

## One key delete
kopia snapshot delete $(kopia snapshot list -m | awk '{print $4}') --delete
kopia maintenance run --full --safety=none

Kopia .kopiaignore

Put it on your root directory

**/node_modules/
**/site-packages/
backup/
.npm/
**/.cache
.cache/
.rvm/
.gvm/
.nvm/
.konan/
.vscode*/
.node-gyp/
.gradle/
.gem/
.android/
.cargo/

Library/*

obsidian/
**/.DS_Store