Back up to a Storage Box with BorgBackup or restic
Make encrypted, deduplicated backups to your THOST Storage Box with BorgBackup or restic, keep a sensible history on a schedule, and restore files.
BorgBackup and restic both deduplicate, compress and encrypt on your machine before anything is uploaded, so the Storage Box only ever sees encrypted data. Borg is the classic choice on Linux and macOS servers; restic is a single program that also runs on Windows.
Before you start
- Install borg on the computer or server you are backing up (
sudo apt install borgbackupon Debian and Ubuntu,brew install borgbackupon macOS). - Or install restic (restic.net;
sudo apt install restic,brew install restic, or the Windows download). - Add an SSH key to the box, and the
thost-boxentry to~/.ssh/config, so backups run without a password.
Steps (BorgBackup)
- Point borg at the box: (Without the config entry:
ssh://bx1a2b3@storage.t-host.co.uk:21234/./repowith your username and port.)export BORG_REPO=ssh://thost-box/./repo - Create the repository and choose a strong passphrase:
borg init --encryption=repokey - Export the key and keep it safe, off the box. Without the key and passphrase nobody, including THOST, can read the backups:
borg key export "$BORG_REPO" ~/thost-borg-key.txt - Make your first backup:
borg create --stats ::'{hostname}-{now}' ~/Documents ~/Pictures - Keep a sensible history: Recent borg versions also need
borg compactnow and then to free the space.borg prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6 - Schedule it. Put steps 4 and 5 in a script and run it daily from cron or a systemd timer, with
BORG_PASSPHRASEset in the script's environment (readable only by you).
Restore with borg
borg list
borg extract ::ARCHIVE-NAME path/to/fileRun borg extract in an empty folder: it restores into the current directory. Vorta gives borg a desktop interface on Linux and macOS.
Steps (restic)
- Point restic at the box: (Or with the port in the address:
sftp://bx1a2b3@storage.t-host.co.uk:21234/restic, using your username and port.)export RESTIC_REPOSITORY=sftp:thost-box:restic - Create the repository and choose a strong password. Keep it somewhere safe: without it the backups cannot be read.
restic init - Back up:
restic backup ~/Documents ~/Pictures - Keep a sensible history:
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune - Schedule it with cron, a systemd timer or Windows Task Scheduler, with
RESTIC_PASSWORD_FILEpointing at a file only you can read.
Restore with restic
restic snapshots
restic restore latest --target ~/restoreQuestions
Is borg safe if my server is hacked?
An attacker on your server could delete the repository using the same SSH key. The Storage Box also keeps seven nightly read-only snapshots, which cannot be deleted from your side, so the last seven nights are still there. See restore from snapshots.
How much space will it use?
Borg deduplicates and compresses, so a year of nightly backups of a server usually takes little more than one full copy.
restic says it cannot parse the port.
Older restic versions and some GUI clients cannot take the port in the address. Add Host, HostName, User and Port to ~/.ssh/config as above and use sftp:thost-box:restic.
Can I see restic's history?
Yes: restic snapshots lists them. The Storage Box's own nightly snapshots are extra protection on top.
Did this not solve it? Open a support ticket and tell us which guide you followed. We answer every ticket ourselves.