This article was originally posted on my blog.
Backing up files is arguably one of the most important things someone can do on their computer. Ensuring there is a copy of your most important data affords you the ability to not worry about a future ransomware virus, a stolen/broken computer, or just a simple accident that could erase your information forever.
A strategy that is widely seen as a very effective way to backup your data is the 3-2-1 Backup Rules/Best Practices:
With the following guide, I hope to be able to have an additional copy of my data, stored on a different storage type, and synced with a cloud service provider - Backblaze in this case.
If you already have a computer setup, please skip this step. If not, see the list of hardware I used for this project - found below:
Note: If you do not have an extra hard drive sitting around, you can purchase external drive instead.
The only prerequisite for the computer is that you have Windows, macOS, or Linux installed and functioning. Plug in your external hard drive and make sure that it is functioning correctly. Additionally, ensure that you have an active internet connection as that will be required for installing the necessary software and uploading your files to Backblaze B2 for backup.
While Rclone supports many different cloud providers (see their website here), I will be using B2 from Backblaze. Follow the instructions on the B2 website to setup your B2 account and get your API key - this key will allow you to access you B2 account through Rclone.
Rclone will need to be installed on the computer you are using to store your files. If you are not using the same hardware I am, please install the Rclone version that will work for your computer. Visit the Rclone downloads page to find the installer for your computer. If you are following my hardware choice, select the ARM - 32 Bit installer. Finally, follow the installation instructions on the Rclone website to properly install Rclone on your computer.
nto create a new remote.
- Specify a name to reference this remote in commands. For my purposes, I chose
enterto select Backblaze B2.
- Enter your Backblaze Account ID then hit
- Enter your Backblaze Application Key then hit
- Leave Endpoint blank then hit
enterto save configuration.
For more information, please visit the Rclone B2 website.
nto create an encrypted container.
- Specify a name to reference this container in commands. For my purposes, I chose
enterto select crypt.
enterto select the previously made remote.
standardfor encrypted file names.
- Choose a passphrase or generate one.
- Choose a salt or generate one.
yto confirm the configuration and press
qto close Rclone.
Now, when wanting to backup a folder to BackBlaze, type the following command:
rclone sync /path/to/folder secret:
This line takes all of your files in the folder path and uploads them to your Backblaze B2 bucket. For me, I write the following line:
rclone sync Backup/ secret
Note: There are two options for uploading to the cloud. While I use
sync, you can also use
copy. Here are the differences:
Syncwill mirror the folder path exactly from your local filesystem to Backblaze. This deletes files in the destination that have been removed from the source.
Copywill copy files from your local filesystem to Backblaze where deleted files will NOT be deleted from Backblaze.
If you have a lot of files to upload that could take a long time, use the following command so that output is recorded to a file and the upload will not get killed if you log out:
setsid [command] --log-file /path/to/file.log &>/dev/null
[command] is the command you used above.
The following set of commands will setup your computer to run an automatic backup of your files.
- At the end of the file, add the following command:
0 * * * * /usr/bin/setsid /usr/sbin/rclone sync /path/to/folder secret: &>/dev/null
- Save and exit your crontab file.
Note: You can add an output log file by using the
--log-file parameter found in step 5. Additionally, you can also choose between the
copy rclone modes.
To obtain you files from Backblaze, you will need to configure rclone on a new machine or you will need to move to a different location of your uploading computer. It can be helpful to backup you configuration files to make it easier to restore. Once your configuration is correct, run the following command:
rclone sync secret: /path/to/folder
Your files are now being securely backed up to the cloud!
Comments or Question?
Please feel free to drop me a note here.