Syncing a folder deletes it's locale files

Hi every one.
I just installed nextcloud on my raspberry pi 3, set ssl certificate and everything.
i’m trying to sync a folder from my desktop using the nextcloud software i logged in to my account and set sync from a local folder to the cloud but instead of syncing it’s deleting the folder content.
i tried to click quickly on the make available local from the pull down menu but it’s every time deletes the files, leaves only empty folders.

any idea?

If you connect the client first time with the server you should use empty directory as (at least in theory) from now on the authority over this directory goes to the NC client, controlled by the server and in turn very first sync is expected to replicate server state to the client.

Best approach would be to start with empty local directory and and add files… (especially with Pi in portions and wait for successful sync)

so basically creating a new folder on my desktop sync it and then copy the files to it …
I really don’t understand this… why it works like that…
I wanted to use nextcloud to share files with my parents and as backup but now it looks like i need a backup to my backup or to find other solution to share and store folders/files.
When i looked at nextcloud it seems that it works like google drive/drop box (of course they have redundant storage and backup to there severs but I’m mean sync-ways)

it works this way. maybe you got my reply wrong - if you connect with new empty server you should not point your client to directory with existing files but rather start the sync from an empty folder…

NC is good for this task

Nextcloud (same as googledrive/dropbox) is a sync solution and not a backup. This can keep multiple endpoints in sync but it doesn’t provide any protection if you (or some malware) delete/brake a file - a sync service will happily distribute this action to every connected client.

2 Likes

Thank you for clarifying that :slight_smile: indeed my folders now stay the same :slight_smile: (also i don’t really understand why it’s this way)

about that, what is the best approach to create a backup for the files that sync with the nextcliud server? create a separate truenas and configure something between them or just plug in another HDD (maybe 2 HDD in raid) and create some bash script and enter it to crontab that just copies the files to offline drives (it’s for home use, saving family photos, videos sharing movies, etc)?

And if we are here :slight_smile:, is there a better way to transfer files in the same network to the nextcloud server? instead of the desktop applications and syncing it (i have several hundreds of GB that in sync)

best strategy depends on the goal of your backup. Nextcloud (server) basically consists of the files stored somewhere on the server and database holding additional information like who and when created the file, if the file was shared and which files belong together in case there are file versions…

if you want backup “a snapshot of the current state of the files” it’s fine to copy the files periodically from your sync folder to some other destination using your favorite tool (again it should be not a sync but plain copy to new destination, so keep some history)…

if you want to keep the additional data (and more like contacts, external file shares, file comments) the only way to backup the server in a right way - on other words backup both DB and files at specific point in time. there are lot of different scripts and discussions here in the forum and on the internet, I would recommend to start with official backup manual to recognize what to do and implement it using your favorite backup tool.

I use RAID is well - it’s very convenient and easy way to add resilience to your storage at very little cost (reduced usable storage amount) but it’s important to understand the limits of this technology: raid is not a backup!! Hardware redundancy like Raid protects your data from hardware outage, in case of raid from very specific outage of single or multiple disk drives (depending on raid level). Logical issues like malware attack, user errors and other hardware issues like broken storage controller still can result in data loss.

2 Likes

@yoadmatza

Something about backups. In the most cases a backup is needed because of user fault. And for a backup you need copies of data/structures from older times (e.g. yesterday, …).
You can use backups of your client data e.g. to an external disk. Also you can backup your Nextcloud (Pi) to an external disk. The only important thing is that the backup is independent of the application. Therefore Nextcloud sync is not a backup. An error is propagated to other areas.

If you use a Managed Nextcloud buy the backup option. Sync to a nextcloud client is no backup. Alternatively, you can of course take care of a local backup yourself, e.g. by backing up the synchronized data somewhere ( (incremental) every day).

2 Likes

Thank you @wwe @devnull for the help and input :slight_smile:
As for backup, I’m going to run RAID1 for continuous backup for the machine and offline “copy-paste” for the more important folders to smaller HDD and move that outside the sync.

Sorry. But RAID is no backup. It is only a “backup” for hardware problems. It is no backup for e.g. stupidity at file usage (copy, delete, move, …). You can also loose all of your data as described above. I think RAID is only for 24/7. I do not use RAID (on private) because i do not need 24/7. I also do not need RAID for easy restore in this scenario with a replacement HDD. Hopefully you do not use your Raspberry Pi for high availability of nextcloud services. I think the Pi is more likely to fail than the hard drive(s).

That is a good plan. I use usb hdds.

2 Likes

I’ll use RADI1 (main and copy of main) just for availability and “just in case” that’s why I’m not giving up the offline copy.
The server is basically for the family, sharing family photos/videos and movies/tv-shows, etc.
It’s hard for me to think for “bigger”/more frequent use, for that I believe it would be sufficient (also got rp4 with 8GB RAM and moving to it), but thanks to making it clear about the RP, if you think it won’t hold it (or I’ll see my self), I’ll look into making server pc.

At least for me my family docs, kids pictures etc are the most important stuff I have…

If you are already plan to use 2 hard drives maybe you change your strategy and use one drive for life data and the other one for backups (e.g. Backup App is fully integrated into NC) which protects you from more issues in my eyes than simple RAID…

1 Like

Thank you a lot!
I’ll look into the app and changing strategy :smile: