Avant toute chose, il faut avoir installé Borg et initialisé un repository.
Plusieurs solutions pour l'installation, de pip3 à l'utilisation des dépôts de la distribution. Pour ma part, j'ai installé via les dépôts, sur une Debian 10 Buster :
root@debian:~# apt search borgbackup borgbackup/stable 1.1.9-2 amd64 deduplicating and compressing backup program (...) borgmatic/stable 1.2.11-1 amd64 automatically create, prune and verify backups with borgbackup root@debian:~# apt install borgbackup borgmatic
root@debian:~# generate-borgmatic-config Generated a sample configuration file at /etc/borgmatic/config.yaml. Please edit the file to suit your needs. The values are just representative. All fields are optional except where indicated. If you ever need help: https://torsion.org/borgmatic/#issues
Il y a pas mal de commentaires dans la configuration générée. Je les ai retiré pour mettre la configuration ici.
root@debian:~# grep -v "#" /etc/borgmatic/config.yaml location: source_directories: - /home - /etc - /data - /var/log/syslog* repositories: - serveurA@serveurB:/mnt/data/backups/serveurA storage: encryption_passphrase: "maGrossePassPhrase" checkpoint_interval: 1800 compression: lz4 retention: keep_hourly: 24 keep_daily: 7 keep_weekly: 4 keep_monthly: 6 consistency: checks: - repository - archives
root@debian:~# borgmatic -l root@debian:~# borgmatic --list debian-2019-07-29T12:36:07.775077 Mon, 2019-07-29 12:36:13 [785df6754aaf22946e21b09126bbfffe61f3f07ede975fc648e637a636b1e0d8]
root@debian:~# borgmatic -i root@debian:~# borgmatic --info Repository ID: afc0842fce13772d306b45df8643fdc2741a0c27056f30584a65084ca192c979 Location: ssh://serveurA@serveurB/mnt/data/backups/serveurA Encrypted: Yes (repokey BLAKE2b) Cache: /root/.cache/borg/afc0842fce13772d306b45df8643fdc2741a0c27056f30584a65084ca192c979 Security dir: /root/.config/borg/security/afc0842fce13772d306b45df8643fdc2741a0c27056f30584a65084ca192c979 ------------------------------------------------------------------------------ Original size Compressed size Deduplicated size All archives: 2.25 MB 950.02 kB 938.77 kB Unique chunks Total chunks Chunk index: 503 522
root@debian:~# crontab -l 0 3 * * * /usr/bin/borgmatic