I have NextcloudPi installed on SBC which has a external drive attached to it, this is my private cloud solution. Today I was getting internal server error on login to nextcloud so I updated the Nextcloud to 15.0.7, then I got message saying don’t forget to run nc-init which I did but the I see all the users are gone and even the data in external drive. I was not aware that running nc-init will wipe out all users and data in external hard drive. I am so upset that all of my data is gone, specially my picture and important documents.
Internal server error is a generic error messages that is caused by a number of very different causes. The logfile should help in this case to find out more. Running an update does not repair problems on your system but problems on your system can make your update fail or even break certain stuff.
If this did not appear in previous updates, this must ring a bell that something is wrong. Initializing stuff often mean to delete some existing configuration/setting.
@nachoparker is this the case? Then there should be a better warning before running nc-init. Or perhaps in general if it is not part of the update/upgrade procedure at all.
If it is so important, you certainly have a backup?
Stop for a moment, wait for the response what nc-init actually does. What filesystem are you using on your disk? Don’t do anything to the disk for the moment, with some tools you can sometimes recover data (if you clean up things, put new data etc. you risk to overwrite the deleted files. Sometimes deleted files are not overwritten and just marked as deleted, in that case they can be recovered. But make sure what you are doing before you are actually doing it!).
Not 100% sure but if nc-datadir was used to move data to an external drive. When running nc-init ; The data dir will be reset and be recreated at NC’s default /var/www/nextcloud/data and the data dir in the external drive is likely to be still in place.
In which case: manually recreating the users, setting data dir path in config, and running nc-scan, should be all that is needed to restore.
The problem was not nc-init, which wipes out your config and database, but nc-nextcloud, which also removes your data. Like Oliver said, if you moved it to the external hard drive then it will still be there.
This is not the way to upgrade, it is very clearly explained that this creates a new empty instance. In order to upgrade there is a whole UPDATE section and the command you should have used is nc-update-nextcloud
Instead you run nc-nextcloud and didn’t read the warning
In any case we need to backup our data always.
edit: @OliverV, please don’t push directly but open a PR instead so it can be reviewed before merge
Thanks guys, really appreciate such a support. First I thought I lost all the data because I didn’t know where to look for it, but then I ran df -h command I saw external HDD still has data in it, then I checked mounting point of external HDD to check if data is there, which it was. I did nc-init again to setup new instance then used nc-sync to make data visible again in app. This was a good learning experience.