initialize
borg init --encryption=repokey /run/media/kota/sietch/borg
It will interactively prompt for a passphrase. When finished you should backup
the passphrase and key in your password manager. Export the key:
borg key export --paper /run/media/kota/sietch/borg
create backup
borg create -s --progress /run/media/kota/sietch/borg::{user}-{now:%Y-%m-%dT%H:%M:%S} ~/docs
or create a script:
#!/bin/sh
export BORG_REPO=/run/media/kota/sietch/borg
borg create \
--stats \
--progress \
--exclude "$HOME/docs/games/*" \
--exclude "$HOME/docs/podcasts/*" \
--exclude "$HOME/docs/audiobooks/*" \
--exclude "$HOME/docs/iso/*" \
\
::'{user}-{now}' \
~/docs \
~/pics \
~/music \
~/g \
borg prune \
--list \
--prefix '{user}-' \
--show-rc \
--keep-weekly 2 \
--keep-monthly 2 \
list archives
borg list /run/media/kota/sietch/borg
extracting is a little funky
Say you just accidentally deleted your favorite artist's folder from
/home/kota/music/
You can search a recent archive to see if it's available:
borg list /run/media/kota/sietch/borg::kota-2021-09-25T18:53:21 | grep "Death Grips"
You should see results with paths like:
home/kota/music/Death Grips/Album/file.mp3
Borg's extract command extracts relative to your CWD so your should do the following:
cd /
borg extract /run/media/kota/sietch/borg::kota-2021-09-25T18:53:21 "home/kota/music/Death Grips"
If you're unsure just use the --dry-run option.
Alternatively you can mount a backup and copy the files out manually:
borg mount /run/media/kota/sietch/borg::kota-2021-10-05T21:39:41 tmp/borg