Project

General

Profile

Borg backups » History » Version 7

Jamila Khan, 07/12/2019 11:14 AM
updates from work in #48568

1 1 Jamila Khan
h1. Borg backups
2
3
This is documentation and scripts for using Borg backups with backupninja. This relies heavily on the work of "Jon Goldberg":https://github.com/PalanteJon, "Benzhaomin":https://0xacab.org/Benzhaomin, and "Guillaume Subiron":https://github.com/maethor.
4
5 5 Jack Aponte
h2. What is Borg?
6
7
From the "Borg docs:":https://borgbackup.readthedocs.io/en/stable/
8
9
> BorgBackup (short: Borg) is a deduplicating backup program. Optionally, it supports compression and authenticated encryption.
10
> 
11
> The main goal of Borg is to provide an efficient and secure way to backup data. The data deduplication technique used makes Borg suitable for daily backups since only changes are stored. The authenticated encryption technique makes it suitable for backups to not fully trusted targets.
12
13 4 Jamila Khan
h2. Usage
14
15
Main borg docs: https://borgbackup.readthedocs.io/en/stable/
16
17
List backups
18
19
<pre>
20
borg list /path/to/repo
21
</pre>
22
23
Mount a single backup
24
25
<pre>
26
borg mount /path/to/repo::individual_backup /tmp/mymountpoint
27
</pre>
28
29
Check viability of the repo
30
31
<pre>
32
borg check -v /path/to/repo
33
</pre>
34
35
36
If the backup has a passphrase, you'll need to enter it to do any of those commands. The passphrase should be in the client credentials, and will be in the /etc/backup.d/ jobs
37
38
39
h2. Setup
40
41 3 Jamila Khan
Install necessary packages, currently the best way to do that is by using jessie-backports.
42
43
<pre>
44
aptitude -t jessie-backports install python3-msgpack borgbackup
45
</pre>
46
47
48 1 Jamila Khan
The files borg, borglocal, borg.helper, and borglocal.helper should be placed in /usr/share/backupninja, permissions 644, owned by root:root.
49 2 Jamila Khan
50
<pre>
51
cd /usr/share/backupninja
52 6 Jamila Khan
wget https://redmine.palantetech.coop/attachments/download/7133/borg && wget https://redmine.palantetech.coop/attachments/download/7135/borg.helper && wget https://redmine.palantetech.coop/attachments/download/7136/borglocal && wget https://redmine.palantetech.coop/attachments/download/7134/borglocal.helper
53 2 Jamila Khan
chown root:root borg* && chmod 644 borg*
54
</pre>
55
56
57 1 Jamila Khan
The files 70-76 are example backupninja jobs, which would go in /etc/backup.d, permissions 600, owned by root:root.
58
59 2 Jamila Khan
<pre>
60
cd /etc/backup.d
61 6 Jamila Khan
wget https://redmine.palantetech.coop/attachments/download/7130/70-local.borglocal
62
wget https://redmine.palantetech.coop/attachments/download/7132/71-mfpl.borg
63
wget https://redmine.palantetech.coop/attachments/download/7138/75-borglocalbackupcheck.sh
64
wget https://redmine.palantetech.coop/attachments/download/7137/76-borgbackupcheck.sh
65 2 Jamila Khan
chown root:root 7* && chmod 600 7*
66
</pre>
67
68 1 Jamila Khan
Job 70 is for backing up to a usb drive, which will be mounted at the beginning of every job and unmounted at the end.
69 2 Jamila Khan
Necessary variables to change: device uuid, filesystem type, included and excluded files, directory to mount the usb drive to, passphrase
70
71 1 Jamila Khan
Job 71 is for backing up to either a local folder or a folder accessible by ssh on a remote host.
72 2 Jamila Khan
Necessary variables to change: included and excluded files, directory to put the backups in, host, ssh user, passphrase
73
74
Jobs 75 and 76 are for checking the viability of the job 70 and 71 backups respectively, and require coping over the variables from those jobs.
75 1 Jamila Khan
76
Please change the passphrase variable in these jobs to something other than "PASSPHRASE", or leave it empty, which will turn off encryption.
77
78 7 Jamila Khan
h3. troubleshooting
79
80
There is a version of the borg handler now included in newer versions of backupninja.
81
That handler requires two changes to job 71:
82
83
* need to add encryption = none just above the passphrase
84
* change the path to the directory to be the complete full path, not use the tilde for home like ~/backups/borgbackups/offal, and must start with a slash so /home/members/srlp/backups/srlp-sync/borgbackups not borgbackups/
85 1 Jamila Khan
86
documentation:
87
https://0xacab.org/riseuplabs/backupninja/merge_requests/1
88
https://labs.riseup.net/code/projects/backupninja
89
https://borgbackup.readthedocs.io/en/stable/
Go to top