One-way synchronization

My wife had the unpleasant experience of seeing all the contents of a local directory disappear after a Synology server crash with which it was bidirectionally synchronized. I am trying to find a way to avoid this kind of setback with my new Nextcloud server, but I cannot find a solution.
The desktop software does not seem to allow for one-way synchronization, nor does it issue warnings during downward deletions.
Using software like Rsync could do the job, but the fact that it does not elegantly handle file renaming, folder renaming, or changes in directory structure is a major disadvantage.
Do you have any other ideas?

Hello and welcome to the Nextcloud community support forum :wave:

No, afaik your scenario is not possible with Nextcloud only.

However: Nextcloud (Neither the server nor the client) is a backup tool. I have a feeling you are mixing backups and synchronization, which both have a very different purpose and meaning.

I’d suggest to use the default synchronization mechanism and rethink your backup strategy :wink:

1 Like

I suggest using Syncthing to avoid reliance on a central server, including your own. Give it www-data permissions and you’ll be able to access it’s local directories from Nextcloud.

1 Like

If you don’t back up your data, you will eventually lose it. It’s just a matter of when.

Sure, but the question is about one way sync, not backups. Clearly backups matter if the issue is data loss

The differences between a one-way sync and a backup are largely semantic. Nextcloud isn’t backup software and shouldn’t be considered as such. If you need a one-way sync… really what you need is a backup.

Anyway, I have an idea for a client-side solution for this type of situation, but I’m not sure how hard it’ll be to implement. Maybe I’ll open an issue for it. We see a case like this every so often where an unintended mass deletion occurs under some unpredictable circumstance, so there’s certainly some demand for some type of change.

You could use use Rclone for a one way sync. Rclone supports Nextcloud / WebDAV natively and does exactly what you want. https://rclone.org/webdav/

The question remains why you need it. If backup is the goal, there is more to it than a simple one-way sync, and this shouldn’t probably be your only backup solution, because, let’s assume for a moment that you really only use Nextcloud as a target for the one-way sync and don’t change anything on these files directly on the server. You could still loose files, if you accidentally delete something on the client side and only notice it after the next sync has has been executed.

6 Likes

@Tristant
I agree with the previous speakers. Nextcloud is not a backup. By the way, even your Synology is not a backup if you use it as a network drive, If the person only stores the data there. The best thing would be to backup your Synology. Backup means two independent storage locations of the same data. Synchronization is not part of this.

But you can use Nextcloud as a “backup” even if I advise against it. But then the data must be independent of each other. So you could use virtual folders, WebDAV or just the web interface, so that the data is always local and always in Nextcloud and not synchronized at all. Also a network drive can be a backup if the data is additionally stored locally.

1 Like

Hello and thank you for your numerous replies!
I am a little surprised by so much feedback regarding the word “backup,” I’m not Englishspeaker, I may be missing some nuances.
My nextcloud server uses BTRFS, snapshots of DATADIR are taken every hour and sent to a second site located hundred kilometers away every night. I think this is sufficient backup.
My question concerns the mechanisms of replication between clients and the server.
Since my wife’s catastrophic experience with her friend’s Synology NAS, which “ordered” the deletion of her work folder, I am FORBIDDEN to activate any bi-directional synchronization, even if it seems irrational.
My wish would be to have desktop behavior similar to what the android application does for automatic photo uploads:
Client-side actions are replicated on the server-side (creation, modification, deletion), but server-side actions (or crashes) do not in any way come down to the client-side.
I will investigate rclone on this matter.
thx!

2 Likes

Sounds sufficient to me :slight_smile:

As long as she doesn’t need to modify the the same files on multiple devices, I guess you can do it like this. On the other hand since you have a sufficient backup strategy with hourly snapshots, she might want to reconsider her decision in order to take advantage of a two-way synchronization.

Maybe you could use a third party software to simply “backup” folders and files (that are not included in the Nextcloud client folder/file structure) to the Nextcloud directory structure /data/username/files (e.g. withsftp) and then run occ files:scan --all regularly.

Watch also this video for virtual access to Nextcloud to not sync between client and server:

Sorry, but what’s the advantage of using SFTP, when Rclone can connect directly via WebDAV?

On the other hand, in a one-way-sync scenario you could probably leave Nextcloud completely out of the equation, and just sync via SFTP to a location outside of your Nextcloud folder. You can’t really do anything with these files directly on the server anyways, because the changes are not synchronized back to the client.

Beside of that, I still think that in this case it is not necessary to set up a one-way-sync, because @Tristant already has a sufficient backup strategy in place. But that’s of course up to him.

@Tristant Maybe in your case it would be better to use 2-way-sync with the Nextcloud client and do an additional one-way-sync to another location, (maybe hourly) in order to be able to quickly restore your wife’s work folder independent of the state of your server. That way you would have the best of both worlds :slight_smile:

SFTP was only an example. Maybe WebDAV is a better if only WebDAV is possible.

Yes. That is the goal of a backup. A kind of black hole … as long as you don’t need it. :wink:
And yes. Then you do not need the above occ files:scan --all.

I actually use one way sync on devices with limited storage, such as my phone or audio recorder. :person_shrugging:

Yeah sure, or the automatic photo uploads, or for other things you just want to upload to your Nextcloud in an automated way. But probably not for your main work folder on a PC. Instead, you would do it the other way around and use virtual files if you have limited space on your PC.

The whole point of a Nextcloud is that you can store your files at a central place and and then access and edit them from multiple devices. If you just want to have the work folder of a single PC somewhere stored on a server, you don’t need all the Nextcloud stuff. A simple rsync script via SFTP would be enough. It’s also much easier to set up and maintain than a Nextcloud server. :wink:

This problems is sti not being solved. I myself faced data loss on my local drive for this reason some time ago. But I have real backups so no problem.

Nextcloud clients developers just ignore the simple which for the one way sync option.
I just want to have my data available in the cloud and can access it from all devices everywhere. 99.9% no need to edit or change them so no need for bi directional sync.

The arrogant answer always is: Nextcloud is no backup tool. No it is , but not everybody want no directional sync.

Nextcloud claims of state of the art etc but this simple feature is ignored

1 Like

You can call us arrogant, but I call your rant the response of a spoiled child who didn’t get what it wanted for Christmas.

Nevertheless, I will briefly address two points in your statement:

This is a community forum and the software you are using is completely free and open source. Nobody owes you anything, neither the members of this forum nor the devs. But you are welcome to contribute on GitHub, either by opening bug reports and feature requests, or if you can, by actively participating in the development.

Nobody forces you to use the Nextcloud Client if it doesn’t fit your needs. Any tool that supports WebDAV as a storage backend can be used. I have already mentioned an alternative in this thread.

2 Likes

Look, I understand that you would like to have this feature, but hijacking a thread, when already a solution was found that works for the thread starter, and calling people ignorant, won’t getting you any closer to your actual goal.

There is also certain irony to that, because if you would be less ignorant and a little more open-minded, you could already have your one-way-sync solution running. Nextcloud uses open standards, which means you’re not limited to the functionality of the official client. Just search for “WebDAV Client”, and you will find tools for almost every use case imaginable.

1 Like

I just found out this thread opened in a similar call to mine. Seeing as the response to a specific use case is probably too heated, perhaps it is a matter of opening a feature request in github issue section for the nextcloud client?

Having some experience in opening feature requests, all too often very specific use cases tend to get dismissed when they could be discussed civilly as a non-specific, general functionality. Please see how I’d argue for this to be added to the android client in the thread I opened, if it is any more helpful. Here your quite reasonable request it seems got conflated with backup unnecessarily, which one way sync obviously isn’t and shouldn’t be confused with (even if it might serve as a basis for backup, if the copies are retained with snapshots or another long term retention facility). The one way sync feature has some merit but mind the devs might have political reasons for not touching it, which is often pointed out on github. I highly doubt here is the place for discussing company politics by the devs as to why they might/won’t add a feature X or Y.

One way sync is a much needed feature.