Rclone Backblaze



Each cloud storage system is slightly different. Rclone attempts toprovide a unified interface to them, but some underlying differencesshow through.

Features

Here is an overview of the major features of each cloud storage system.

  • Backblaze B2 is enterprise-grade, S3 compatible storage that companies around the world use to store and serve data while improving their cloud OpEx vs. Amazon S3 and others. Developers use it to easily build apps and manage services. IT leaders use it to backup.
  • In Rclone, run 'rclone listremotes' to check that the Azure Blob or Backblaze B2 containers are in the remotes list. Check that you can access objects inside your Azure Blob or Backblaze B2 containers by using the Rclone commands in the verification.txt file available in the “Attachments' section.
NameHashModTimeCase InsensitiveDuplicate FilesMIME Type
1FichierWhirlpoolNoNoYesR
Amazon DriveMD5NoYesNoR
Amazon S3MD5YesNoNoR/W
Backblaze B2SHA1YesNoNoR/W
BoxSHA1YesYesNo-
Citrix ShareFileMD5YesYesNo-
DropboxDBHASH ¹YesYesNo-
Enterprise File Fabric-YesYesNoR/W
FTP-NoNoNo-
Google Cloud StorageMD5YesNoNoR/W
Google DriveMD5YesNoYesR/W
Google Photos-NoNoYesR
HDFS-YesNoNo-
HTTP-NoNoNoR
HubicMD5YesNoNoR/W
JottacloudMD5YesYesNoR
KoofrMD5NoYesNo-
Mail.ru CloudMailru ⁶YesYesNo-
Mega-NoNoYes-
MemoryMD5YesNoNo-
Microsoft Azure Blob StorageMD5YesNoNoR/W
Microsoft OneDriveSHA1 ⁵YesYesNoR
OpenDriveMD5YesYesPartial ⁸-
OpenStack SwiftMD5YesNoNoR/W
pCloudMD5, SHA1 ⁷YesNoNoW
premiumize.me-NoYesNoR
put.ioCRC-32YesNoYesR
QingStorMD5NoNoNoR/W
Seafile-NoNoNo-
SFTPMD5, SHA1 ²YesDependsNo-
SugarSync-NoNoNo-
Tardigrade-YesNoNo-
WebDAVMD5, SHA1 ³Yes ⁴DependsNo-
Yandex DiskMD5YesNoNoR
Zoho WorkDrive-NoNoNo-
The local filesystemAllYesDependsNo-

Notes

¹ Dropbox supports its own customhash.This is an SHA256 sum of all the 4MB block SHA256s.

2) BackBlaze B2. It's again secure, afforadble and more fast. It doesnt have an application for Linux so I am looking at using Rclone. Has anyone tried using rclone and readynas and especially rclone with Backblaze B2. Are there any challenges, pitfals or is it straightforward? Any additional info/reviews on.

² SFTP supports checksums if the same login has shell access andmd5sum or sha1sum as well as echo are in the remote's PATH.

³ WebDAV supports hashes when used with Owncloud and Nextcloud only.

⁴ WebDAV supports modtimes when used with Owncloud and Nextcloud only.

⁵ Microsoft OneDrive Personal supports SHA1 hashes, whereas OneDrivefor business and SharePoint server support Microsoft's ownQuickXorHash.

⁶ Mail.ru uses its own modified SHA1 hash

⁷ pCloud only supports SHA1 (not MD5) in its EU region

⁸ Opendrive does not support creation of duplicate files usingtheir web client interface or other stock clients, but the underlyingstorage platform has been determined to allow duplicate files, and itis possible to create them with rclone. It may be that this is amistake or an unsupported feature.

Hash

The cloud storage system supports various hash types of the objects.The hashes are used when transferring data as an integrity check andcan be specifically used with the --checksum flag in syncs and inthe check command.

To use the verify checksums when transferring between cloud storagesystems they must support a common hash type.

ModTime

The cloud storage system supports setting modification times onobjects. If it does then this enables a using the modification timesas part of the sync. If not then only the size will be checked bydefault, though the MD5SUM can be checked with the --checksum flag.

All cloud storage systems support some kind of date on the object andthese will be set when transferring from the cloud storage system.

Case Insensitive

If a cloud storage systems is case sensitive then it is possible tohave two files which differ only in case, e.g. file.txt andFILE.txt. If a cloud storage system is case insensitive then thatisn't possible.

This can cause problems when syncing between a case insensitivesystem and a case sensitive system. The symptom of this is that nomatter how many times you run the sync it never completes fully.

The local filesystem and SFTP may or may not be case sensitivedepending on OS.

  • Windows - usually case insensitive, though case is preserved
  • OSX - usually case insensitive, though it is possible to format case sensitive
  • Linux - usually case sensitive, but there are case insensitive file systems (e.g. FAT formatted USB keys)

Most of the time this doesn't cause any problems as people tend toavoid files whose name differs only by case even on case sensitivesystems.

Duplicate files

If a cloud storage system allows duplicate files then it can have twoobjects with the same name.

This confuses rclone greatly when syncing - use the rclone dedupecommand to rename or remove duplicates.

Restricted filenames

Some cloud storage systems might have restrictions on the charactersthat are usable in file or directory names.When rclone detects such a name during a file upload, it willtransparently replace the restricted characters with similar lookingUnicode characters.

This process is designed to avoid ambiguous file names as much aspossible and allow to move files between many cloud storage systemstransparently.

The name shown by rclone to the user or during log output will onlycontain a minimal set of replaced charactersto ensure correct formatting and not necessarily the actual name usedon the cloud storage.

This transformation is reversed when downloading a file or parsingrclone arguments.For example, when uploading a file named my file?.txt to Onedrivewill be displayed as my file?.txt on the console, but stored asmy file?.txt (the ? gets replaced by the similar looking character) to Onedrive.The reverse transformation allows to read a fileunusual/name.txtfrom Google Drive, by passing the name unusual/name.txt (the / needsto be replaced by the similar looking character) on the command line.

Default restricted characters

The table below shows the characters that are replaced by default.

When a replacement character is found in a filename, this characterwill be escaped with the character to avoid ambiguous file names.(e.g. a file named ␀.txt would shown as ‛␀.txt)

Each cloud storage backend can use a different set of characters,which will be specified in the documentation for each backend.

CharacterValueReplacement
NUL0x00
SOH0x01
STX0x02
ETX0x03
EOT0x04
ENQ0x05
ACK0x06
BEL0x07
BS0x08
HT0x09
LF0x0A
VT0x0B
FF0x0C
CR0x0D
SO0x0E
SI0x0F
DLE0x10
DC10x11
DC20x12
DC30x13
DC40x14
NAK0x15
SYN0x16
ETB0x17
CAN0x18
EM0x19
SUB0x1A
ESC0x1B
FS0x1C
GS0x1D
RS0x1E
US0x1F
/0x2F
DEL0x7F

The default encoding will also encode these file names as they areproblematic with many cloud storage systems.

File nameReplacement
.
....

Invalid UTF-8 bytes

Some backends only support a sequence of well formed UTF-8 bytesas file or directory names.

In this case all invalid UTF-8 bytes will be replaced with a quotedrepresentation of the byte value to allow uploading a file to such abackend. For example, the invalid byte 0xFE will be encoded as ‛FE.

A common source of invalid UTF-8 bytes are local filesystems, that storenames in a different encoding than UTF-8 or UTF-16, like latin1. See thelocal filenames section for details.

Encoding option

Most backends have an encoding options, specified as a flag--backend-encoding where backend is the name of the backend, or asa config parameter encoding (you'll need to select the Advancedconfig in rclone config to see it).

Rclone

This will have default value which encodes and decodes characters insuch a way as to preserve the maximum number of characters (seeabove).

However this can be incorrect in some scenarios, for example if youhave a Windows file system with characters such as and thatyou want to remain as those characters on the remote rather than beingtranslated to * and ?.

The --backend-encoding flags allow you to change that. You candisable the encoding completely with --backend-encoding None or setencoding = None in the config file.

Encoding takes a comma separated list of encodings. You can see thelist of all available characters by passing an invalid value to thisflag, e.g. --local-encoding 'help' and rclone help flags encodingwill show you the defaults for the backends.

EncodingCharacters
Asterisk*
BackQuote`
BackSlash
Colon:
CrLfCR 0x0D, LF 0x0A
CtlAll control characters 0x00-0x1F
DelDEL 0x7F
Dollar$
Dot.
DoubleQuote'
Hash#
InvalidUtf8An invalid UTF-8 character (e.g. latin1)
LeftCrLfHtVtCR 0x0D, LF 0x0A,HT 0x09, VT 0x0B on the left of a string
LeftPeriod. on the left of a string
LeftSpaceSPACE on the left of a string
LeftTilde~ on the left of a string
LtGt<, >
NoneNo characters are encoded
Percent%
Pipe|
Question?
RightCrLfHtVtCR 0x0D, LF 0x0A, HT 0x09, VT 0x0B on the right of a string
RightPeriod. on the right of a string
RightSpaceSPACE on the right of a string
SingleQuote'
Slash/

To take a specific example, the FTP backend's default encoding is

However, let's say the FTP server is running on Windows and can't haveany of the invalid Windows characters in file names. You are backingup Linux servers to this FTP server which do have those characters infile names. So you would add the Windows set which are

to the existing ones, giving:

This can be specified using the --ftp-encoding flag or using an encoding parameter in the config file.

Or let's say you have a Windows server but you want to preserve and , you would then have this as the encoding (the Windowsencoding minus Asterisk and Question).

This can be specified using the --local-encoding flag or using anencoding parameter in the config file.

MIME Type

MIME types (also known as media types) classify types of documentsusing a simple text classification, e.g. text/html orapplication/pdf.

Some cloud storage systems support reading (R) the MIME type ofobjects and some support writing (W) the MIME type of objects.

The MIME type can be important if you are serving files directly toHTTP from the storage system.

If you are copying from a remote which supports reading (R) to aremote which supports writing (W) then rclone will preserve the MIMEtypes. Otherwise they will be guessed from the extension, or theremote itself may assign the MIME type.

Optional Features

All rclone remotes support a base command set. Other features dependupon backend specific capabilities.

NamePurgeCopyMoveDirMoveCleanUpListRStreamUploadLinkSharingAboutEmptyDir
1FichierNoYesYesNoNoNoNoYesNoYes
Amazon DriveYesNoYesYesNoNoNoNoNoYes
Amazon S3NoYesNoNoYesYesYesYesNoNo
Backblaze B2NoYesNoNoYesYesYesYesNoNo
BoxYesYesYesYesYes ‡‡NoYesYesYesYes
Citrix ShareFileYesYesYesYesNoNoYesNoNoYes
DropboxYesYesYesYesNoNoYesYesYesYes
Enterprise File FabricYesYesYesYesYesNoNoNoNoYes
FTPNoNoYesYesNoNoYesNoNoYes
Google Cloud StorageYesYesNoNoNoYesYesNoNoNo
Google DriveYesYesYesYesYesYesYesYesYesYes
Google PhotosNoNoNoNoNoNoNoNoNoNo
HDFSYesNoNoNoNoNoYesNoYesYes
HTTPNoNoNoNoNoNoNoNoNoYes
HubicYes †YesNoNoNoYesYesNoYesNo
JottacloudYesYesYesYesYesYesNoYesYesYes
Mail.ru CloudYesYesYesYesYesNoNoYesYesYes
MegaYesNoYesYesYesNoNoYesYesYes
MemoryNoYesNoNoNoYesYesNoNoNo
Microsoft Azure Blob StorageYesYesNoNoNoYesYesNoNoNo
Microsoft OneDriveYesYesYesYesYesNoNoYesYesYes
OpenDriveYesYesYesYesNoNoNoNoNoYes
OpenStack SwiftYes †YesNoNoNoYesYesNoYesNo
pCloudYesYesYesYesYesNoNoYesYesYes
premiumize.meYesNoYesYesNoNoNoYesYesYes
put.ioYesNoYesYesYesNoYesNoYesYes
QingStorNoYesNoNoYesYesNoNoNoNo
SeafileYesYesYesYesYesYesYesYesYesYes
SFTPNoNoYesYesNoNoYesNoYesYes
SugarSyncYesYesYesYesNoNoYesYesNoYes
TardigradeYes †NoNoNoNoYesYesNoNoNo
WebDAVYesYesYesYesNoNoYes ‡NoYesYes
Yandex DiskYesYesYesYesYesNoYesYesYesYes
Zoho WorkDriveYesYesYesYesNoNoNoNoYesYes
The local filesystemYesNoYesYesNoNoYesNoYesYes

Purge

This deletes a directory quicker than just deleting all the files inthe directory.

Rclone backblazeRclone Backblaze

† Note Swift, Hubic, and Tardigrade implement this in order to deletedirectory markers but they don't actually have a quicker way of deletingfiles other than deleting them individually.

‡ StreamUpload is not supported with Nextcloud

Copy

Used when copying an object to and from the same remote. This knownas a server-side copy so you can copy a file without downloading itand uploading it again. It is used if you use rclone copy orrclone move if the remote doesn't support Move directly.

If the server doesn't support Copy directly then for copy operationsthe file is downloaded then re-uploaded.

Move

Used when moving/renaming an object on the same remote. This is knownas a server-side move of a file. This is used in rclone move if theserver doesn't support DirMove.

If the server isn't capable of Move then rclone simulates it withCopy then delete. If the server doesn't support Copy then rclonewill download the file and re-upload it.

DirMove

This is used to implement rclone move to move a directory ifpossible. If it isn't then it will use Move on each file (whichfalls back to Copy then download and upload - see Move section).

CleanUp

This is used for emptying the trash for a remote by rclone cleanup.

If the server can't do CleanUp then rclone cleanup will return anerror.

‡‡ Note that while Box implements this it has to delete every fileindividually so it will be slower than emptying the trash via the WebUI

ListR

The remote supports a recursive list to list all the contents beneatha directory quickly. This enables the --fast-list flag to work.See the rclone docs for more details.

StreamUpload

Some remotes allow files to be uploaded without knowing the file sizein advance. This allows certain operations to work without spooling thefile to local disk first, e.g. rclone rcat.

LinkSharing

Sets the necessary permissions on a file or folder and prints a linkthat allows others to access them, even if they don't have an accounton the particular cloud provider.

About

Rclone about prints quota information for a remote. Typical outputincludes bytes used, free, quota and in trash.

If a remote lacks about capability rclone about remote:returnsan error.

B2 Cloud Storage

Backends without about capability cannot determine free space for anrclone mount, or use policy mfs (most free space) as a member of anrclone union remote.

See rclone about command

EmptyDir

The remote supports empty directories. See Limitationsfor details. Most Object/Bucket based remotes do not support this.

Rclone brands themselves as “rsync for cloud storage”, and with its versatility and the number of providers it supports I’m inclined to believe them.

The setup I describe below is one that I use as a component of my backup process. It’s an automated, off-site, encrypted copy of my Documents folder from early in the morning before I start my day. It’s not meant to be a primary recovery source, but will be there if I need it.

The short of it is that I can sync my Documents directory to a Backblaze storage bucket with a single command line which I then pop into a script file that gets executed by cron every morning.

I chose Backblaze based on it’s reputation and price. They have a solid reputation and B2 is their business storage product. As for pricing, the comparison can be seen here.

Start by Logging into Backblaze, navigating to Buckets, and creating a new bucket. Give it a unique name and ensure it’s private. I chose to call mine “Desktop-1810-Documents”.

Now click the link to “Show Account ID and Application Key”. Under “Add Application Key” create a new key with access to only the bucket you just created. Copy the Application Key it shows you at the end, you won’t see it again and will have to create a new Application Key if you lose it or need to change it in the future.

Install Rclone

Compare your package version to the latest available from the Rclone website and then either install the package repository version or follow the instructions for the scripted install from their website.

Configure

Open a command prompt and type rclone config. We will start by creating a “backblaze” container pointing to our B2 bucket.

Select ‘n’ for a new remote and name it “backblaze”.

Use the bucket applicationKeyId as the account and the Application Key itself as the key. Do not use your actual Account ID listed at the top of the Buckets page.

Now decide if you’d like to have files permanently deleted when you delete them from your local machine. Skip the advanced config (select ‘n’) and then review and finalize your settings.

Verify it worked with rclone lsd backblaze: The output should be the name of the B2 bucket.

Now we’re going to create an encrypted remote named “encrypted_b2” inside our backblaze remote.

Run rclone config again and select ‘new remote’. This time call it “encrypted_b2” and select the Encrypt/Decrypt a remote option from the list of remotes.

It will now ask for the name of the remote to encrypt. Here type in backblaze: followed by the B2 Bucket name from above. In my case this would be backblaze:Desktop-1810-Documents

Answer the remaining questions about encrypting file names and complete the wizard.

Your remote is now configured and all of your backup destinations should point to encrypted_b2.

Rclone Backblaze Slow

We’re now ready to perform the first sync.
rclone sync -v /home/user/Documents/ encrypted_b2:/Documents/

Once completed (and after a few minutes) you can go back to the Backblaze B2 website, click on the Bucket, and you should see one high-level folder possibly with the name encrypted depending on your earlier choice.

Backblaze Backup

Congratulations, your files are now backed-up securely offsite at minimal cost!

Rclone Backblaze B2

Now paste that line into a text file, name it with a .sh extension, make it executable, and schedule it with cron.

B2 Backblaze

To restore files you would just initiate a sync in the opposite direction.
rclone sync -v encrypted_b2:/Documents/ /home/user/Desktop/restoredDocs/

Backblaze Rclone Mount

As a nice bonus Rclone also gives you the ability to mount a remote B2 bucket as a local drive with the rclone mount command.

B2 Cloud

Please enable JavaScript to view the comments powered by Disqus.