Recover data from broken sd card in nextcloudpi

I had a working installation of nextcloudpi running on an SD card but now is not booting. I used fsck and certain errors were fixed but it is still not booting. I can mount it and see the content.

I would like to put a new image in a new SD card but without loosing the database/users/files/etc/configuration. I was using an external USB drive but I am not sure exactly what is there in addition to the user files themselves. So my questions are:

  1. What is exactly stored in the external drive?
  2. What is the correct way to migrate to a new SD drive?

Just connect it and check it (you can boot a live-linux system which should recognize an external drive with a linux file system).

There is software to clone sd-cards: (on a linux system, you can do this on the command line), there are enough guides out there…

With some luck, it is still possible to recover everything. You didn’t write why the system is not booting. Sometimes with too many problems, partitions are mounted as read-only which will result in errors if that is the system’s main partition.