Securing TrueNAS with a cheap backup to the cloud
Aron Schüler Published
Backups with Time Machine, Nextcloud, iSCSI storage - all is stored on my TrueNAS VM. It’s running in proxmox with raid controller passthrough. As my proxmox machine just crashed due to faulty ram / ECC errors two days ago, I thought that I might be better off with an offsite backup for all these important storage pools.
Thats where I discovered TrueNAS’ capability of running Cloud Sync Tasks, which periodically run a TrueNAS backup to cloud providers you choose.
Choosing the right cloud provider
There are a lot of providers and targets that TrueNAS supports natively as a destination for sync tasks. Here’s the main four providers to choose from:
- Backblaze B2
- Amazon S3
- Google Cloud Storage
- Microsoft Azure Blob Storage
Now, the main consideration here is the price, the second consideration is whether or not you are already a customer at one of these providers and want to pay the extra price for easier integration with other used services.
The cheapest of them all is Backblaze B2, which I chose, purely for the price. You pay $5/TB per month and $0.01 per GB downloaded. It has the full S3 API so other integrations should be well possible, too.
Amazon S3 was another consideration. I already have some buckets there for other webprojects, but amongst the above their pricing comes in as most-expensive with $21/TB per month and $0.05 per GB downloaded. That’s really expensive for just dumping backups to the cloud.
Google Cloud Storage comes in at $20/TB per month and Azure Blob Storage at $17/TB per month.
Register here for Backblaze B2, I don’t get a cent for it: https://www.backblaze.com/b2/sign-up.html
Connecting TrueNAS to your cloud provider
Add cloud credentials
Before setting up the sync task, you need to enter your credentials. To do so, visit System > Cloud Credentials and click “Add” in the upper right menu.
Next, you’ll be promted to enter all authentication details required for your cloud provider. Do so and verify the credentials, so that we can be sure they work.
Create the Cloud Sync Task
Create the task under Tasks > Cloud Sync Tasks.
Direction should be PUSH as we push to the cloud from our local instance, I chose SYNC as the transfer mode, as COPY will replace every file per run. I set the task to run Daily. The rest doesn’t have to be configured, but what I thought to be interesting is the option to limit the bandwith usage depending per timezone. E.g. use unlimited bandwith at night, but limit bandwith to 20mb/s upload from 8am to 7pm. Nice feature for those who want to setup hourly backups without ruining their bandwith!
Next important thing that you dont want to skip is activate Use --fast-list
if you dont want to pay for thousands of b2_list_file_names
operations! Some users already reported paying 150 dollars only for these requests. Instead of listing file after file, you can tell TrueNAS to get all file informations at once and then operate with this list in RAM. This increases RAM usage by some percent, but is really cheap compared to paying a ton of dollars for the single file comparisons.
Done!
That should be it. Your task will now run on the preconfigured times, securing all your important data to the cloud! I was amazed how fast and easy this is to configure.
As always, if there are any questions be sure to ask them below. Thanks for reading, more articles can be found in my blog!