|
@@ -0,0 +1,136 @@
|
|
1
|
+title: Blog
|
|
2
|
+post: BorgBackup in the Cloud
|
|
3
|
+description: Using the Hetzner Storage Box
|
|
4
|
+date: 2022-06-06
|
|
5
|
+comments: true
|
|
6
|
+---
|
|
7
|
+
|
|
8
|
+To back up [my NAS](nas_2018.html#06_2022) I was shopping around for different cloud storage providers that I could use with [BorgBackup](https://www.borgbackup.org/).
|
|
9
|
+
|
|
10
|
+Here are some yearly prices, calculated for a storage requirement of ~22TB (22.000GB).
|
|
11
|
+
|
|
12
|
+<table style="text-align: right;"><tr>
|
|
13
|
+<th><div>Name</div></th>
|
|
14
|
+<th><div>Fixed Price / y</div></th>
|
|
15
|
+<th><div>Free GB</div></th>
|
|
16
|
+<th><div>Cost add. GB / y</div></th>
|
|
17
|
+<th><div>Cost / y</div></th>
|
|
18
|
+</tr><tr>
|
|
19
|
+<th><div>Borgbase Small</div></th>
|
|
20
|
+<td><div>24</div></td>
|
|
21
|
+<td><div>100</div></td>
|
|
22
|
+<td><div>1,2</div></td>
|
|
23
|
+<td><div>26304</div></td>
|
|
24
|
+</tr><tr>
|
|
25
|
+<th><div>Borgbase Medium</div></th>
|
|
26
|
+<td><div>80</div></td>
|
|
27
|
+<td><div>1000</div></td>
|
|
28
|
+<td><div>0,084</div></td>
|
|
29
|
+<td><div>1844</div></td>
|
|
30
|
+</tr><tr>
|
|
31
|
+<th><div>Borgbase Large</div></th>
|
|
32
|
+<td><div>150</div></td>
|
|
33
|
+<td><div>2000</div></td>
|
|
34
|
+<td><div>0,06</div></td>
|
|
35
|
+<td><div>1350</div></td>
|
|
36
|
+</tr><tr>
|
|
37
|
+<th><div>rsync.net <1TB</div></th>
|
|
38
|
+<td><div>0</div></td>
|
|
39
|
+<td><div>0</div></td>
|
|
40
|
+<td><div>0,18</div></td>
|
|
41
|
+<td><div>3960</div></td>
|
|
42
|
+</tr><tr>
|
|
43
|
+<th><div>rsync.net <100TB</div></th>
|
|
44
|
+<td><div>0</div></td>
|
|
45
|
+<td><div>0</div></td>
|
|
46
|
+<td><div>0,096</div></td>
|
|
47
|
+<td><div>2112</div></td>
|
|
48
|
+</tr><tr>
|
|
49
|
+<th><div>rsync.net >100TB</div></th>
|
|
50
|
+<td><div>0</div></td>
|
|
51
|
+<td><div>0</div></td>
|
|
52
|
+<td><div>0,06</div></td>
|
|
53
|
+<td><div>1320</div></td>
|
|
54
|
+</tr><tr>
|
|
55
|
+<th><div>Wasabi Storage</div></th>
|
|
56
|
+<td><div>0</div></td>
|
|
57
|
+<td><div>0</div></td>
|
|
58
|
+<td><div>0,0708</div></td>
|
|
59
|
+<td><div>1557,6</div></td>
|
|
60
|
+</tr><tr>
|
|
61
|
+<th><div>Google Storage Std</div></th>
|
|
62
|
+<td><div>0</div></td>
|
|
63
|
+<td><div>0</div></td>
|
|
64
|
+<td><div>0,276</div></td>
|
|
65
|
+<td><div>6072</div></td>
|
|
66
|
+</tr><tr>
|
|
67
|
+<th><div>Google Storage NL</div></th>
|
|
68
|
+<td><div>0</div></td>
|
|
69
|
+<td><div>0</div></td>
|
|
70
|
+<td><div>0,12</div></td>
|
|
71
|
+<td><div>2640</div></td>
|
|
72
|
+</tr><tr>
|
|
73
|
+<th></th>
|
|
74
|
+<td></td>
|
|
75
|
+<td></td>
|
|
76
|
+<td></td>
|
|
77
|
+<td></td>
|
|
78
|
+</tr><tr>
|
|
79
|
+<th><div>Hetzner 20TB Storage</div></th>
|
|
80
|
+<td><div>526,92</div></td>
|
|
81
|
+<td><div>0</div></td>
|
|
82
|
+<td><div>0,026346</div></td>
|
|
83
|
+<td><div>526,92</div></td>
|
|
84
|
+</tr></table>
|
|
85
|
+
|
|
86
|
+As you can tell, most providers I looked at are actually pretty expensive.
|
|
87
|
+One reason for this are their guarantees against data-loss.
|
|
88
|
+
|
|
89
|
+One of the rows in the table above is not like the others, and that is the [Hetzner Storage Box](https://www.hetzner.com/storage/storage-box).
|
|
90
|
+These do not provide a dynamically growing storage, like the others.
|
|
91
|
+Instead you get a fixed amount of memory, depending on the amount of money you pay.
|
|
92
|
+The largest available size is 20TB, which is less than the 22TB I calculated with.
|
|
93
|
+But in reality I only need ~16TB currently for backups.
|
|
94
|
+
|
|
95
|
+Because this is only used as an offsite backup for me, I decided to go with it for it's far lower price, because I can live with the possibility of losing data when their [DC burns down](https://en.wikipedia.org/wiki/OVHcloud#Incidents) or something 🚒 🧑🚒
|
|
96
|
+
|
|
97
|
+Ordering a new storage box instance is straight-forward.
|
|
98
|
+You get a username, DNS name and auto-generated password in the Hetzner Web UI.
|
|
99
|
+In there you can also enable different access methods; we need SSH for Borg.
|
|
100
|
+
|
|
101
|
+Setting up [SSH authentication](https://docs.hetzner.com/robot/storage-box/backup-space-ssh-keys) and [using Borg](https://community.hetzner.com/tutorials/install-and-configure-borgbackup) are described in the [Hetzner docs](https://docs.hetzner.com/robot/storage-box/).
|
|
102
|
+
|
|
103
|
+The workflow is a bit strange, I have to admit.
|
|
104
|
+While you can use Borg or rsync over SSH with the storage box, interactive logins are not possible and you can also not use `ssh-copy-id`.
|
|
105
|
+Instead, commands need to be executed via sftp.
|
|
106
|
+These are the steps I had to do to enable public-key authentication and initialize a borg repo.
|
|
107
|
+
|
|
108
|
+<pre class="sh_sh">
|
|
109
|
+cat .ssh/KEY.pub >> storagebox
|
|
110
|
+echo -e "mkdir .ssh \n chmod 700 .ssh \n put storagebox .ssh/authorized_keys \n chmod 600 .ssh/authorized_keys" | sftp USER@USER.your-storagebox.de
|
|
111
|
+rm storagebox
|
|
112
|
+echo -e "mkdir backups \n mkdir backups/NAME" | sftp USER@USER.your-storagebox.de
|
|
113
|
+BORG_RSH='ssh -i /home/USER/.ssh/KEY' borg init --encryption=repokey ssh://USER@USER.your-storagebox.de:23/./backups/NAME
|
|
114
|
+BORG_RSH='ssh -i /home/USER/.ssh/KEY' borg key export ssh://USER@USER.your-storagebox.de:23/./backups/NAME keyfile
|
|
115
|
+mv keyfile SOMEWHERE_SAFE
|
|
116
|
+</pre>
|
|
117
|
+
|
|
118
|
+Then I simply adapted my [existing backup scripts](2022_05_16_borg_backup.html) to add a BORG_RSH export.
|
|
119
|
+
|
|
120
|
+<pre class="sh_sh">
|
|
121
|
+#!/bin/sh
|
|
122
|
+
|
|
123
|
+export BORG_REPO=ssh://USER@USER.your-storagebox.de:23/./backups/NAME
|
|
124
|
+export BORG_PASSPHRASE='PASSWORD'
|
|
125
|
+export BORG_RSH='ssh -i /home/USER/.ssh/KEY'
|
|
126
|
+
|
|
127
|
+export BACKUP_PATH=/PATH_TO_BACKUP
|
|
128
|
+export BACKUP_EXCLUDES=" \
|
|
129
|
+ --exclude=/EXCLUDED_PATHS \
|
|
130
|
+"
|
|
131
|
+
|
|
132
|
+backup-borg
|
|
133
|
+
|
|
134
|
+backup_exit=$?
|
|
135
|
+exit ${backup_exit}
|
|
136
|
+</pre>
|