Sync to Backblaze B2

I am trying to sync a folder on Backblaze B2 but have run into a problem. ST always creates an empty directory .stfolder on any synced folder. This folder is created OK initially but is deleted leading to ST stopping and complaining that the index file is missing. This can then lead to all the data being deleted on a remote syncing to this folder.

Has anyone successfully connected Backblaze B2 to ST?

The setup I have is an AWS Debian instance with Backblaze mounted with rclone+fuse and ST v1.20.2

You can just create some dummy file inside that folder, named whatever you like. That should usually prevent those auto-cleanup mechanisms from removing it.

Have you actually experienced any data being deleted because of this? Because the reason for having the folder marker is to prevent exactly that. If it’s missing, no changes will be picked up or synced anymore.

Backblaze automatically creates a zero byte file .bzEmpty on every folder. Would i need to create another file and should it be non-empty?

I haven’t had data loss. I just read various horror stories online so maybe I’m being paranoid :upside_down_face:.

Sorry I just realized that Backblaze is some kind of cloud storage, which apparently you’re mounting via FUSE. Who is actually removing the empty .stfolder then? If Backblaze is adding a dummy file itself, then they’re probably not to blame for it getting removed.

What exactly is the error message? Is the index file missing, or does it say the marker is missing?

Yes, Backblaze B2 is a cloud storage service mounted by FUSE The error message is that “folder marker” is missing. B2 has no notion of directory. That’s why they put the .bzEmpty there.

You can create a .bzEmpty there too if you like, or .stfolder can be a file instead of a directory, or you can configure Syncthing to look for another file than .stfolder.

Thanks. I hadn’t realised that .stfolder could be a file or a folder. Am I right that ST by default attempts to create .stfolder as a folder in any folder that is selected for sync?

Is there a setup option that allows .stfolder creation as a file to be configured?

No, but if you manually create a file called .stfolder, Syncthing will use it as is without creating the folder separately.

The solution seems to be to manually put a file .stfolder on each folder that is to be added to ST. Any .stfolder folder there already should be deleted. In addition, B2 bucket must be configured to NOT save file versions or this confuses ST. I had to run ‘rclone cleanup’ on the B2 bucket several times to clean out all the old versions of files. It seems to be syncing correctly at the moment.

1 Like

And one other thing. Debian rclone from the repo is way out of date. Install it from the install script # rclone.org.

I was premature in thinking that it’s working OK. I found that when a file is modified, ST creates a .syncthing.file.tmp file on B2 which is a zero byte file. B2 creates multiple versions of this even though the bucket is configured to keep only the latest version. Syncing is now stalled with the file showing out of sync. “Rclone cleanup” doesn’t delete the old versions so it looks like ST is continually writing this file as it attemps to sync.

Well. Syncthing expects a reasonable filesystem where it can create files and write to them. Weird stuff will happen if that’s not provided.

Yes, I agree. I found out from B2 that there is no setting to allow one-only file copies. Thus ST will keep creating new files and these will be accumulated until B2 runs its 24hr cleanup cycle. I guess ST has no mechanism for cleaning up these duplicates as it goes.

So it seems that it’s pretty much game over for trying to sync out from B2.

Are you aware of any other cloud storage that is useable with ST?

At least I know what the problem is now.

1 Like