Borg Backblaze



(NOTE:This is the second of a three part series on setting up a cloud-based backup system, and describes how to use the various technologies discussed previously.The first describes criteria and reasoning for the various technologies selected for use, while the third describes setting up the backups to run automatically on schedule.)

Setting Up “restic”

I've wrapped Borg in a homebrew script that mails the output and preprovisions the public key on my Borg server, provides built in mysqldump support, etc. Then from the Borg server I rsync the backups to my homeserver, TransIP Stack & Backblaze B2 storage. This is the setup I use to backup all of my WSL2 instances, and it integrates nicely with an offsite backup tool like Backblaze, to ensure I never lose an important file. The Difference Between WSL1 and WSL2. Under WSL1, the Linux filesystem is stored as plain files within the Windows 10 filesystem. As an example, this is the path for my. Backblaze keeps old file versions and deleted files for 30-days. Now you can extend that time up to 1-Year for an additional $2/Month. After Years of testing, we think Backblaze is the easiest to use and the best cloud backup service for most people. 'I've used other. Borg runs doing incremental backups to a local directory. I sync the borg backup folder to a free BackBlaze B2 bucket. The whole thing comes in around 5GB of backup including database backup and all the hosted files and configuration files. Mike-cardwell on Oct 31, 2019 –. Backblaze charges $5 per month for unlimited backup (down to $4 with a 2-years subscription), which was a very good deal back then. However, storage technology has improved but my data size had not.

“restic” is the the backup technology we will use for its performance, deduplication, and native support for writing to various different remote backends.You can install “restic” using the apt package manager:

But I think it would be better to pull the latest version off their site, due to numerous little but useful improvements in this version vs. the ones in the Ubuntu repositories.It is Go language application that can be downloaded as a single-file statically-compiled self-contained binary for a variety of platforms.

Setting Up the Cloud Storage Service

  • Wasabi: Create your Wasabi account and set up your buckets following these instructions.

  • Backblaze: Set up your Backblaze account and enable B2 following these instructions.

Making Your First Backup with “restic”

Borg Backblaze 3

Initialization

“restic” can take all its arguments, options, and settings at run time.However, what we are going to do is to create a shell file that defines the values we need in some standard environmental variables, and we will source this file just before running any backup or backup management operations.This makes running restic as simple as, e.g., “restic init” instead of “restic init -r s3:https://url/of/repo” etc., as “restic” will just look to these variables for the information that we need.Note that you do not need to leave all these variables in there if you feel uncomfortable having them around: you can just supply them as needed.The variables you will need to define vary depending on whether you are using Wasabi or Backblaze:

  • Wasabi: Create and obtain your access ID and key pair, following these instructionsThen, create your directive file that populates the appropriate environmental variables, e.g., “~/.backup-configs/restic-wasabi-config.sh”:

  • Backblaze: After [setting up your B2 account](), you need to obtain your B2 account identifier and key.Then, create the directive file to be sourced, e.g., “~/.backup-configs/restic-b2-config.sh”:

Repository Creation

  1. Source the repository directive files to populate the environmental variables with all the information that “restic” needs;

  2. Create the backup repository using the “init” command.As we have exported the environmental variables specifying (1) the access identifier; (2) the access key; (3) the repository URL; and (4) the repository password above, the command is very simple. Otherwise we would have to specify these values as arguments, options, or enter them in when prompted.

    Also note that you could manually create the cloud storage bucket, but “restic” will also automatically create one for you if it does not exist.

  3. Create the first “snapshot” using the “backup” command (note that the “–verbose” flag does not work in the older versions of “restic” available from the Ubuntu repositories as of 2018-10-10), with path(s) to the directories on our local system that we want to backup.

  4. Check the backup using the “snapshots” command:

Making Subsequent Backups with “restic”

  1. Simply re-run the backup command to take another snapshot:

  2. And check to make sure it there:

Mounting the Remote Backup

BorgBorg backblaze 3

Borg Backblaze Equipment

As the saying goes, “amateurs talk about backups, professionals (or the old souls) talk about restoration”.Your backups are useless if you cannot get to them easily.Of course, you can always restore the entire backup (or the latest snapshot) through “restic”, and this is covered in the guide I mentioned above as well as the restic documentation.But what I am going to talk about here is ability the mount the remote backup in a local file system.

Folks, this is really, really, really, really, really COOL!

Instead of downloading the entire backup (which you only really need to do in the event of a full machine/disk loss), you can mount the backup as a local directory, browse through the files and view/copy just the directories/files you need.

I will say, however, that I do prefer Borg’s way of handling mounting.“restic” runs in blocking mode in the shell, requiring you to open up another shell session to get to the files and then return to the first shell and send a Ctrl-C to exit.The Ctrl-C unmounts the drive and cleans up … IF you have no other process using the drive, including a shell session that you forgot about.If the latter is the case, then things get into a dirty state, and you have to force an unmount by one of the following:

In this respect, Borg seems to do it right: running the mount command mounts the drive and exits right away, freeing the same shell session for you to do other things including browse the files.And unmounting is a lot cleaner as well.

More …

  • Part 1: what programs/technologies to use, and why.
  • Part 3: scheduling the system to run for automatic backups.

Links

Shoes
  • Using “restic” with Backblaze
  • Using “restic” with Wasabi