Manually copying files to a fresh installation

Hi all

Long story short, the database of nextcloud got nuked and I am making a fresh install. Thankfully, I still have the uploaded files in my server. I am installing to a new location so as to not cause conflicts and once installed, the plan is to copy over the files using rsync and do a occ files:scan --allcommand to get the files into the DB.

Is this the correct way to do it? Reading Can I move files direct to Nextcloud? and Nextcloud server on Ubuntu - First time "manual" files copy - Is it safe?, it seems so but they are a couple of years old and I wanted to confirm if things still stand the same.

The other more important question that I have is what will happen if I start syncing with my PC. Before the incident, the files uploaded to Nextcloud were synced to my PC. Since the incident, I have created and modified files that were not synced and as such they will not be present after I do the rsync. I am afraid that Nextcloud might see differences in its database/file system and my local PC filesystem, see some files present in my PC that it doesn’t have and proceed to delete them.

Is this a justified fear? I have no idea how nextcloud determines difference and whether to copy a file or delete it. I would prefer not to start the sync from the beginning.

in some situation putting files into server storage followed by occ files:scan might be useful. But you should never connect a client previously synced with another system (which is the case even if new one runs on same metal…) - always create another account and choose different local destination when you sync with another Nextcloud system.

As long you still have all the files stored on the client it could be an option to sync them from the client to a new server (but here above applies as well: first connect empty folder with the new server and then add the content there). If you have lot of data this approach is likely slower than server-side copy…

1 Like

Thanks for the response. This is what I was weary of. I have tried deleting the .db file in the synced folder before starting the sync with the fresh server. It seems like this creates a fresh .db file and doesn’t delete the files and folders in the client. Is this a correct and reliable observation or should I not be relying on this?