Support intro
Sorry to hear you’re facing problems. 
The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.
If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.
Getting help
In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.
Before clicking submit: Please check if your query is already addressed via the following resources:
- Official documentation (searchable and regularly updated)
- How to topics and FAQs
- Forum search
(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).
Hi. I tried to run the automated data relocation tool to move data from an SD card on a RaspberryPi to a USB drive, and afterwards I’m getting the following error when I try to access NextCloud:
"
Error
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”
"
It appears that I have a permissions issue. I’d like to undo the move and try again, but I want to make sure I don’t make the problem worse.
The Basics
- Nextcloud Server version (e.g., 29.x.x):
- 31.0.7.1
- Operating system and version (e.g., Ubuntu 24.04):
- NextcloudPi
- Web server and version (e.g, Apache 2.4.25):
- Not sure
- Reverse proxy and version _(e.g. nginx 1.27.2)
- Not sure
- PHP version (e.g, 8.3):
- Not sure
- Is this the first time you’ve seen this error? (Yes / No):
- Yes
- When did this problem seem to first start?
- After an unsuccessful move of my data directory
- Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
- Nextcloud Pi setup
- Are you using CloudfIare, mod_security, or similar? (Yes / No)
- Dunno
Summary of the issue you are facing:
I tried to run the data move wizard to move my data from /opt/ncdata/data on an SD card to a USB drive.
Steps to replicate it (hint: details matter!):
- Plugged in drive
- Started NextcloudPi Wizard. Clicked “USB Configuration”
- Selected yes, I want to move. Continue. Format. Move data.
- Left it overnight
Log entries
[ nc-format-USB ] (Wed Jul 23 05:49:23 UTC 2025)
mmcblk0p2 179:2 0 29.2G 0 part /var/log.hdd\x0a/
/dev/sda: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
NOTE: several default settings have changed in version 5.15, please make sure
this does not affect your deployments:
- DUP for metadata (-m dup)
- enabled no-holes (-O no-holes)
- enabled free-space-tree (-R free-space-tree)
Drive sda formatted successfuly and labeled myCloudDrive
[ nc-datadir ] (Wed Jul 23 05:49:30 UTC 2025)
Maintenance mode enabled
moving data directory from /opt/ncdata/data to /media/myCloudDrive/ncdata/data...
BTRFS filesystem detected
Create subvolume '/media/myCloudDrive/ncdata'
mv: cannot remove '/opt/ncdata/data/.opcache/40b8b70efdcde8a275101195a79f4a37/var/www/nextcloud/core': Directory not empty
[ncp-update-nc]
Running as unit: ncp-update-nc.service
Nextcloud is currently down
Nextcloud update failed (or was installed already).
[ nc-datadir ] (Wed Jul 23 16:29:38 UTC 2025)
INFO: /media/myCloudDrive/ncdata is not empty. Creating backup /media/myCloudDrive/ncdata-07-23-25.1753288179
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}
[ nc-database ] (Wed Jul 23 16:30:10 UTC 2025)
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}moving database to /media/USBdrive/ncdatabase...
Installing template 'mysql/90-ncp.cnf.sh'...
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}
[ nc-automount ] (Wed Jul 23 16:37:16 UTC 2025)
automount enabled
Based on what I’ve read, this looks like a permissions issue. Can anyone suggest the best way to undo this and try again? Or if possible, just complete the move that already started?
I’m a long time Linux user with experience using command line and RaspberryPis, but my knowledge of servers is low, and a lot of my experience overall is shallow and basic so feel free to phrase questions/instructions/explanations like I’m five.