Backblaze B2 + RClone for power users – automatically backup data to cloud – encrypted

Backblaze offers cost effective object storage solution that can be used to storage your files securely. Backblaze has two products, B2 and Personal Backup

Backblaze Personal Backup offers unlimited backup storage to save all the files on one or more hard disk partitions on your Mac and PC. At the time of writing this article, the price for this service is $7 per month per computer that comes with unlimited backup storage. Backblaze offers an application that you have to download and run on your PC or Mac which will continuously upload all the files from your hard disk partition

Backblaze B2 offers low cost object storage to save your files. The pricing of the b2 offering is $0.005 GB/Month which is comparable to Amazon S3 Gracier pricing and much lower than Amazon S3 Hot tier pricing. B2 is popular amongst the users of NAS devices due to the integration with NAS storage to automatically backup the files to the cloud.

The main difference between Personal Backup and B2 is that with B2 you are able to send select files or folders to Backblaze servers. However, it is not an option for Personal Backup, where you are forced to backup your primary hard disk at least and you have the option to select additional hard disk partition to the backup list. Personal backup is mainly targeted for users who need to backup their entire computer with no complexity.

This post, however is to talk about B2 and how we can use it for saving hundreds of GBs of data securely for a few dollar a month as a backup solution.

My use case for Backblaze is to save it as a backup of my external hard disk that is connected to my computer so that in the event of hard disk failure or accidental file corruption, I have a backup in the cloud. There are two options that I’ve considered, Amazon S3 and Backblaze B2. The table below shows the price comparison between these two

ProviderPlan/Pricing TierDiskspaceUpload CostDownload Cost
Amazon S3Glacier Instant Retrieval$0.004/GB$0.02 per 1,000 PUT, COPY, POST or LIST requests $0.03/GB
BackblazeB2$0.005/GBFree$0.01/GB

A simple math shows that if I backup 40,000 files worth of 5000GB, Amazon would charge me $2/month for saving it and $0.80 onetime for sending the files to S3. In the event of a hard disk failure and if I want to download the entire content, it would be $15 for retrieving the files from S3.

If saved on Backblaze, they would charge me $2.5/month to save the files. File uploads are free so there are no onetime charges. In the event of downloading the files, it would cost me $5.

Clearly, B2 has some price advantages over S3 but not a lot. So if you are a AWS user who has a lot of services on AWS, I’d recommend to stick with S3 so that you don’t have to pay another provider.

Automated Backup to Backblaze B2 with RClone utility and file encryption

Rclone is a command-line program to manage files on cloud storage. It is a feature-rich alternative to cloud vendors’ web storage interfaces. Over 40 cloud storage products support rclone including S3 object stores, business & consumer file storage services, as well as standard transfer protocols

Communicating with the backblaze b2 api and storage is the pain point while dealing with B2. Luckily Rclone has integration with B2. Rclone does the heavy lifting of communicating with B2 cloud storage so that we can send files to B2 backend easily. Rclone is a Go based single binary command line application which can be used to send and retrieve files from B2. This also means that it is up to us to setup automation to sync the files from the PC to B2. Here is how I did it so that it automatically backs up my external hard disk to B2 cloud.

Download RClone

Configure 2 backends, B2 and Crypt. The crypt backend basically encrypts your files before sending the file to the B2 backend. If you do not want to encrypt your files before sending to B2, then you can skip it and use just B2 backend. In my case I wanted to encrypt the files so that in the event if somebody gets access to my b2 account, they couldn’t read my file as it would be encrypted. B2 also supports MFA as a secondary authentication so if you are hosting your personal files, I’d highly recommend to enable MFA.

Once you configure the rclone, the config file would be located in the users AppData/rclone directory. You can move the file to the same folder where rclone.exe is located. If you save the rclone.conf in a different location, you can use the argument –config to point to the file.

The final rclone.conf file would look something like this

[backblaze]
type = b2
account = 0045454632240000000002
key = KSD$GDSDSFGFSG+SDFSDFDSFDF

[remote]
type = crypt
remote = backblaze:bucketname
filename_encryption = obfuscate
directory_name_encryption = false
password = SDFSDFSDFSFGD##$#$#FGFDGFDGDFG

If you are on windows, you can simply start the backup by running the rclone utility with this parameters

.\rclone.exe -vv sync H:\Backup remote:passport

The command above would start to backup all your files from H:\Backup folder to the Backblaze bucket with the bucketname “bucketname” and will upload in a folder called “passport”. The name of the files and content will be encrypted before sending to the cloud. You’d need to use rclone to retrieve the files which will automatically decrypt file upon retrieval.

Automating the backup using Windows Task Scheduler

The following powershell command will create a new Task in the Windows Task Scheduler which would run every hour. You’d need to run this as a Administrator. Ofcourse, adjust the path of the files as necessary.

$taskAction   = (New-ScheduledTaskAction –Execute 'h:\rclone.exe' -Argument '--config h:\rclone.conf sync H:\Backup\ remote:passport')
$taskName = "RClone Backup"
$description = "RClone Scheduled Backup"
$principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$tasktrigger = New-JobTrigger -Once -At (Get-Date).Date -RepeatIndefinitely -RepetitionInterval (New-TimeSpan -Minutes 60)

$everyMinute = New-TimeSpan -Minutes 1

$nolimit = New-TimeSpan -Minutes 0
$settings = New-ScheduledTaskSettingsSet `
    -MultipleInstances IgnoreNew `
    -RestartInterval $everyMinute `
    -RestartCount 999 `
    -Priority 0 `
    -ExecutionTimeLimit $nolimit `
    -StartWhenAvailable `
    -DisallowHardTerminate

# Register the scheduled task
Register-ScheduledTask `
    -TaskName $taskName `
    -Action $taskAction `
    -Trigger $taskTrigger `
    -Description $description `
    -Principal $principal `
    -Settings $settings

That’s it. Once the task is started, it will upload all the files to the B2 and will continue uploading new files every hour. If you are linux, you could use a cronjob to setup the job.

Leave a Reply

Your email address will not be published. Required fields are marked *