Borgmatic vs BorgBackup: What's the Difference?

Quick Verdict

Borgmatic isn’t an alternative to BorgBackup — it’s a wrapper around it. BorgBackup is the backup engine. Borgmatic is the automation layer that makes BorgBackup easier to configure, schedule, and monitor. Use BorgBackup directly for simple manual backups. Use Borgmatic for anything automated.

Overview

AspectBorgBackupBorgmatic
What it isBackup engine (deduplication, encryption, compression)Configuration wrapper + scheduler for BorgBackup
RequiresNothing (standalone)BorgBackup (dependency)
ConfigurationCommand-line flags per invocationYAML config file (declarative)
SchedulingManual (cron/systemd timers)Built-in schedule support + cron integration
LanguagePython + C (performance-critical parts)Python
LicenseBSD-3GPL-3
Docker imageCommunity imagesOfficial ghcr.io/borgmatic-collective/borgmatic

The relationship: BorgBackup does the actual work — reading files, deduplicating, compressing, encrypting, and writing to the repository. Borgmatic wraps those BorgBackup commands behind a YAML config file and adds features BorgBackup doesn’t have: scheduling, hooks, health checks, database dumps, and monitoring integrations.

Feature Comparison

FeatureBorgBackup (bare)BorgBackup + Borgmatic
Create backupsborg create commandborgmatic (one command)
ConfigurationFlags per commandconfig.yaml (declarative)
Multiple repositoriesManual per-repo commandsSingle config, multiple repos
Retention policiesborg prune with flagsDeclarative in YAML
Consistency checksborg check manuallyAutomatic per schedule
Pre-backup hooksShell scripts around borgBuilt-in before_backup hooks
Post-backup hooksShell scripts around borgBuilt-in after_backup hooks
Database dumpsManual pg_dump/mysqldumpBuilt-in PostgreSQL/MySQL/MariaDB/SQLite dumps
Health monitoringManualHealthchecks.io, Cronitor, PagerDuty, ntfy integrations
Error notificationsManualBuilt-in hooks for email, webhooks
Multiple source dirsOne borg create per setSingle command, multiple source paths
Exclude patterns--exclude flagsClean YAML exclude lists
Docker deploymentCommunity imagesOfficial Docker image with cron built-in

When You Need Borgmatic

Use BorgBackup directly if:

  • You run manual, one-off backups
  • You have a simple single-directory backup to one repository
  • You’re comfortable writing shell scripts for automation
  • You want minimal dependencies

Example direct BorgBackup workflow:

# Initialize
borg init --encryption=repokey ssh://backup@nas/~/borg-repo

# Backup
borg create ssh://backup@nas/~/borg-repo::backup-$(date +%Y%m%d) /data

# Prune old backups
borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=6 ssh://backup@nas/~/borg-repo

Use Borgmatic if:

  • You want automated, scheduled backups
  • You back up multiple directories or to multiple repositories
  • You need pre/post backup hooks (database dumps, service stops)
  • You want health monitoring integration
  • You run in Docker and want a clean cron setup

Equivalent Borgmatic config:

# config.yaml
repositories:
  - path: ssh://backup@nas/~/borg-repo
    label: nas

source_directories:
  - /data
  - /config

exclude_patterns:
  - '*.tmp'
  - '.cache'

retention:
  keep_daily: 7
  keep_weekly: 4
  keep_monthly: 6

consistency:
  checks:
    - repository
    - archives

hooks:
  before_backup:
    - echo "Starting backup..."
  after_backup:
    - echo "Backup complete."
  healthchecks:
    ping_url: https://hc-ping.com/your-uuid

Run with a single command:

borgmatic

Docker Setup Comparison

BorgBackup in Docker (manual)

services:
  borgbackup:
    image: monachus/borgbackup:1.4.0
    container_name: borgbackup
    restart: unless-stopped
    volumes:
      - /data:/source:ro
      - /backup:/repository
      - ./borg-scripts:/scripts:ro
    entrypoint: /scripts/backup.sh

You need to write your own backup.sh script handling init, create, prune, and check.

Borgmatic in Docker (automated)

services:
  borgmatic:
    image: ghcr.io/borgmatic-collective/borgmatic:1.9.13
    container_name: borgmatic
    restart: unless-stopped
    volumes:
      - /data:/source:ro
      - /backup:/repository
      - ./config.yaml:/etc/borgmatic/config.yaml:ro
      - borgmatic-state:/root/.borgmatic
      - borgmatic-cache:/root/.cache/borg
    environment:
      BORG_PASSPHRASE: "your-encryption-passphrase"   # CHANGE THIS
      TZ: UTC
      CRON: "0 3 * * *"    # Run daily at 3 AM

volumes:
  borgmatic-state:
  borgmatic-cache:

Borgmatic’s Docker image includes cron built-in. Set the CRON environment variable and it handles scheduling automatically.

Database Backup Integration

One of Borgmatic’s strongest features is built-in database dumping:

# config.yaml
postgresql_databases:
  - name: nextcloud
    hostname: postgres
    port: 5432
    username: nextcloud
    password: changeme

mysql_databases:
  - name: wordpress
    hostname: mariadb
    username: root
    password: changeme

Borgmatic dumps the databases before creating the backup archive, ensuring consistent database snapshots. With bare BorgBackup, you’d write separate dump scripts and coordinate them with backup timing yourself.

The Verdict

ScenarioRecommendation
Learning BorgBackupStart with bare BorgBackup to understand the fundamentals
Production automated backupsUse Borgmatic — it’s the community standard
Docker deploymentBorgmatic (official image with cron)
Multiple repos/sourcesBorgmatic (single config handles everything)
Database backupsBorgmatic (built-in dump integration)
Monitoring/alertingBorgmatic (Healthchecks.io integration)
One-off manual backupsBorgBackup directly

Bottom line: If you’re setting up automated BorgBackup, there’s no reason not to use Borgmatic. It makes BorgBackup better without adding complexity. Think of it like Docker Compose for Docker — you can use Docker directly, but Compose makes everything more manageable.

Comments