120 lines
5.4 KiB
Markdown
120 lines
5.4 KiB
Markdown
|
+++
|
||
|
title = "BorgBackup"
|
||
|
author = ["Elia el Lazkani"]
|
||
|
date = 2020-01-30T21:00:00+01:00
|
||
|
lastmod = 2021-06-28T00:00:24+02:00
|
||
|
tags = ["borg", "borgbackup"]
|
||
|
categories = ["backup"]
|
||
|
draft = false
|
||
|
+++
|
||
|
|
||
|
I usually lurk around **Freenode** in a few projects that I use, can learn from and/or help with. This is a great opportunity to learn new things _all the time_.
|
||
|
|
||
|
This story is familiar in that manner, but that's where similarities diverge. Someone asked around `#Weechat` a question that caught my attention because it was, sort of, out of topic. The question was around how do you backup your stuff ?
|
||
|
|
||
|
<!--more-->
|
||
|
|
||
|
I mean if I were asked that, I would've mentioned revision controlled off-site repositories for the code that I have.
|
||
|
For the personal stuff on the other hand, I would've admitted simple rudimentary solutions like `rsync`, `tar` and external drives.
|
||
|
So I was sort of happy with my backup solution, it has worked. Plain and simple.
|
||
|
|
||
|
I have to admit that, by modern standards it might not offer the ability to go back in time to a certain point.
|
||
|
But I use _file systems_ that offer _snapshot_ capabilities. I can recover from previous snapshots and send them somewhere safe.
|
||
|
Archiving and encrypting those is not a simple process, wish it was. That limits storage possibilities if you care to keep your data private.
|
||
|
|
||
|
But if you know me, you'd know that I'm always open to new ways of doing things.
|
||
|
|
||
|
I can't remember exactly the conversation but the name **BorgBackup** was mentioned (thank you however you are). That's when things changed.
|
||
|
|
||
|
|
||
|
## BorgBackup {#borgbackup}
|
||
|
|
||
|
[Borg](https://www.borgbackup.org/) is defined as a
|
||
|
|
||
|
> Deduplicating archiver with compression and encryption
|
||
|
|
||
|
Although this is a very accurate and encompassing definition, it doesn't really show you how _AWESOME_ this thing is.
|
||
|
|
||
|
I had to go to the docs first before I stumbled upon this video.
|
||
|
|
||
|
[![asciicast](https://asciinema.org/a/133292.svg)](https://asciinema.org/a/133292)
|
||
|
|
||
|
It can be a bit difficult to follow the video, I understand.
|
||
|
|
||
|
This is why I decided to write this post, to sort of explain to you how **Borg** can backup your stuff.
|
||
|
|
||
|
|
||
|
## Encryption {#encryption}
|
||
|
|
||
|
Oh yeah, that's the **first** thing I look at when I consider any suggested backup solution. **Borg** offers built-in _encryption_ and _authentication_. You can read about it in details in the [docs](https://borgbackup.readthedocs.io/en/stable/usage/init.html#encryption-modes).
|
||
|
|
||
|
So that's a check.
|
||
|
|
||
|
|
||
|
## Compression {#compression}
|
||
|
|
||
|
This is another thing I look for in a suggested backup solution. And I'm happy to report that **Borg** has this under the belt as well.
|
||
|
**Borg** currently supports _LZ4_, _zlib_, _LZMA_ and _zstd_. You can also tune the level of compression. Pretty neat !
|
||
|
|
||
|
|
||
|
## Full Backup {#full-backup}
|
||
|
|
||
|
I've watched a few videos and read a bit of their documentation and they talk about **FULL BACKUP**.
|
||
|
Which means every time you run **Borg**, it will take a full backup of your stuff. A full backup at that point in time, don't forget.
|
||
|
The implication of this is that you have a versioned list of your backups, and you can go back in time to any of them.
|
||
|
|
||
|
Yes, you read that right. **Borg** does a full backup every time you run it. That's a pretty neat feature.
|
||
|
|
||
|
If you're a bit ahead of me, you were gonna say woooow there bud ! I have **Gigabytes** of data, what do you mean **FULL BACKUP**, you keep saying **FULL BACKUP**.
|
||
|
|
||
|
I mean **FULL BACKUP**, wait until you hear about the next feature.
|
||
|
|
||
|
|
||
|
## Deduplication {#deduplication}
|
||
|
|
||
|
Booyah ! It has deduplication. Ain't that awesome. I've watched a presentation by the project's original maintainer explain this.
|
||
|
I have one thing to say. It's pretty good. How good, you may ask ?
|
||
|
|
||
|
My answer would be, good enough to fool me into thinking that it was taking snapshots of my data.
|
||
|
|
||
|
```text
|
||
|
-----------------------------------------------------------------------------
|
||
|
Original size Compressed size Deduplicated size
|
||
|
All archives: 34.59 GB 9.63 GB 1.28 GB
|
||
|
Unique chunks Total chunks
|
||
|
Chunk index: 47772 469277
|
||
|
```
|
||
|
|
||
|
It wasn't until I dug in deeper into the matter that I understood that it was a full backup and the deduping taking care of the rest.
|
||
|
|
||
|
|
||
|
## Check {#check}
|
||
|
|
||
|
**Borg** offers a way to vefiry the consistency of the repository and the archives within. This way, you can make sure that your backups haven't been corrupted.
|
||
|
|
||
|
This is a very good feature, and a must in my opinion from a backup solution. **Borg** has _YOU_ covered.
|
||
|
|
||
|
|
||
|
## Restore {#restore}
|
||
|
|
||
|
A backup solution is nothing if you can't get your data backup.
|
||
|
**Borg** has a few ways for you to get your data.
|
||
|
You can either create an _archive_ file out of a backup. You can export a file, a directory or the whole directory tree from a backup.
|
||
|
You can also, if you like, mount a backup and get stuff out.
|
||
|
|
||
|
<div class="admonition warning">
|
||
|
<p class="admonition-title">warning</p>
|
||
|
|
||
|
Mounting a **Borg** backup is done using _fuse_
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
## Conclusion {#conclusion}
|
||
|
|
||
|
**Borg** is a great tool for backup. It comes in an easily installable self-contained binary so you can use it, pretty much, anywhere giving you no excuse _whatsoever_ not to use it.
|
||
|
Their documentation is very good, and **Borg** is easy to use.
|
||
|
It offers you all the features you need to do off-site and on-site backups of all your important data.
|
||
|
|
||
|
I'll be testing **Borg** moving forward for my data. I'll make sure to report back anything I find, in the future, related to the subject.
|