https://habr.com/ru/company/flant/blog/420055/
https://borgbackup.readthedocs.io/en/stable/installation.html
1. install borg on both backup server and client :
portsnap fetch update ; portmaster -Dbg archivers/py-borgbackup
2. Add user on server
# pw user add -n borg -m -s /sbin/nologin
3. on client generate ssh key :
# ssh-keygen -b 4096
4. on server add key :
# cd /home/borg//.ssh
# echo 'command="/usr/local/bin/borg serve" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNdaDfqUUf/XmSVWfF7PfjGlbKW00MJ63zal/E/mxm+vJIJRBw7GZofe1PeTpKcEUTiBBEsW9XUmTctnWE6p21gU/JNU0jITLx+vg4IlVP62cac71tkx1VJFMYQN6EulT0alYxagNwEs7s5cBlykeKk/QmteOOclzx684t9d6BhMvFE9w9r+c76aVBIdbEyrkloiYd+vzt79nRkFE4CoxkpvptMgrAgbx563fRmNSPH8H5dEad44/Xb5uARiYhdlIl45QuNSpAdcOadp46ftDeQCGLc4CgjMxessam+9ujYcUCjhFDNOoEa4YxVhXF9Tcv8Ttxolece6y+IQM7fbDR' > authorized_keys
# chown -R borg:borg /home/borg/.ssh/
5. on client init repo
# borg init -e none ssh:
6. on client run first backup :
# borg create --stats --list ssh://borg@host:port/path/to/backup::"MyFirstBackup-{now:%Y-%m-%d_%H:%M:%S}" /etc /root /usr/local/etc
------------------
List backups
on client machine :
borg list ssh://borg@host:port/path/to/backups
on server :
borg list /path/to/backups
-----------------
List files in backups :
borg list /path/to/backups::MyBackup-<date>
-------------
Extract file or directory from backup (on server) :
borg extract /path/to/backups::MyBackup-<date> etc/hostname
------------