Thank you for this link. I’m trying to go down the list, and I think I may have found part of the problem:
- Format USB drive (optional but check note).
I have confirmed that the drive is formatted as BTRFS -
- Enable
nc-automount.
Automount is enabled.
- Enable
- Configure Nextcloud data to be on the USB drive.
This seems to be the current problem.
In the instructions you linked it says to “Change DATADIR to your data location in the mount point.” In the WebUI I tried to do so, but I get the following output:
Data directory: /media/USBdrive/ncdata (I click apply)
[ nc-datadir ] (Wed Jul 23 19:45:34 UTC 2025)
INFO: /media/myCloudDrive/ncdata is not empty. Creating backup /media/myCloudDrive/ncdata-07-23-25.1753299935
Your data directory is invalid.
Ensure there is a file called ".ncdata" in the root of the data directory. It should have the content: "# Nextcloud data directory"
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:143
Stack trace:
#0 /var/www/nextcloud/console.php(81): OC\Console\Application->loadCommands()
#1 /var/www/nextcloud/occ(33): require_once('...')
#2 {main}
In my NextCloud configuration list, the data directory is /opt/ncdata/data. When I check this folder over SSH, it’s empty. I don’t know why there is a folder called “myCloudDrive” mentioned in the output when I tried to assign “USBdrive” as my data directory, but it exists and appears to have identical contents to USBdrive.
Here’s one question I have: could I copy the contents of USBdrive/ncdata (which is the directory “Data”) back to the original data directory (/opt/ncdata/data). If the system still believes that this is the data directory, would copying the files back into the folder allow it to resume working? This wouldn’t solve my overall problem, in that I’d still need to figure out how to move the files successfully onto the USB drive. But it would be nice to successfully revert back to a functional state.
Second: how do I correct the error that prevents me from reassigning the data directory? What does this error (“Environment not properly prepared. in /var…Application.php:143”) mean?