Replace corrupt / broken server installation (general sequence)

Hi,

BACKGROUND

I am using NextCloud-Server on a RaspberryPi for a couple of years, now. I only use the basic file synchronization feature, no further tools / addons. Over these years, I learned a lot of best practices when dealing with external storage, auto-update-configuration, accessibility, maintenance, … unfortunately, from time to time, any installation on RaspberryPi gets corrupted, though. In my case, most likely caused by occasional mains voltage drops (suddenly, there is no supply power for a couple of seconds). This seems to introduce bit errors or corrupt files into the microSD card content at any possible place, causing any possible and odd errors. In the end, updates might permanently fail, login is altered, welcome pages get inaccessible, communicaion fails, …

PROBLEM

In my current case, the RaspberryPi shows and error during boot-up and halts operation. So, there seems no way to try to repair something. Where should I start anyway?

POSSIBLE SOLUTION

As I am using all my personal data (configuration, database and user files) on an external SSD, it should be possible to

(1) disconnect the SSD physically by pulling the USB plug
(2) re-install the RaspberryPi with the newest NCP image
(3) start the NC server and do some re-configurations (create users)
(4) re-connect the SSD physically
(5) mount the SSD to its previously used location
(6) re-configure the connections to the SSD within the NC-settings
(7) re-set the original permissions for the users

and then re-connect the NC clients by

(8) remove all sync files (“.db”, “.db-shm” and “.db-wal” files in the base folders) on NC clients
(9) re-connect to NC server (with reset password)
(10) wait until all files have been synchronized

QUESTIONS

before I try this procedure,

  • does the described action sequence work in general?
  • is it possible to create users which become auto-assigned to existing data locations on the re-connected SSD?
  • does the NC database on the SSD recover correctly on the server side after re-configuration? Or should the database be cleared and re-build by OCC commands?
  • is it really necessary to remove the local sync files on the NC clients prior to connection with the NC server? What will happen if sync files are not removed?
  • will the files on the server SSD be recognized as “most recent” files regarding synchronization when connected to NC clients? Or will a battle start across all clients according to the local file’s creation/modification dates?

I would be really happy if someone could (in detail) answer these questions, here. As it would save me a lot of heartache and time.

Thanks.

here a simplified diagram to clarify the above explanations concerning the server side…

have you tried seeing if the microSD is repairable/recoverable

Hi @Mark_F , as I don’t know where exactly the SD’s data got broken, I wouldn’t know how to repair it. And I, honestly, don’t want to invest further time to search for possible problems and solutions. My experience is (sadly) that the quickest way to solve things seems to be to start from zero. I just want to keep my data while doing so. How would you “repair” an SD card, anyway, without replacing corrupt files when you don’t even know their location?

boot-repair-disk-64.iso from sourceforge