[NextCloudPlus] Data directory broken after revert from USB - how to initialize storage settings?

My setup (RPi 3) became unresponsive although there wasn’t much CPU activity. So I assumed that my external drive is failing. I tried to move the database and the data directory back to their respective default locations. It seems something is still pointing to the USB, there are lots of errors like the following in the logs:

filesize(): stat failed for 
/media/USBdrive/ncdata/appdata_ocmx0enqff4e/avatar/admin/avatar.32.png 
at /var/www/nextcloud/lib/private/LargeFileHelper.php#171

How can I get the original state back? I don’t worry about the files but the general configuration and the database should remain.

Edit: I noted that my settings don’t stick. This is what the dialog shows:

image

you will have to move it manually, and change config.php accordingly. Allowing users to move it to the SD card results in complaints because of SD card full so we disallowed it.

Thanks. I moved it manually and tried to changed the config but it looks like there is still something pointing to the USB drive. Also, it seems to start moving and then breaking which left me with a mess.

I don’t mind deleting files but how do I create the initial state on the SD card?

if you don’t mind losing files, accounts, calendars and so on you can run nc-init to clear everything up

Thanks for replying but that’s the issue. I can lose files but not calendars, contacts and users.

you need to have the right data directory in config.php and the right database directory in /etc/mysql/mariadb.conf.d/50-server.cnf.

an ugly option is to create a dump of the database ( google mysqldump ), then restore it after nc-init and then run nc-scan, but I would avoid that.

In the future just setup automatic backups and your life will be easier :wink: