"Error reading data directory. Is NextCloud running and configured" after formatting second external drive

I am on nextcloudpi that is up to date.

I was trying to set up backups on my server. I have 2 external storage devices. one a 500 gb drive and one a 150gb drive. when I set up the datadir and moved the data to the 500 drive I intended to use the 150 as a back up. how ever What I did not know is that some file system information was put on the 150. when I went to set up my back ups I formatted that drive. Now when I go to nextcloud I get:

"Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log."

there are no details below

I tried checking the datadir using the ncp-config tool i get

“Running nc-datadir
Error reading data directory. Is NextCloud running and configured?
Done.Press any key”

I found this post

they suggest using rsync but there is also a response about using

btrfs create subvolume /media/myCloudDrive/ncdata

I am stuck I did not intailly set up the back ups and have been using nextcloud for a few months would this help or is there another way to recover the data? I still have the full ncdata folder on the 500, would I be able to recover with this?

here is the ncp-report output NextcloudMistake - Pastebin.com

nc-datadir is for moving your datadir not for checking it.
It looks like you made a mess, when adding the second drive…
Also moved the database to /home/pi/DataDir ?

If your actual data is still available on the usb-drive, you can do a fresh install, manually edit nc’s config.php to point to it. Then run nc-scan to re-create your database.

NCP’s documentation

“Also moved the database to /home/pi/DataDir ?”

So I did that on purpose, I was trying to speed things up. I was using this guide


How to reduce IO on the USB-BUS?

  • We can use WLAN for accessing the device so load is taken away from USB-BUS.
  • If Nextcloud-Data and Nextcloud-Database are on the same Storage device (e.g. the USB-Storage) move the Nextcloud-database (back) to another device (e.g. the micro-SD-card). So database-access and file-access are on different devices.

I will try the solution you gave me and report back.

So I set up the usb and ran the scan I get this

Your data directory is invalid
Ensure there is a file called “.ocdata” in the root of the data directory.

Your data directory is readable by other users
Please change the permissions to 0770 so that the directory cannot be listed by other users.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:168
Stack trace:
#0 /var/www/nextcloud/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Obj
#1 /var/www/nextcloud/occ(11): require_once(’/var/www/n