All Data Gone After Update

ncp
nc15
update_problems
#1

Hello,

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.

Please help me get them back if possible.

Thanks,
Sandeep

0 Likes

#2

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!).

0 Likes

#3

Yes it does, it resets everything to a clean NC install.

This is what current nc-init warning looks like in nc-config.
Is it not enough? I suppose we could add some additional warnings.

0 Likes

#4

The configuration and the settings (sharing links, theming etc.) are probably less critical to most but it isn’t clear what happens to your data…

0 Likes

#5

I’ve pushed some extra warning, and advice to backup first, into devel at https://github.com/nextcloud/nextcloudpi/blob/devel/etc/ncp-config.d/nc-init.cfg
Hopefully this will avoid running nc-init, without being fully aware of this, in the future.

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.

2 Likes

#6

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

Screenshot_2019-04-13%20NextCloudPi%20Panel

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

1 Like

#7

So with some luck, the hard drive was just not mounted. Or with some bad luck the drive is broken.

0 Likes

#8

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.

0 Likes