How to Backup FreeNAS to Backblaze B2

Author

Reads 1.1K

Close-up view of modern rack-mounted server units in a data center.
Credit: pexels.com, Close-up view of modern rack-mounted server units in a data center.

FreeNAS is a powerful open-source NAS operating system that's perfect for storing and sharing files, but it's not a backup solution. You need a separate backup system to ensure your data is safe.

First, let's set up a backup job in FreeNAS to send data to Backblaze B2. To do this, you'll need to create a new backup job and select the storage pool you want to backup.

FreeNAS supports multiple backup destinations, including Backblaze B2, which is a cost-effective and reliable cloud storage solution.

The Backblaze B2 API is used to authenticate and authorize backups to the cloud.

What is Backblaze B2 Cloud Storage?

Backblaze B2 Cloud Storage is a cost-effective and secure cloud storage solution that allows you to store and manage your data online.

It offers a highly durable and redundant storage system, with data stored across multiple servers in different locations.

Backblaze B2 Cloud Storage is designed to be easy to use, with a simple and intuitive interface that makes it easy to upload and manage your files.

Credit: youtube.com, Backup Synology NAS to Backblaze B2 Cloud Storage with Hyper Backup

You can store up to 10TB of data per bucket, making it a great option for large-scale data storage needs.

Backblaze B2 Cloud Storage also offers a pay-as-you-go pricing model, with costs starting at just $0.005 per GB-month.

This pricing model makes it an attractive option for those who need to store large amounts of data but don't want to break the bank.

Backblaze B2 Cloud Storage is integrated with many popular cloud storage services, making it easy to transfer data between different platforms.

Setting Up Cloud Sync

Setting up cloud sync is a straightforward process. You'll need to create a cloud credential for your Backblaze B2 account, which involves entering an application key ID and application key with full read/write permissions for the bucket or section of the bucket that will be accessed.

To create a cloud credential, navigate to System ‣ Cloud Credentials ‣ Add Cloud Credential. You'll need to enter the application key ID and application key for your Backblaze B2 account.

Credit: youtube.com, TrueNAS - How to Back Up with Cloud Sync

A cloud storage area, called a bucket, must also exist before you can create a cloud sync task. With Backblaze B2, these buckets need to be created before a sync task can be created.

To create a cloud sync task, expand Tasks and pick Add Cloud Sync. You'll need to add a description, pick Push for direction, and select your cloud credential and bucket from the list of available options.

The path to the local file or directory you want to sync must also be set, as well as the transfer mode, which should be set to Sync. Finally, you can pick the task scheduling options that match your needs.

Here's a step-by-step guide to setting up a cloud sync task:

  1. Expand Tasks
  2. Pick Add Cloud Sync
  3. Add a Description
  4. Pick Push for Direction
  5. Pick your Cloud Credential from above for Provider
  6. Pick the bucket the sync is pushing to for Backblaze B2 Buckets
  7. Set the Path to the local Path of what you’re wanting to push to B2
  8. Set the Transfer Mode to Sync
  9. Pick the Task Scheduling Options which match your needs

Configuring Rclone and Bash Script

To configure rclone for backing up your Freenas to Backblaze, you'll need to run `rclone config` to initiate the configuration process. This will create a new remote, which is what rclone uses to know where to copy or sync your files.

Credit: youtube.com, Getting Started with Rclone and Backblaze B2

To create the bash script that will be used with cron to backup changes to your local storage, you'll need to create a new file in the `/root` directory and name it `rclone-cron.sh`.

The script will run the `rclone copy` command with various parameters, including `-v` for verbosity, `--log-file` to specify the log file location, and `--min-age` to specify the minimum age of files to be synced.

Step 4: Configure Rclone

Configuring rclone is a crucial step in setting up your backup and sync system. Run rclone config to initiate the configuration process.

You'll be presented with a series of prompts to create a new remote, which is essentially a configuration for rclone to know where to copy or sync your files. Press n to create a new remote.

Enter a name for your remote, such as b2, to identify it later. Press 3 to select the B2 cloud storage option.

You'll need to enter your account ID and application key from your B2 account. Leave the endpoint blank, as it's not required.

Finally, press y to save the configuration. This will store your remote configuration for future use.

Step 4b: Create Bash Script

Credit: youtube.com, Bash Scripting 4 -- How Bash Scripts Work

In this section, we'll create a bash script that will be used with cron to backup any changes to our local storage to B2.

The script should be created in the /root directory, so let's create a new file called rclone-cron.sh.

Here's the script that we'll be using:

```bash

#!/bin/sh

if pidof -o %PPID -x "rclone-cron.sh"; then

exit 1

fi

echo starting storage sync

rclone copy {/path/to/local/storage} {name of your crypt remote}: -v --log-file={/path/to/log/file} --min-age 15m --copy-links

exit

```

Let's break down what this script does. It first checks if the script is currently being run, and if so, it will exit. This is useful if your initial backup will take a while to run, as it won't try to run rclone again.

The script then prints to the terminal that the clone is starting.

The rclone command is where the magic happens. It uses the copy parameter, which means it will not delete files deleted locally. It also uses the -v flag for verbosity, which will show more detailed output. The --log-file parameter tells rclone where to create a log file, and the --min-age parameter tells rclone not to sync files less than 15 minutes old. Finally, the --copy-links parameter tells rclone to follow symlinks.

Backing Up to B2

Credit: youtube.com, Getting Started with Backblaze B2: Backing up a NAS Device

Backing up to B2 is a straightforward process, and it starts by defining cloud credentials, which can be used for more than one cloud sync.

To set up cloud credentials, you'll need to create a set of credentials for Backblaze B2, which can be used for separate cloud syncs that push different sets of files or directories.

A cloud storage area must also exist, and with Backblaze B2, these are called buckets that must be created before a sync task can be created.

Creating a bucket is a one-time task, and once it's done, you can create a cloud sync task with Tasks ‣ Cloud Sync ‣ Add Cloud Sync.

The Add Cloud Sync dialog will guide you through the process, and you can select the files or directories you want to sync to your B2 bucket.

You can also run existing cloud syncs manually, edit, or delete them with the buttons that appear when a single cloud sync line is selected by clicking with the mouse.

Credit: youtube.com, TrueNAS Backup To BackBlaze

Cloud syncs can be set up to push files to cloud storage, and the last run can be viewed in the Cloud Sync screen, which shows the status of the last run.

If you're new to cloud backups, it's worth noting that cloud credentials can be used for more than one cloud sync, making it easy to manage multiple backups.

You can create multiple cloud syncs using the same set of credentials, and each sync can push different sets of files or directories to your B2 bucket.

Why B2?

Backblaze b2 is a great choice for storing your Freenas backups because it has a s3-compatible API, making it easy to work with s3-aware applications.

Backblaze b2 is a reliable option because it's a single-purpose storage service, which means you don't have to worry about it going away or changing its focus.

One of the main reasons I've chosen Backblaze b2 for years is that it only costs 20% of what the same amount of data would cost to store in S3.

How Much Work Was Involved?

Credit: youtube.com, Backup Via Backblaze B2 | Managing TrueNAS Core

Setting up a task to back up the latest copy of your entire blog to Backblaze B2 can be a bit involved. It requires some configuration to ensure only the latest copies of your files are uploaded and stored in the cloud.

I wanted to avoid paying for storing multiple copies on Backblaze B2, so I focused on setting up a single backup of my latest files. I'm intrigued by the backup options and versioning that Backblaze B2 offers, but I'm also mindful of costs.

To achieve this, I had to set up a task on Backblaze B2 that would only upload the latest copy of my files from my NAS. This involved some research and experimentation to get it just right.

Frequently Asked Questions

What does Backblaze not backup?

Backblaze does not backup operating systems, application folders, temporary internet files, podcasts in iTunes, or other transient data that's not useful in the long term. This helps conserve bandwidth and storage space, ensuring your backed-up data is valuable and easily restorable.

Is Backblaze backup really unlimited?

Yes, Backblaze Unlimited Backup has no data caps or additional charges, but is limited by the speed of your upload connection. This means you can back up as much data as you need, without worrying about storage costs.

Katrina Sanford

Writer

Katrina Sanford is a seasoned writer with a knack for crafting compelling content on a wide range of topics. Her expertise spans the realm of important issues, where she delves into thought-provoking subjects that resonate with readers. Her ability to distill complex concepts into engaging narratives has earned her a reputation as a versatile and reliable writer.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.