Merged from existing Borg-related notes in this database


Borg Backup How To

<aside> 📝

Consolidated from two duplicate "Borg Backup How To" pages

</aside>

location: source_directories:

repositories:
    - [[email protected]](<mailto:[email protected]>):path
remote_path: borg1

exclude_patterns:
    - '*.pyc'
    - ~/*/.cache

exclude_if_present: .nobackup
one_file_system: true

storage: compression: auto,zstd encryption_passphrase: CHANGEME archive_name_format: ‘{hostname}-{now:%Y-%m-%d-%H%M%S}’

retention: keep_daily: 3 keep_weekly: 4 keep_monthly: 12 keep_yearly: 2 prefix: ‘{hostname}-’

consistency: checks:

check_last: 3
prefix: '{hostname}-'

hooks: before_backup:

after_backup:
    - echo "`date` - Finished backup"

Cron example

01 */2 * * * PATH=$PATH:/usr/bin:/usr/local/bin /usr/bin/borgmatic –verbosity 1 > ~/borgmatic_lastrun.txt 2<&1

Ad-hoc create examples

borg -p –remote-path=borg1 create [[email protected]](<mailto:[email protected]>):/data3/home/8326/BorgBackups/USB/Lexar128/ .

borg-macosx64 create -p \
  –exclude=.Spotlight-V100 \
  –exclude=.TemporaryItems \
  –exclude=.Trashes \
  –remote-path=borg1 \
  [[email protected]](<mailto:[email protected]>):"/data3/home/8326/BorgBackups/USB/Lexar128/::`date`-Lexar128" .