Skip to content

Instantly share code, notes, and snippets.

@0187773933
Last active February 15, 2023 01:26
Show Gist options
  • Save 0187773933/7fe071c37304b5ad4de419ad58d61a03 to your computer and use it in GitHub Desktop.
Save 0187773933/7fe071c37304b5ad4de419ad58d61a03 to your computer and use it in GitHub Desktop.
Borg Backup Intro
https://github.com/borgbackup/borg
https://borgbackup.readthedocs.io/en/stable/internals/data-structures.html#chunker-details
1.) Init New Repo
borg init --encryption repokey-blake2 /Volumes/63614TB/COMBINED_BACKUP/BORG
2.) Export and Save the Key
borg key export /Volumes/63614TB/COMBINED_BACKUP/BORG
# BORG_KEY asdfasdfasdfasdf
3.) Save the Passphrase and Key in Bitwarden
4.) Edit the config file in the archive folder
# so we can store on 100 gb M-disks
Change :
segments_per_dir = 10
max_segment_size = 90000000
5.) Add a Folder to the archive
borg create --verbose --stats --progress --compression lz4 /Volumes/63614TB/COMBINED_BACKUP/BORG::TMP2 ~/TMP2
6.) Update the Folder
borg update --verbose --stats --progress --compression lz4 /Volumes/63614TB/COMBINED_BACKUP/BORG::TMP2 ~/TMP2
7.) Show Versions of a File
borg list --short --show-version /path/to/repo::my-backup
#!/bin/bash
# Set the path to your Borg repository
repo_path="/Volumes/63614TB/COMBINED_BACKUP/Dropbox"
folder_path="/Users/morpheous/Dropbox/School/WSU/2023"
export BORG_PASSPHRASE="asdfasdfasdfasdfasdfasdfasdfasdf"
# Set the name of the archive
folder_name="School"
# Get the current timestamp
timestamp=$(date +%d%b%Y-%H%M%S | tr '[:lower:]' '[:upper:]')
# Create a new archive with the timestamp as the archive name
borg create --verbose --stats --progress --compression lz4 "$repo_path::$folder_name-$timestamp" "$folder_path"
sleep 1
# Prune old backups, keeping only the most recent backups
borg prune --verbose --stats --progress "$repo_path" --keep-last=7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment