# 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
# 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
# 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
# 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
# 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
# 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
services: borgbackup: image: monachus/borgbackup:1.4.0 container_name: borgbackup -weight: 500;">restart: unless-stopped volumes: - /data:/source:ro - /backup:/repository - ./borg-scripts:/scripts:ro entrypoint: /scripts/backup.sh
services: borgbackup: image: monachus/borgbackup:1.4.0 container_name: borgbackup -weight: 500;">restart: unless-stopped volumes: - /data:/source:ro - /backup:/repository - ./borg-scripts:/scripts:ro entrypoint: /scripts/backup.sh
services: borgbackup: image: monachus/borgbackup:1.4.0 container_name: borgbackup -weight: 500;">restart: unless-stopped volumes: - /data:/source:ro - /backup:/repository - ./borg-scripts:/scripts:ro entrypoint: /scripts/backup.sh
services: borgmatic: image: ghcr.io/borgmatic-collective/borgmatic:2.1.3 container_name: borgmatic -weight: 500;">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:
services: borgmatic: image: ghcr.io/borgmatic-collective/borgmatic:2.1.3 container_name: borgmatic -weight: 500;">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:
services: borgmatic: image: ghcr.io/borgmatic-collective/borgmatic:2.1.3 container_name: borgmatic -weight: 500;">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:
# config.yaml
postgresql_databases: - name: nextcloud hostname: postgres port: 5432 username: nextcloud password: changeme mysql_databases: - name: wordpress hostname: mariadb username: root password: changeme
# config.yaml
postgresql_databases: - name: nextcloud hostname: postgres port: 5432 username: nextcloud password: changeme mysql_databases: - name: wordpress hostname: mariadb username: root password: changeme
# config.yaml
postgresql_databases: - name: nextcloud hostname: postgres port: 5432 username: nextcloud password: changeme mysql_databases: - name: wordpress hostname: mariadb username: root password: changeme - 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 - You want automated, scheduled backups
- You back up multiple directories or to multiple repositories
- You need pre/post backup hooks (database dumps, -weight: 500;">service stops)
- You want health monitoring integration
- You run in Docker and want a clean cron setup - How to Self-Host BorgBackup
- How to Self-Host Borgmatic
- Restic vs BorgBackup
- Restic vs Kopia vs BorgBackup
- Kopia vs Restic
- Best Self-Hosted Backup Solutions
- Self-Hosted Alternatives to CrashPlan
- Backup Strategy