avatarMartin Thoma

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

7145

Abstract

.</p><p id="ee08">The described generations would also mean that you need to have 5+12+7 = <b>24 backups at all times</b>. If you have 100 GB of data that would mean you need to store 2400 GB just for the backups.</p><h1 id="9e5c">Reducing Storage: Different types of backups</h1><p id="bde6">We rotate backups to reduce the required storage space, but there are other options to do that. One is to use different types of backups.</p><p id="2fc1">A <b>full backup</b> is conceptually the simplest. You just make a copy of what you want to back up. If you create a daily backup, you just have one copy for every day. You donโ€™t depend on any other backups.</p><p id="cf22">A <b>differential backup</b> just stores the difference (sometimes called the <i>delta</i>) since the last full backup.</p><p id="b849"><b>Incremental backups</b> are similar to differential backups, but they store the difference from the last backup. That could also be another incremental backup.</p><h1 id="96aa">Reducing Storage: Compression</h1><p id="b1b5">Another trade-off you can do is storage vs. computational power. Compression algorithms try to find duplicates within your code and find a different representation.</p><p id="a4d9">Assume you want to store a sequence of numbers:</p><div id="6466"><pre><span class="hljs-string">[1, 1, 1, 1, 4, 5, 5, 5, 8, 8, 8, 1, 1, 1, 1, 1, 1]</span></pre></div><p id="7481">You might notice that this sequence has several duplicates. Instead of storing that, you could store:</p><div id="bd49"><pre>[(<span class="hljs-name">4x</span>, <span class="hljs-number">1</span>), (<span class="hljs-name">1x</span>, <span class="hljs-number">4</span>), (<span class="hljs-name">3x</span>, <span class="hljs-number">5</span>), (<span class="hljs-name">3x</span>, <span class="hljs-number">8</span>), (<span class="hljs-name">6x</span>, <span class="hljs-number">1</span>)]</pre></div><p id="7c7d">And instead of just looking for the next digit, you could also look for the next two:</p><div id="7cd9"><pre>[(<span class="hljs-name">2x</span>, <span class="hljs-number">11</span>), (<span class="hljs-name">1x</span>, <span class="hljs-number">4</span>), (<span class="hljs-name">3x</span>, <span class="hljs-number">5</span>), (<span class="hljs-name">3x</span>, <span class="hljs-number">8</span>), (<span class="hljs-name">3x</span>, <span class="hljs-number">11</span>)]</pre></div><p id="e7ed">There are lots of clever ways how to combine ideas to make it shorter. But that shorter representation has to be computed. Applying compression takes time. Also when you want to read your original data, you need to decompress.</p><h1 id="5f21">Confidentiality: Encrypt your backup!</h1><p id="b4b3">Having a copy of your important data makes it more likely that somebody else can access it. It could be during transit (when you transfer the backup to the storage) or at rest (while it is stored).</p><p id="49fd">Just as you want <a href="https://faun.pub/full-disk-encryption-2090489f9760">full disk encryption</a> for laptop, you want to make sure your backup stays private. Make sure it is encrypted. And make really sure you donโ€™t loose the key to decrypt it!</p><h1 id="0fde">Other things you might care about</h1><p id="e88a">Itโ€™s pretty clear that everybody cares about the <b>price</b> which is always per GB and month, but might also include additional fees for restoring or data transfer. You also know that you should care about <b>encryption</b>. Besides that, there are a few topics you might not have initially thought of:</p><p id="1337">The first thing you should check if the tool you intend to use supports the operating system youโ€™re working with (Windows, Mac, or Linux).</p><p id="d6e7">There might be a <b>limit in single-file size</b>. Very likely something like 2 GB. If you have videos you might care about this a lot.</p><p id="50d3">Backups are something that should just work in the background. Hence you really want <b>scheduled automatic backups</b>.</p><p id="9a51">And, of course, you should know how you can use your backup for recovery. The <b>user experience</b> while recovering / restoring the backup is important. When you need it, youโ€™re likely stressed. No time to watch many semi-professional YouTube videos that explain the tool you rely on.</p><h1 id="64d1">Storage</h1><p id="9552">There are two very different storage solutions: A network-attached storage (NAS) which you can operate yourself or cloud storage. The NAS has high upfront cost, but except for electricity no operating cost. Cloud storage pricing models are monthly subscriptions where you pay for storage and sometimes also for the amount of data you transfer.</p><h2 id="122e">NAS</h2><p id="d2ac">The cheapest NAS I could find is โ€œ<b>WD</b> My Cloud Homeโ€ with 2 TB for 135 EUR (I have a pretty old one from WD which isnโ€™t sold anymore).</p><p id="49f9">While writing this article I found several people using <b>Synology</b> products. A key point for them is that the Synology devices are only bays for the disks. You can buy the disks independently.</p><h2 id="c9fa">Cloud Storage</h2><p id="654a">I use <b>Google Drive</b> for a lot of different things. Itโ€™s 2 EUR / 100 GB and month. It gets cheaper the more you need (see <a href="https://one.google.com/about/plans">pricing plans</a>).</p><p id="743d"><b>Dropbox</b> is another popular choice. Their cheapest plan is 10 EUR / 2 TB and month. Dropbox offers a lot of different features around its storage. For example, the โ€œrewindโ€ feature allows you to undo any changes of the past 30 days. That might make it a proper solution for accidental file deletions or ransomware. See their <a href="https://www.dropbox.com/plans">pricing plans</a> for details about those features.</p><p id="1947">A friend of mine (also a developer) uses a <b>Hetzner Storage Box</b> for his backups. Itโ€™s 3.81 EUR/1 TB per month (see <a href="https://www.hetzner.com/storage/storage-box">pricing plans</a>). I also know Hetzner as a reliable and trustworthy provider</p><p id="2dfa">A storage solution that is only suited for developers is <b>AWS S3</b>. The <a href="https://aws.amazon.com/de/s3/pricing/">pricing model of AWS S3</a> is a bit complicated, but if I got it right you can save 100 GB for only 0.10 EUR per month.</p><h1 id="d4b0">Software Solutions</h1><p id="e9a8">Letโ€™s dive into a few concrete solutions that you might want to use!</p><h2 id="00ef">Pure folder synchronization</h2><p id="a6af">A couple of backup solutions are essentially just synchronizing two directories (folders): The local one and a remote one.</p><p id="e00b">In the Linux world, this is typically done with <a href="https://en.wikipedia.org/wiki/Rsync">rsync</a> (potentially with <a href="https://stackoverflow.com/a/40525217/562769">inotifywait</a> or a CRON job) and on Windows there is <a href="https://www.puresync.de/">PureSync</a>.</p><h2 id="ef25">BorgBackup (short: Borg)</h2><p id="8170"><a href="https://pypi.org/project/borgbackup/">BorgBackup</a> is free software that allows you to create, compress, encrypt, and manage your backups. As itโ€™s written in Python you can make it work on

Options

pretty much any system (<a href="https://borgbackup.readthedocs.io/en/stable/installation.html">installation notes</a>).</p><p id="0ec7">It is a command line application and here are the basic commands (<a href="https://borgbackup.readthedocs.io/en/stable/quickstart.html">docs</a>):</p><div id="d5ca"><pre><span class="hljs-comment"># Create a borg repo: You need to enter</span> <span class="hljs-comment"># a passphrase you have to remember</span> borg init <span class="hljs-params">--encryption=repokey</span> ~<span class="hljs-string">/borg_repo</span></pre></div><div id="6503"><pre><span class="hljs-comment"># Borg created a key: Print that key and store it somewhere save</span> borg key <span class="hljs-built_in">export</span> ~/borg_repo</pre></div><div id="54b9"><pre><span class="hljs-comment"># Create a backup archive</span> <span class="hljs-variable"></span>borg create ~<span class="hljs-regexp">/borg_repo::Saturday1 ~/</span>Documents</pre></div><div id="1be3"><pre><span class="hljs-comment"># Inspect the borg repo:</span> borg list ~/borg_repo Saturday1 Sun, 2022-09-04 12:03:59 [07752098e880ddffcc470c9a45382c8285c6dc9500fc8a8d4e4b279e0802086e]</pre></div><div id="a237"><pre><span class="hljs-comment"># Inspect a backup archive:</span> borg list ~/borg_repo::Saturday1 drwxr-xr-x moose moose 0 Sat, 2022-08-27 18:07:24 home/moose/Documents -rw-rw-r-- moose moose 99420 Sat, 2021-12-18 15:23:23 home/moose/Documents/Finanzbildung-Version-2.pdf -rw-rw-r-- moose moose 466391 Sat, 2022-04-09 23:22:05 home/moose/Documents/out.pdf ...</pre></div><div id="3b2e"><pre><span class="hljs-comment"># Restore a backup</span> <span class="hljs-variable"> </span>borg extract ~/borg_repo::<span class="hljs-title class_">Saturday1</span></pre></div><p id="6888">Borg de-duplicates files between backups. That means if you run two backups of exactly the same content, it will only store it once. As borg takes care of all your backups in one repository, you donโ€™t have to think about the different backup types (full/differential/incremental). Borg manages it for you.</p><p id="39c9">You can <a href="https://borgbackup.readthedocs.io/en/stable/quickstart.html#automating-backups">automate backups via simple scripts</a>. The <code>borg prune</code>command helps to implement the generation principle.</p><p id="1d65"><a href="https://vorta.borgbase.com/">Vorta</a> is a graphical interface to borg:</p><figure id="1dde"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*MECXCD9uFgE_Md1Mao_RYw.png"><figcaption>Vorta is a graphical interface to BorgBackup. Screenshot taken by Martin Thoma on Ubuntu.</figcaption></figure><p id="8bf7">This also makes scheduled backups easy:</p><figure id="fc04"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*AWXmRR7fRMbargASOf8NZg.png"><figcaption></figcaption></figure><p id="3e17">And even the pruning options are there:</p><figure id="7121"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*XAix9ZYBV92nFkvAF6eR9Q.png"><figcaption></figcaption></figure><h1 id="295b">Any Last Words?</h1><p id="e02c">The 3โ€“2โ€“1 rule is mentioned a lot when youโ€™re looking for backup advice. People recommend having 3 copies in 2 different storage mediums/storage technologies and 1 off-site backup. That would cover all five data loss scenarios to some degree.</p><p id="6ec9">For a software developer, a Hetzner Storage Box + BorgBackup + Vorta is a great solution.</p><p id="73a3">There are also many other backup solutions such as Backblaze, Duplicity, or Apple Time Machine. They might fit your needs just as well or even better than what Iโ€™ve described. You now know what to consider when you build your backup system.</p><h1 id="3863">Whatโ€™s next?</h1><p id="d842">In this series about application security (AppSec) we already explained some of the techniques of the attackers ๐Ÿ˜ˆ and also techniques of the defenders ๐Ÿ˜‡:</p><ul><li>Part 1: <a href="https://readmedium.com/sql-injections-e8bc9a14c95">SQL Injections</a> ๐Ÿ˜ˆ๐Ÿ</li><li>Part 2: <a href="https://levelup.gitconnected.com/leaking-secrets-240a3484cb80">Donโ€™t leak Secrets</a> ๐Ÿ˜‡</li><li>Part 3: <a href="https://levelup.gitconnected.com/cross-site-scripting-xss-fd374ce71b2f">Cross-Site Scripting (XSS)</a> ๐Ÿ˜ˆ๐Ÿ</li><li>Part 4: <a href="https://levelup.gitconnected.com/password-hashing-eb3b97684636">Password Hashing</a> ๐Ÿ˜‡</li><li>Part 5: <a href="https://readmedium.com/zip-bombs-30337a1b0112">ZIP Bombs</a> ๐Ÿ˜ˆ</li><li>Part 6: <a href="https://readmedium.com/captcha-500991bd90a3">CAPTCHA</a> ๐Ÿ˜‡</li><li>Part 7: <a href="https://readmedium.com/email-spoofing-9da8d33406bf">Email Spoofing</a> ๐Ÿ˜ˆ</li><li>Part 8: <a href="https://readmedium.com/software-composition-analysis-sca-7e573214a98e">Software Composition Analysis</a> (SCA) ๐Ÿ˜‡</li><li>Part 9: <a href="https://readmedium.com/xxe-attacks-750e91448e8f">XXE attacks</a> ๐Ÿ˜ˆ๐Ÿ</li><li>Part 10: <a href="https://levelup.gitconnected.com/effective-access-control-331f883cb0ff">Effective Access Control</a> ๐Ÿ˜‡</li><li>Part 11: <a href="https://readmedium.com/dos-via-a-billion-laughs-9a79be96e139">DOS via a Billion Laughs</a> ๐Ÿ˜ˆ</li><li>Part 12: <a href="https://readmedium.com/full-disk-encryption-2090489f9760">Full Disk Encryption</a> ๐Ÿ˜‡</li><li>Part 13: <a href="https://readmedium.com/insecure-deserialization-5c64e9943f0e">Insecure Deserialization</a> ๐Ÿ˜ˆ</li><li>Part 14: <a href="https://levelup.gitconnected.com/docker-security-5f4df118948c">Docker Security</a> ๐Ÿ˜‡</li><li>Part 15: <a href="https://levelup.gitconnected.com/credential-stuffing-ff58ee8c3320">Credential Stuffing</a> ๐Ÿ˜ˆ๐Ÿ</li><li>Part 16: <a href="https://readmedium.com/multi-factor-authentication-cefff819be95">Multi-Factor Authentication</a> (MFA/2FA) ๐Ÿ˜‡</li><li>Part 17: <a href="https://infosecwriteups.com/redos-denial-of-service-by-regex-59c7ffab4880?source=user_profile---------0-------------------------------&amp;gi=bec35fb230e3">ReDoS</a> ๐Ÿ˜ˆ</li><li>Part 18: <a href="https://infosecwriteups.com/secure-messaging-5d2fc7748c24">Secure and Private Instant Messaging</a> ๐Ÿ˜‡</li><li>Part 19: <a href="https://readmedium.com/cryptojacking-55a73622fb6d">Cryptojacking</a> ๐Ÿ˜ˆ</li><li>Part 20: Backups ๐Ÿ˜‡</li><li>Part 21: CSRF ๐Ÿ˜ˆ</li><li>Part 22: Single-Sign-On ๐Ÿ˜‡</li><li>Part 23: Clipboard Hijacking ๐Ÿ˜ˆ</li><li>Part 24: Certificates ๐Ÿ˜‡</li><li>Part 25: Race Condition Attacks in Blockchains ๐Ÿ˜ˆ</li><li>Part 26: Mobile Device Management (MDM) ๐Ÿ˜‡</li><li>Part 27: Server-Side Request Forgery (SSRF) ๐Ÿ˜ˆ</li><li>Part 28: Network Separation ๐Ÿ˜‡</li><li>Part 29: Social Engineering (including Phising) ๐Ÿ˜ˆ</li><li>Part 30: Virtual Private Networks (VPNs) ๐Ÿ˜‡</li></ul><p id="c43f">Let me know if you are interested in more articles around AppSec / InfoSec!</p><p id="8cda">I love writing about software development and technology ๐Ÿคฉ Donโ€™t miss updates: <a href="https://martinthoma.medium.com/subscribe"><b>Get my free email newsletter</b></a> ๐Ÿ“ง or <a href="https://martinthoma.medium.com/membership">sign up for Medium</a> โœ๏ธ if you havenโ€™t done it yet โ€” both encourage me to write more ๐Ÿค—</p></article></body>

Backups: What matters and how to do it right๐Ÿ˜‡

Backup types and strategies, storage solutions, and the requirements analysis you need to do

Photo by benjamin lehman on Unsplash

Letโ€™s be honest: Everybody hates this topic. Itโ€™s not sexy. You just want a solution that works and that you can trust. You might not even have created backups โ€” and I mean real backups, not randomly storing copies.

I had the weirdest kinds of backups in the past. I remember that I was super nervous about my bachelor's thesis. Iโ€™ve stored it in a private repository on GitHub and Iโ€™ve sent snapshots to my fatherโ€ฆ just to be sure I donโ€™t lose it. You know, if the computer breaks.

In this article, you will learn about where you can store your backups and how you can create periodic backups automatically. Letโ€™s start!

Requirement Analysis

Photo by Kaleidico on Unsplash

Before we dive into solutions, we need to analyze what we want to protect and against what we need to protect.

Which data is important to you?

Business care about their databases. They might contain all kinds of things, but especially their customer data. Code is another big one. E-mails. And contracts, of course.

In your private life, you might care most about photos and documents. Maybe your whole system setup as well.

What might cause data loss?

Against which possible causes of data loss do you want to protect with your backup strategy? I notice five big data loss scenarios:

Disk failure is for sure the most common one. It hasnโ€™t happened to me so far, but the longer you use your device and the more read/write operations you have, the more likely it gets that the device just breaks at some point. There are companies that can recover data from broken disks, but itโ€™s unclear to me how expensive that might get, how long it would take, and how much can be recovered.

Accidental deletions are another common one. You just hit the wrong button or execute the wrong command in the terminal and your data is gone.

Malware and especially ransomware is another reason why you want to have backups. Notice that this is different from the rest. Here somebody is actively trying to lock you out from accessing your data.

Theft is likely more relevant to your private life than for a business that might have better security on-site โ€ฆ but things might change with people working remotely.

Natural catastrophes are the last big reason for data loss. It could be simply your house or data center being on fire, an earthquake, a tsunami, or a flood. In the case of data centers, a catastrophe might not even destroy the data permanently, but โ€œjustโ€ lock you out if network cables or power lines of the data center are destroyed.

Solutions

Photo by AbsolutVision on Unsplash

Letโ€™s look at what you can do to protect against those issues.

Having more than one disk in your computer and letting it automatically write the data to both places helps against disk failure. Itโ€™s called RAID โ€” redundant array of independent disks. It does not help against accidental deletions as the files would be deleted on the other disk as well. Malware likely also affects both disks at the same time, just like theft and catastrophes.

You can have a disk in a different location at home. Just a minimal โ€œcomputerโ€ that basically only puts your disk in your local network. A network-attached storage (short: NAS). It might help against theft a bit better, depending on how well you hide it. Now you need to have a backup strategy and software that actually creates and stores your backups on the NAS. We will talk about that later. It depends on the system and how well it is protected against malware. It does not help against a natural catastropheโ€ฆ except if you have the NAS really remotely and do the backup over the internet. But that is not the case most of the time for people who use NAS.

A cloud provider is for sure an option that can fulfill all your requirements. In this case, you want to consider different issues such as who can access the backup (privacy) and ensure that the network traffic is encrypted. Also, the pricing model just changed from a one-time investment to a subscription model.

Backup Strategies

The โ€œaccidental deletionโ€ and โ€œmalwareโ€ data loss scenarios are tricky because there might be a serious time delay between the incident time and the detection time.

Assume you make one backup at night. The new backup always overwrites the old backup. Now you delete the photos from your kids' 8th birthday, but you only notice that when your wife wants to create a collage for the 10th birthday. As youโ€™ve overwritten the backup, there is no chance of recovery.

Instead of overwriting the backup, you might just create copies. But that grows really quickly. So you mix those two approaches by introducing the idea of backup generations. This is also known as the generation principle or the grandfather-father-son principle. Itโ€™s a rotation scheme for backups. The idea is the following:

You have for example 5 grandfathers, 12 fathers, and 7 sons. The 7 sons might refer to days of the week. So you have a Monday / Tuesday / Wednesday / Thursday / Friday / Saturday / Sunday backup. The 12 fathers could refer to the 1st of the month, so you have a January, February, โ€ฆ backup. And the Grandfathers are the 1st of January of the past 5 years.

That means if you delete the photos of your kid on 2022โ€“12โ€“03 and you notice on 2024โ€“10โ€“20, you would go back to the backup from 2022โ€“01โ€“01. Yes, you would lose everything that happened between 2022โ€“01โ€“01 and 2022โ€“12โ€“03. Almost a year of data. But not everything.

The described generations would also mean that you need to have 5+12+7 = 24 backups at all times. If you have 100 GB of data that would mean you need to store 2400 GB just for the backups.

Reducing Storage: Different types of backups

We rotate backups to reduce the required storage space, but there are other options to do that. One is to use different types of backups.

A full backup is conceptually the simplest. You just make a copy of what you want to back up. If you create a daily backup, you just have one copy for every day. You donโ€™t depend on any other backups.

A differential backup just stores the difference (sometimes called the delta) since the last full backup.

Incremental backups are similar to differential backups, but they store the difference from the last backup. That could also be another incremental backup.

Reducing Storage: Compression

Another trade-off you can do is storage vs. computational power. Compression algorithms try to find duplicates within your code and find a different representation.

Assume you want to store a sequence of numbers:

[1, 1, 1, 1, 4, 5, 5, 5, 8, 8, 8, 1, 1, 1, 1, 1, 1]

You might notice that this sequence has several duplicates. Instead of storing that, you could store:

[(4x, 1), (1x, 4), (3x, 5), (3x, 8), (6x, 1)]

And instead of just looking for the next digit, you could also look for the next two:

[(2x, 11), (1x, 4), (3x, 5), (3x, 8), (3x, 11)]

There are lots of clever ways how to combine ideas to make it shorter. But that shorter representation has to be computed. Applying compression takes time. Also when you want to read your original data, you need to decompress.

Confidentiality: Encrypt your backup!

Having a copy of your important data makes it more likely that somebody else can access it. It could be during transit (when you transfer the backup to the storage) or at rest (while it is stored).

Just as you want full disk encryption for laptop, you want to make sure your backup stays private. Make sure it is encrypted. And make really sure you donโ€™t loose the key to decrypt it!

Other things you might care about

Itโ€™s pretty clear that everybody cares about the price which is always per GB and month, but might also include additional fees for restoring or data transfer. You also know that you should care about encryption. Besides that, there are a few topics you might not have initially thought of:

The first thing you should check if the tool you intend to use supports the operating system youโ€™re working with (Windows, Mac, or Linux).

There might be a limit in single-file size. Very likely something like 2 GB. If you have videos you might care about this a lot.

Backups are something that should just work in the background. Hence you really want scheduled automatic backups.

And, of course, you should know how you can use your backup for recovery. The user experience while recovering / restoring the backup is important. When you need it, youโ€™re likely stressed. No time to watch many semi-professional YouTube videos that explain the tool you rely on.

Storage

There are two very different storage solutions: A network-attached storage (NAS) which you can operate yourself or cloud storage. The NAS has high upfront cost, but except for electricity no operating cost. Cloud storage pricing models are monthly subscriptions where you pay for storage and sometimes also for the amount of data you transfer.

NAS

The cheapest NAS I could find is โ€œWD My Cloud Homeโ€ with 2 TB for 135 EUR (I have a pretty old one from WD which isnโ€™t sold anymore).

While writing this article I found several people using Synology products. A key point for them is that the Synology devices are only bays for the disks. You can buy the disks independently.

Cloud Storage

I use Google Drive for a lot of different things. Itโ€™s 2 EUR / 100 GB and month. It gets cheaper the more you need (see pricing plans).

Dropbox is another popular choice. Their cheapest plan is 10 EUR / 2 TB and month. Dropbox offers a lot of different features around its storage. For example, the โ€œrewindโ€ feature allows you to undo any changes of the past 30 days. That might make it a proper solution for accidental file deletions or ransomware. See their pricing plans for details about those features.

A friend of mine (also a developer) uses a Hetzner Storage Box for his backups. Itโ€™s 3.81 EUR/1 TB per month (see pricing plans). I also know Hetzner as a reliable and trustworthy provider

A storage solution that is only suited for developers is AWS S3. The pricing model of AWS S3 is a bit complicated, but if I got it right you can save 100 GB for only 0.10 EUR per month.

Software Solutions

Letโ€™s dive into a few concrete solutions that you might want to use!

Pure folder synchronization

A couple of backup solutions are essentially just synchronizing two directories (folders): The local one and a remote one.

In the Linux world, this is typically done with rsync (potentially with inotifywait or a CRON job) and on Windows there is PureSync.

BorgBackup (short: Borg)

BorgBackup is free software that allows you to create, compress, encrypt, and manage your backups. As itโ€™s written in Python you can make it work on pretty much any system (installation notes).

It is a command line application and here are the basic commands (docs):

# Create a borg repo: You need to enter
# a passphrase you have to remember
$ borg init --encryption=repokey ~/borg_repo
# Borg created a key: Print that key and store it somewhere save
$ borg key export ~/borg_repo
# Create a backup archive
$ borg create ~/borg_repo::Saturday1 ~/Documents
# Inspect the borg repo:
$ borg list ~/borg_repo 
Saturday1                            Sun, 2022-09-04 12:03:59 [07752098e880ddffcc470c9a45382c8285c6dc9500fc8a8d4e4b279e0802086e]
# Inspect a backup archive:
$ borg list ~/borg_repo::Saturday1
drwxr-xr-x moose  moose         0 Sat, 2022-08-27 18:07:24 home/moose/Documents
-rw-rw-r-- moose  moose     99420 Sat, 2021-12-18 15:23:23 home/moose/Documents/Finanzbildung-Version-2.pdf
-rw-rw-r-- moose  moose    466391 Sat, 2022-04-09 23:22:05 home/moose/Documents/out.pdf
...
# Restore a backup
$ borg extract ~/borg_repo::Saturday1

Borg de-duplicates files between backups. That means if you run two backups of exactly the same content, it will only store it once. As borg takes care of all your backups in one repository, you donโ€™t have to think about the different backup types (full/differential/incremental). Borg manages it for you.

You can automate backups via simple scripts. The borg prunecommand helps to implement the generation principle.

Vorta is a graphical interface to borg:

Vorta is a graphical interface to BorgBackup. Screenshot taken by Martin Thoma on Ubuntu.

This also makes scheduled backups easy:

And even the pruning options are there:

Any Last Words?

The 3โ€“2โ€“1 rule is mentioned a lot when youโ€™re looking for backup advice. People recommend having 3 copies in 2 different storage mediums/storage technologies and 1 off-site backup. That would cover all five data loss scenarios to some degree.

For a software developer, a Hetzner Storage Box + BorgBackup + Vorta is a great solution.

There are also many other backup solutions such as Backblaze, Duplicity, or Apple Time Machine. They might fit your needs just as well or even better than what Iโ€™ve described. You now know what to consider when you build your backup system.

Whatโ€™s next?

In this series about application security (AppSec) we already explained some of the techniques of the attackers ๐Ÿ˜ˆ and also techniques of the defenders ๐Ÿ˜‡:

Let me know if you are interested in more articles around AppSec / InfoSec!

I love writing about software development and technology ๐Ÿคฉ Donโ€™t miss updates: Get my free email newsletter ๐Ÿ“ง or sign up for Medium โœ๏ธ if you havenโ€™t done it yet โ€” both encourage me to write more ๐Ÿค—

Security
Information Security
Backup
Data Loss Prevention
Technology
Recommended from ReadMedium