Restore with database dump but missing files

Nextcloud version (eg, 12.0.2): 15.0.13
Operating system and version (eg, Ubuntu 17.04): Debian Stretch
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.25
PHP version (eg, 7.1): 7.3

The issue you are facing:

My nextcloud instance was on a server which crashed (disk issue). I performed regular backups of the database but not of the files (on the server). I reinstalled the server, nextcloud, imported the lastest db dump and connected the client again.

The client tells me everything is synchronized but I have no file on the server. I think this is normal as the check is done regarding the db content and not the filesystem.

What can I do in order to upload back the files to the server ?

You won’t get any files back by restoring the database, because it only holds the meta data of the files. I’m sorry, but if you don’t have a backup of your files stored somewhere else, e.g. on a separate disk or your mobile phone etc., no way exist to get it back. :frowning_face:

Yes, I understand that, and I do have the files on my computer so I did not loose them. The db is inconsistent as it has metadata in the db and no corresponding file on the filesystem, I would only like to upload them using the client if possible…

Else I will cleanup the database and upload them again, but I would like to keep the sharings for example :wink:

Ok, that sounds better. If you’ve restored your files from your PC, you can use the occ tool (./occ files:scan --help) to update the file table afterwards .

I did not restore the files on the server, they are still on my client and I would like, if possible, that the nextcloud client upload them again on the server.

The reason is I am not the only user and I don’t want to got on any other client and upload (via SSH) the files again on the server

  1. Try it. I have never used the desktop app for such a task, because WebDAV is usually slower when copying files than an scp command on the console.

  2. I don’t understand what you’re afraid off. If you copy the files to the right directory, no-one else will be able to access it. It is always a question how you do the job.

I configured again the client to synchronize with my local folder and it did nothing as it thinks that it is yet synchronized… So the purpose of my question is to make the client think that it is not synchronized and upload the files again, or to make nextcloud realize that its database is not corresponding to the existing files.

But you’re right, I think the best way is to:

  1. scp the files to the server from the client
  2. rebuild the database on the server : occ files:scan
  3. reconfigure the client to synchronize again

But the problem is I have to do it on every client :unamused:

That’s the reason why a central backup of all relevant data is recommended, not only the database and the configuration file. Nowadays you can set-up e.g. a small NAS to which you’re mirroring your data to and it prevents any future local restore activities on the clients :wink: