I use borg
with borgmatic
. Downside is that there is no gui like vorta
, upside is that the borgmatic
documentation is very good, and the dev is a very helpful guy (and so is the dev of borg
, btw). In addition, borgmatic
runs as a systemd
service, so you can forget about it after some configuration.
I backup my whole /
which may be too much. In the config.yaml
I set up the following exclude list which is more or less the same list as the timeshift
exlucde list. I set up seperate config for my home directory. Here’s a shortened version of this configs:
# cat /etc/borgmatic/config.yaml
# Where to look for files to backup, and where to store those backups.
# See https://borgbackup.readthedocs.io/en/stable/quickstart.html and
# https://borgbackup.readthedocs.io/en/stable/usage/create.html
# for details.
location:
# List of source directories to backup (required). Globs and
# tildes are expanded.
source_directories:
# - /home
# - /etc
# - /var/log/syslog*
# - /etc/pacman.d/gnupg
- /usr/lib/modules
- /
# Paths to local or remote repositories (required). Tildes are
# expanded. Multiple repositories are backed up to in
# sequence. Borg placeholders can be used. See the output of
# "borg help placeholders" for details. See ssh_command for
# SSH options like identity file or port. If systemd service
# is used, then add local repository paths in the systemd
# service file to the ReadWritePaths list.
repositories:
# - user@backupserver:sourcehostname.borg
# - user@backupserver:{fqdn}
- /mnt/data/EOSSystem
# Any paths matching these patterns are excluded from backups.
# Globs and tildes are expanded. See the output of "borg help
# patterns" for more details.
exclude_patterns:
# - '*.pyc'
# - /home/*/.cache
- /boot/efi
- /dev/
- /proc/
- /sys/
- /media/
- /mnt/
- /tmp/
- /run/
- /var/run/
- /var/lock/
- /var/lib/docker/
- /var/lib/schroot/
- /lost+found
- /timeshift/
- /timeshift-btrfs/
- /data/
- /DATA/
- /cdrom/
- /sdcard/
- /system/
- /etc/timeshift.json
- /var/log/timeshift/
- /var/log/timeshift-btrfs/
- /swapfile
- /snap/
- /root/.thumbnails
- /root/.cache
- /root/.dbus
- /root/.gvfs
- /root/.local/share/[Tt]rash
- /home/*/.thumbnails
- /home/*/.cache
- /home/*/.dbus
- /home/*/.gvfs
- /home/*/.local/share/[Tt]rash
- /root/.mozilla/firefox/*.default/Cache
- /root/.mozilla/firefox/*.default/OfflineCache
- /root/.opera/cache
- /root/.kde/share/apps/kio_http/cache
- /root/.kde/share/cache/http
- /home/*/.mozilla/firefox/*.default/Cache
- /home/*/.mozilla/firefox/*.default/OfflineCache
- /home/*/.opera/cache
- /home/*/.kde/share/apps/kio_http/cache
- /home/*/.kde/share/cache/http
- /var/cache/apt/archives/
- /var/cache/pacman/pkg/
- /var/cache/yum/
- /var/cache/dnf/
- /var/cache/eopkg/
- /var/cache/xbps/
- /var/cache/zypp/
- /var/cache/edb/
- /root/
- /home/*/
# Repository storage options. See
# https://borgbackup.readthedocs.io/en/stable/usage/create.html and
# https://borgbackup.readthedocs.io/en/stable/usage/general.html for
# details.
storage:
# Passphrase to unlock the encryption key with. Only use on
# repositories that were initialized with passphrase/repokey
# encryption. Quote the value if it contains punctuation, so
# it parses correctly. And backslash any quote or backslash
# literals as well. Defaults to not set.
encryption_passphrase: "MyUltraSecretPassphrase"
# Retention policy for how many backups to keep in each category. See
# https://borgbackup.readthedocs.io/en/stable/usage/prune.html for
# details. At least one of the "keep" options is required for pruning
# to work. To skip pruning entirely, run "borgmatic create" or "check"
# without the "prune" action. See borgmatic documentation for details.
retention:
# Keep all archives within this time interval.
# keep_within: 3H
# Number of daily archives to keep.
keep_daily: 7
# Number of weekly archives to keep.
keep_weekly: 4
# Consistency checks to run after backups. See
# https://borgbackup.readthedocs.io/en/stable/usage/check.html and
# https://borgbackup.readthedocs.io/en/stable/usage/extract.html for
# details.
consistency:
# List of one or more consistency checks to run: "repository",
# "archives", "data", and/or "extract". Defaults to
# "repository" and "archives". Set to "disabled" to disable
# all consistency checks. "repository" checks the consistency
# of the repository, "archives" checks all of the archives,
# "data" verifies the integrity of the data within the
# archives, and "extract" does an extraction dry-run of the
# most recent archive. Note that "data" implies "archives".
checks:
- repository
- archives
Here’s the home config:
# cat /etc/borgmatic.d/home.yaml
# Where to look for files to backup, and where to store those backups.
# See https://borgbackup.readthedocs.io/en/stable/quickstart.html and
# https://borgbackup.readthedocs.io/en/stable/usage/create.html
# for details.
location:
# List of source directories to backup (required). Globs and
# tildes are expanded.
source_directories:
- /home
# - /etc
# - /var/log/syslog*
# Any paths matching these patterns are excluded from backups.
# Globs and tildes are expanded. See the output of "borg help
# patterns" for more details.
exclude_patterns:
# - '*.pyc'
- /home/*/.thumbnails
- /home/*/.cache
- /home/*/.dbus
- /home/*/.gvfs
- /home/*/.local/share/[Tt]rash
- /home/*/.mpd/music
# Retention policy for how many backups to keep in each category. See
# https://borgbackup.readthedocs.io/en/stable/usage/prune.html for
# details. At least one of the "keep" options is required for pruning
# to work. To skip pruning entirely, run "borgmatic create" or "check"
# without the "prune" action. See borgmatic documentation for details.
retention:
# Keep all archives within this time interval.
# keep_within: 3H
# Number of daily archives to keep.
keep_daily: 7
# Number of weekly archives to keep.
keep_weekly: 4
# Number of monthly archives to keep.
keep_monthly: -1
# Number of yearly archives to keep.
# keep_yearly: 1
# When pruning, only consider archive names starting with this
# prefix. Borg placeholders can be used. See the output of
# "borg help placeholders" for details. Defaults to
# "{hostname}-". Use an empty value to disable the default.
# prefix: sourcehostname
# Consistency checks to run after backups. See
# https://borgbackup.readthedocs.io/en/stable/usage/check.html and
# https://borgbackup.readthedocs.io/en/stable/usage/extract.html for
# details.
consistency:
# List of one or more consistency checks to run: "repository",
# "archives", "data", and/or "extract". Defaults to
# "repository" and "archives". Set to "disabled" to disable
# all consistency checks. "repository" checks the consistency
# of the repository, "archives" checks all of the archives,
# "data" verifies the integrity of the data within the
# archives, and "extract" does an extraction dry-run of the
# most recent archive. Note that "data" implies "archives".
checks:
- repository
- archives
Instead of backup the whole / you could use a version with only /etc
and /var
with a hook to create a package list in order to get your system up fast after a fresh install, again in a shortened version:
# cat /etc/borgmatic.d/test/etc.yaml
# Where to look for files to backup, and where to store those backups.
# See https://borgbackup.readthedocs.io/en/stable/quickstart.html and
# https://borgbackup.readthedocs.io/en/stable/usage/create.html
# for details.
location:
# List of source directories to backup (required). Globs and
# tildes are expanded.
source_directories:
# - /home
# - /etc
# - /var/log/syslog*
# - /etc/pacman.d/gnupg
- /etc
- /var
# Any paths matching these patterns are excluded from backups.
# Globs and tildes are expanded. See the output of "borg help
# patterns" for more details.
exclude_patterns:
# - '*.pyc'
# - /home/*/.cache
- /var/run/
- /var/lock/
- /var/lib/docker/
- /var/lib/schroot/
- /etc/timeshift.json
- /var/log/timeshift/
- /var/log/timeshift-btrfs/
- /var/cache/apt/archives/
- /var/cache/pacman/pkg/
- /var/cache/yum/
- /var/cache/dnf/
- /var/cache/eopkg/
- /var/cache/xbps/
- /var/cache/zypp/
- /var/cache/edb/
hooks:
# List of one or more shell commands or scripts to execute
# before creating a backup, run once per configuration file.
before_backup:
- /bin/sh -c '/usr/bin/pacman -Qqe > /etc/pkglist.txt'