How to restart Nextcloud instance form outdated data?


I recently experienced an HDD failure, and unfortunately, the most recent viable backup I have is from 2 months ago. This means I have lost some data. However, I still have the latest version of the Nextcloud database, which was stored on a separate SDD.

My plan is to restore the Nextcloud data from the 2-month-old backup while keeping the latest version of the database. I intend to combine the backup with the latest database and then perform the occ files:scan command to remove any files that are not available in the 2-month-old backup.

Could you please confirm if this is the recommended approach?

Additionally, some of the data that was lost on the server side was shared with another user who synchronizes everything locally using the desktop client. I’m concerned that when I execute the occ files:scan command, the desktop client will delete the locally synced files that are no longer available on the server.

Is there any way to prevent this from happening? In the worst case scenario, I am prepared to ask all users to disconnect their desktop clients and manually merge their local copies with the new Nextcloud server.

Thank you in advance for your help.

Seems fine. I’m not sure “recommended” is the appropriate word - recommended is to have database and data backups in sync. :wink:

This is a legitimate concern.

If that data that is only located on the client-side (sounds like it), yes, important, I don’t think you’ll be able to work around it any way other isolating the desktop clients then manually integrating the data. One thought is that you could isolate the desktop clients (the app really) and have users re-integrate the missing data via the web UI.

Not sure how disparate the data is but another idea that comes to mind - but may be more clever than is necessary or you’re willing to hassle with - is to collect the missing data from users ahead of time than add it to their folders on the server directly. Then when you bring NC online with the more recent db it’ll see the files as if they weren’t even missing from your backups.

No matter what it’s going to be some extra work. Keep backups around along the way as much as possible - particularly of the clients if possible - while you’re working out the bugs in your recovery process.

Good luck!

1 Like