Introduction
- Hardware: refurbished laptop
- YunoHost version: up to date
- I have access to my server : Either through SSH or webadmin
- special context / particular tweaking : no yet
I recently started with Yunohost, and I don’t have all the tips to make my life easier.
So your comments are welcome, both to help me learn, and to simplify this tuto
Goal
Use the Yunohost Borgbackup application to externalize backups on a borgbase server.
This is a step-by-step tuto from scratch.
Prerequisite
- Create a pair of SSH keys and display the public key
$ ssh-keygen -t ed25519 -a 100
$ less .ssh/id_ed25519.pub
-
Create an account on Borgbase
-
drop the SSH public key
- in
Account
,SSH keys
, click onAdd Key
- copy/paste SSH public key with a name (arbitrary) and validate
- in
-
Create a backup repository
- in
Repositories
, click onNew Repo
- fill the name and choose the existing SSH key for a
full access
- in
- The repository list provide those information :
- on the left, you can copy the repository name
- the form of repository URL is
<hash@hash>.repo.borgbase.com<:repo>
- in the
Security
column, the printfinger icon provide you the SSH fingerprint of the Borgbase server
Borgbackup app on Yunohost
- Install
Borg Backup App
(through the webadmin)- provide Borgbase.com server URL in the form of
ssh://<hash@hash>.repo.borgbase.com:22/~/repo
- provide a strong backup passphrase and keep it safe (in several place following the 3-2-1 rules too)!
- a mail is sent to the yunohost server administrator by install script in which is listed the public key to configure in borgbase repo
- provide Borgbase.com server URL in the form of
- add the SSH public key of the Borgbackup app on the Borgbase server
- on the Yunohost serveur, copy the content of
.ssh/id_borg_ed25519.pub
or copy it from the email - on the Borgbase server, in
Account
,SSH keys
, click onAdd Key
- past the public key, add a name (arbitrary) and validate
- in
Repositories
, édit the repository - choose the new SSH key (we discourage yout to select the
append-only access
as this feature doesn’t act as its name suggest it, read attentively the following link to know more Additional Notes — Borg - Deduplicating Archiver 1.2.7 documentation)
- on the Yunohost serveur, copy the content of
The SSH key
id_borg_ed25519
created by Borgbackup installer doesn’t ask password. It allow backup automation.
Initialize and test
- The first run will initialize the repository
- By default, you have to wait the timer trigger specified at installation
- At this time you received a “[YNH] First backup is starting” email.
- You can launch a backup manually
- in Webadmin > Services > Borg
- in shell with
systemctl start borg.service
Troubleshooting
- check the repository
$ BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 " borg list <hash@hash>.repo.borgbase.com:repo
Enter passphrase for key ssh://<hash@hash>.repo.borgbase.com/./repo:
auto_conf_21_03_21_00:00 Sun, 2021-03-21 06:00:11 [00858c0db2863e6ab144682f1b18002d9b5666b5f3352ff0f813cc50ae345d65]
auto_data_21_03_21_00:00 Sun, 2021-03-21 06:00:18 [cfc19598981410cccd17e98cec207c74211b596d5fb38a1a0f043712e70e34a0]
auto_borg_21_03_21_00:00 Sun, 2021-03-21 06:00:33 [07a3897f8621ab90a01a27ab9f73d974bb25492cf341a344290ffcb0fbd11fa8]
...
- display repository statistics
$ BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 " borg info <hash@hash>.repo.borgbase.com:repo
[...]
------------------------------------------------------------------------------
Original size Compressed size Deduplicated size
All archives: 5.02 GB 2.65 GB 418.51 MB
Unique chunks Total chunks
Chunk index: 37672 494522
- check a backup
$ BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 " borg check --debug <hash@hash>.repo.borgbase.com:repo::auto_borg_21_03_21_00:00
using builtin fallback logging configuration
35 self tests completed in 0.10 seconds
[...]
Enter passphrase for key ssh://<hash@hash>.repo.borgbase.com/./repo:
TAM-verified manifest
Analyzing archive auto_borg_21_03_21_00:00 (1/1)
RepositoryCache: current items 1, size 2.24 kB / 2.15 GB, 0 hits, 1 misses, 0 slow misses (+0.0s), 0 evictions, 0 ENOSPC hit
Orphaned objects check skipped (needs all archives checked).
Archive consistency check complete, no problems found.
RemoteRepository: 640 B bytes sent, 1.52 MB bytes received, 15 messages sent
- Change Borg repository URL in Yunohost configuration :
$ yunohost app setting borg repository -v <hash@hash>.repo.borgbase.com:repo
-
You can also find Borgbackup logs in :
/var/log/backup_borg.err
/var/log/borg/*
-
Borgbase allow to set an alert when no activity is detected within a given period.
Restore
- Export to restore
$ BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 " borg export-tar <hash@hash>.repo.borgbase.com:repo::_auto_borg_21_03_21_00:00 /home/yunohost.backup/archives/_auto_borg_21_03_21_00:00.tar.gz
- Restore the archive through the admin interface (the archive appears in the backups section), or in command line :
$ yunohost backup restore _auto_borg_21_03_21_00:00.tar.gz --apps
you can also restore system parts with the
--system
option
- Mount to restore
$ BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 " borg mount <hash@hash>.repo.borgbase.com:repo /media/borg-repo