Skip to main content
Browse documentation

Back up and restore with Borg

Use a compatible Borg 1.x client with this service. The account's Borg repository is fixed at /data/borg. Configure the cn-backup SSH alias and verify the host fingerprint with SFTP first.

Initialize once​

borg init --encryption=repokey cn-backup:/data/borg

Choose and retain the repository passphrase. Export the repository key to a safe local location:

borg key export cn-backup:/data/borg ./caliber-borg-key.txt

Keep the key export and passphrase accessible separately from the storage account. Initialize only a new repository; reconnecting from another computer does not require initializing it again.

Create and list archives​

borg create --stats \
'cn-backup:/data/borg::{hostname}-{now:%Y-%m-%d_%H-%M-%S}' \
./documents
borg list cn-backup:/data/borg
borg info cn-backup:/data/borg

The archive name identifies one backup run. Each additional run creates another archive while Borg deduplicates repeated content.

Restore an archive​

Copy an archive name from borg list, replacing ARCHIVE_NAME below:

borg list cn-backup:/data/borg::ARCHIVE_NAME
mkdir -p ./borg-restore
cd ./borg-restore
borg extract cn-backup:/data/borg::ARCHIVE_NAME

Extraction writes into your current local directory. Open several restored files before using them to replace live data.

Check and manage retention​

borg check cn-backup:/data/borg
borg prune --dry-run --list --keep-daily 7 --keep-weekly 4 cn-backup:/data/borg

Review the proposed archive removals. Remove --dry-run only when those removals match your retention plan. With a Borg 1.x version supporting compaction, borg compact cn-backup:/data/borg reclaims space after pruning. Avoid overlapping maintenance and backup jobs.

If Borg reports a version mismatch, record both the client version (borg --version) and the error for support. Do not substitute Borg 2 commands or a custom borg serve path into this guide.

Borg's upstream command reference covers additional archive and restore options.