Skip to main content

borg-drone

builds.sr.ht status

(yet another) borg wrapper.

This application is a helper to run multiple borg backups with a single command.

Dependencies

  • borg
  • Python 3.5+

Installation

Install via pip (WIP)

pip install borg-drone

Install from source (requires pip v21.2 or later)

git clone https://git.sr.ht/~jmstover/borg-drone
cd borg-drone
pip install .

Usage

Generate a new configuration file

borg-drone generate-config

Edit the configuration file to suit the local backup needs

# borg-drone configuration consists of two main sections: 'repositories' and 'archives'
#
# Repositories are local or remote (SSH) targets where the borg repository will be created.
# Many repositories can be defined in this section, but only those referenced by an archive will be used.
#
# Archives are local to the machine running borg-drone and define the folders to be backed up and excluded.
# All archives defined here will be used by default.


repositories:

  # Local repository definitions
  local:

    # Local backup location A
    local-example:
      path: /backups/example-a
      encryption: keyfile-blake2
      prune:
        - keep-daily: 7
        - keep-weekly: 3
        - keep-monthly: 6
        - keep-yearly: 2
      compact: false

    # Local backup location B which will be uploaded to an rclone remote
    local-example-2:
      path: /backups/example-b
      encryption: keyfile
      compact: true
      upload_path: 'b2:backups'


  # Remote repository definitions
  remote:

    # Remote borg repository located at backups.example.com
    remote-example:
      hostname: backups.example.com
      username: backup
      port: 22
      ssh_key: ~/.ssh/borg
      encryption: repokey-blake2
      prune:
        - keep-daily: 7
        - keep-weekly: 3
        - keep-monthly: 6
        - keep-yearly: 2
      compact: false



archives:

  # Backup definition for this machine
  this-machine:

    # Use multiple repositories as defined above
    repositories:
      - local-example-a
      - remote-example

    # Include the following directories
    paths:
      - ~/.ssh
      - ~/.gnupg
      - ~/Desktop
      - ~/Documents
      - ~/Pictures

    # Exclude the following patterns (these are passed directly to borg)
    exclude:
      - "**/venv"
      - "**/node_modules"

    # Enable the --one-file-system borg options
    one_file_system: true

List all configured targets

borg-drone targets

Initialise repositories (This calls borg init on all repositories)

borg-drone init

Export the keys and password files for backup outside of the repository. These will be required in order to restore the backup!

borg-drone key-export

Clean up the exported key files so they do not hang around on your machine

borg-drone key-cleanup

Create a new backup (This calls borg create on all repositories)

borg-drone create

View repository info. (This calls borg info on all repositories)

borg-drone info

List repository files. (This calls borg list on all repositories)

borg-drone list

Import an existing key and password into a target

# Import key and password for archive 'this-machine' on repository 'local-example-a'
borg-drone key-import this-machine:local-example-a --keyfile /path/to/keyfile --password-file /path/to/password-file

rclone Uploads

Local repositories can optionally be uploaded to an rclone remote upload_path option.

This feature required rclone to be installed and configured. A remote must be initialised prior to running borg-drone create. See the rclone documentation for details.

Repositories will be uploaded to <upload_path>/<archive_name>

e.g. Using the following configuration:

repositories:
  local:
    usb:
      path: /backup/usb
      encryption: keyfile-blake2
      upload_path: 'b2:backups'
archives:
  archive1:
    repositories:
      - usb
    paths:
      - /data

Data will first be backed up to a borg repository located at /backup/usb, then the borg repository itself will be uploaded to the remote path b2:backups/archive1/

Metadata

Release files for borg-drone 0.2.0.post0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for borg-drone 0.2.0.post0
File Size Uploaded Provenance
borg_drone-0.2.0.post0.tar.gz 13.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for borg-drone 0.2.0.post0
File Interpreter ABI Platform
borg_drone-0.2.0.post0-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / borg_drone-0.2.0.post0.tar.gz

Download URL borg_drone-0.2.0.post0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
31f2dd85b219771ab83ff377a258db5127f049683577065f10b1839f94cd0227
BLAKE2b-256 checksum
How to use checksums
702513209571ba89cb3710e3a76c3839ab3add1ddc224e39dfccaaa9c5a1a893
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / borg_drone-0.2.0.post0-py3-none-any.whl

Download URL borg_drone-0.2.0.post0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d676227844029633e4af8659cdd4dfc6703a1008f63f0e42321e6caf8f7b34dd
BLAKE2b-256 checksum
How to use checksums
024c8b96fcfc04a6754257d9e66d690ee2f49f49f116868a04c2e8cefd192a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Security for borg-drone 0.2.0.post0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page