Page content


how do you backup your data … ? a really cool solution is borgbackup.

BorgBackup (short: Borg) gives you:

  • Space efficient storage of backups
  • Secure, authenticated encryption.
  • Compression: LZ4, zlib, LZMA, zstd (since borg 1.1.4).
  • Easy installation on multiple platforms: Linux, macOS, BSD, …
  • Free software (BSD license).
  • Backed by a large and active open source community.

Always a good Idea is to keep a Backup external. has a really competitve Offer (without Support). 100 GB for $18/year.

Install Borgbackup

pkg_add borgbackup

Generate KeyPair

mkdir /backup
ssh-keygen -o -a 100 -t ed25519 -C '"My Rsync Key"' -f /backup/id_ed25519_rsync-net

Public Key

you need to create an account at (or wherever you want) and put your public key (/backup/ to the .ssh/authrorized_key file

Backup Script

cat << 'EOF' > /backup/

# Vars

_date=$(date +"%Y%m%d-%H%M")

# Exports
export BORG_RSH='ssh -i /backup/id_ed25519_rsync-net'
export BORG_PASSPHRASE="${_passphrase}"
export BORG_REMOTE_PATH=borg1
export repo="${_rsync_user}@${_rsync_host}:${_app}"

## Hints ##

# Create Repo
#borg init -e repokey-blake2 ${repo}

# List Repo
#borg list ${repo} |grep ${_host}

# Show Last Backup
#borg list ${repo} |grep ${_host} |head -1 |awk '{print $1}'

# Restore File from last Backup
#borg extract ${repo}::`borg list ${repo} |grep ${_host} |head -1 |awk '{print $1}'` etc/hosts

# Do Backup
/usr/local/bin/borg create --compression lz4 -e keyfile ${_param} ${repo}::${_host}-${_date} \
        / \
        --exclude "*.pyc" \
        --exclude "*__pycache__*" \
        --exclude "/mnt" \
        --exclude "/tmp"

# Do Cleanup
/usr/local/bin/borg prune -v --list ${repo} --prefix ${_host} \
        --keep-hourly=2 \
        --keep-daily=8 \
        --keep-weekly=5 \
        --keep-monthly=13 \

# Done
exit 0

chmod 700 /backup/

you can now start your first backup by hand: ./backup/borgbackup and then add cronjob and run it daily


on Debian 12.2, i got the following Error Message when running Borgbackup

You do not have a supported version of the msgpack python package installed. Terminating. This should never happen as specific, supported versions are required by our Do not contact borgbackup support about this.


Downgrade msgpack from 1.0.7 to 1.0.3 (both were installed, 1.0.3 through ‘apt-get install’, 1.0.7 through ‘pip install …’)

# Remove Lock
root@docker:~# mv /usr/lib/python3.11/EXTERNALLY-MANAGED /usr/lib/python3.11/EXTERNALLY-MANAGED.old

# Uninstall Package
root@docker:~# pip3 uninstall msgpack
Found existing installation: msgpack 1.0.7
Uninstalling msgpack-1.0.7:
  Would remove:
Proceed (Y/n)? y

# run borg

Any Comments ?

sha256: 7ef0f27083824782021d670e36e682ab9ca52fca87c70532a902077b485e7568