borg-backup-scripts/README.md

1.5 KiB

borg-backup-scripts

borg backup scripte used on KrautSpace infra

Requirements

sudo apt install borg

Usage

Initialization

sudo ./init.sh remote_site_1 --host=whatever.your-storagebox.de --port=23 --login=whatever --directory=/home/borg

What this does:

  • Creates a config directory at /etc/borg/remote_site_1.
  • Creates a passphrase for borg.
  • Creates a ssh keypair for the ssh connection to your remote ssh backup destination host.
  • Deploys the ssk public key to the remote ssh account using ssh-copy-id.
  • Checks if the destination path is usable.
  • Initializes the borg repository.
  • Prints out the borg repository status if initialization was successfull.
  • Attempts to continue the init process if called multiple times.

Service installation

# on productive system: copy systemd-units in /etc/systemd/system
sudo ./install.sh

# on development system: link systemd-units from current directory
sudo ./install_as_link.sh

Service activation

sudo systemctl enable borg-backup@remote_site_1.timer
sudo systemctl enable borg-prune@remote_site_1.timer

FAQ

Why so much sudo?

Good question!
The borg backup process requires priviledges to read everything you want to backup.
The systemd-units sandbox the borg process to a read-only view of the filesystem.

Can I trust this code?

Never trust anything from the internet.
Download and verify what it does. It should be somewhat readable.