Borgbackup: Difference between revisions

Line 60: Line 60:
* Note that borgbackup <code>1.1.11</code> included in Ubuntu 20.04 has a memory leak when using <code>--progress</code> [https://github.com/borgbackup/borg/issues/5162 documented here]. Download a newer version of borgbackup.
* Note that borgbackup <code>1.1.11</code> included in Ubuntu 20.04 has a memory leak when using <code>--progress</code> [https://github.com/borgbackup/borg/issues/5162 documented here]. Download a newer version of borgbackup.
* You should extract to an empty folder since borg does not delete existing files in the target folder.
* You should extract to an empty folder since borg does not delete existing files in the target folder.
==Example Scripts==
{{hidden | backup.sh |
<pre>
REPOSITORY="ssh://t440s-server-local:~/Backups/my_backup"
ARCHIVE_NAME="{hostname}-{utcnow}"
SOURCE_DIR="./"
BACKUP_DIRS=(
  "."
)
BORG_CREATE_FLAGS=(
  "--stats"
  "--progress"
  "-x"
  "--show-rc"
)
BORG_PRUNE_FLAGS=(
  "--keep-daily"
  "3"
  "--keep-weekly"
  "1"
  "--keep-monthly"
  "1"
  #  "--stats"
  "--list"
  "--show-rc"
)
EXCLUSIONS=(
  "-e" "System Volume Information"
  "-e" "\$RECYCLE.BIN"
)
BORG_EXEC="borg"
if [ -d "${SOURCE_DIR}" ]
then
  cd "${SOURCE_DIR}" && \
  $BORG_EXEC create "${BORG_CREATE_FLAGS[@]}" "${EXCLUSIONS[@]}" "${REPOSITORY}"::"${ARCHIVE_NAME}" "${BACKUP_DIRS[@]}" && \
  $BORG_EXEC prune "${BORG_PRUNE_FLAGS[@]}" "${REPOSITORY}"
fi
</pre>
}}


==Resources==
==Resources==
* [https://practical-admin.com/blog/backups-using-borg/ practical-admin backups using borg]
* [https://practical-admin.com/blog/backups-using-borg/ practical-admin backups using borg]