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).
The Basics
-
Nextcloud Server version:
- NextCloud 30.0.1.2
-
Operating system and version:
- NextCloudPi v1.55.4
- Armbian-unofficial 24.8.2 Bookworm \l . 6.6.45-current-bcm2711 (aarch64)
-
Web server and version:
- Apache/2.4.65 (Debian)
-
Reverse proxy and version _(e.g. nginx 1.27.2)
- N/A
PHP version:
- PHP 8.3.12 (cli)
-
Are you using CloudfIare, mod_security, or similar?
- No
Summary of the issue you are facing:
First of all, I am new to Linux and Nextcloud, and I am slower than a disgruntled DMV employee. Talk to me like I am 5.
Moving on: I am testing Nextcloud restoration processes. Scenario: Data is stable and stored in an external hard drive connected directly to my Pi via USB, but the NextCloudPi OS crashes and I need to do a fresh install. What is the simplest way to tell my new Nextcloud installation to use the existing database and data on my external hard drive?
Steps to replicate it:
-
Built NextCloudPi on micro SD card Alpha. Booted pi with mirco SD Alpha to fresh NectCloudPi installation, and activated Nextcloud.
-
Mounted to sda1: /media/USB-HDD
-
Mounted to sda2: /media/USB-Backups
-
Used nc-datadir to move the data directory to /media/USB-HDD/ncdata
-
Used nc-database to move the database to /media/USB-HDD/ncdatabase
-
Created Nextcloud user “Hardvark” and uploaded like 10 GB of test data.
-
Exported NextCloudPi configs to /media/USB-Backups using nc-export-ncp
-
Used nc-backup with “Include data” checked, and stored the backup in /media/USB-Backups/ncp-backups
-
Shut down the pi, and yoinked mirco SD Alpha.
-
Built NextCloudPi on micro SD card Beta. Booted pi with mirco SD Beta to fresh NectCloudPi installation, and activated Nextcloud.
-
Mounted to sda1: /media/USB-HDD
-
Mounted to sda2: /media/USB-Backups
-
Used nc-import-ncp to restore configurations. While importing configurations, I get an error that my database is invalid, and to make sure that .ncdata is in the root of my data folder.
-
Attempt to log into “Hardvark,” but cannot. But I can log into the default ncp user of the new installation on Beta.
I see this error reported in the forums here and there, but I am not finding a real solution or explanation. I think the leading hypothesis is a permissions issue with the /media/USB-HDD/ncdata/data folder.
My understanding of nc-restore is that we are wanting to restore a broken database or corrupted data etc., unpacking our .tar backup to the directory that our Nextcloud instance is currently using. However, there is nothing wrong with my data or database. I don’t want to make a new copy of it. I just want to point my new Nextcloud install to existing data.
If the issue is a permissions issue, I am unsure how to go about resetting ownership properly. Running
$ ls -a -l /media/USB-HDD/ncdata/data
I get
drwxr-x--- 1 www-data www-data 182 Nov 1 23:23 .
drwxr-xr-x 1 root root 8 Nov 1 16:08 ..
drwxrwxr-x 1 www-data www-data 60 Nov 9 2024 appdata_ocut2g9g78ea
-rw-r--r-- 1 www-data www-data 542 Nov 1 15:54 .htaccess
-rw-r--r-- 1 www-data www-data 0 Nov 1 15:54 index.html
-rw-r--r-- 1 www-data www-data 52 Nov 1 15:54 .ncdata
drwxr-xr-x 1 www-data www-data 20 Nov 9 2024 ncp
drwxr-xr-x 1 www-data www-data 94 Nov 1 15:55 ncp-update-backups
-rw-r----- 1 www-data www-data 351970 Nov 1 23:59 nextcloud.log
drwxrwxr-x 1 www-data www-data 64 Nov 8 2024 .opcache
drwxrwxr-x 1 www-data www-data 0 Nov 1 15:55 tmp
So .ncdata exists, and www-data is listed as the owner. (Ignore the weird dates, I had some timesync issues before.)
Logs
The following is an excerpt of the notable error that was output during nc-import-ncp in step 13.
Running nc-datadir
INFO: /media/USB-HDD/ncdata is not empty. Creating backup /media/USB-HDD/ncdata-11-01-25.1762031302
Maintenance mode enabled
moving data directory from /opt/ncdata/data to /media/USB-HDD/ncdata/data...
BTRFS filesystem detected
Create subvolume '/media/USB-HDD/ncdata'
{"reqId":"eXNzgGpxbwWiG2M6JoKu","level":2,"time":"2025-11-01T21:08:28+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /opt/ncdata/data/tmp is not present or writable","userAgent":"--","version":"30.0.1.2","data":[]}
Nextcloud is in maintenance mode, no apps are loaded.
Commands provided by apps are unavailable.
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"
Cannot create "data" directory.
This can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/30/go.php?to=admin-dir_permissions
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:137
Stack trace:
#0 /var/www/nextcloud/console.php(81): OC\Console\Application->loadCommands()
#1 /var/www/nextcloud/occ(33): require_once('...')
#2 {main}Nextcloud is in maintenance mode, no apps are loaded.
Commands provided by apps are unavailable.
System config value logfile set to string /media/USB-HDD/ncdata/data/nextcloud.log
Nextcloud is in maintenance mode, no apps are loaded.
Commands provided by apps are unavailable.
System config value tempdirectory set to string /media/USB-HDD/ncdata/data/tmp
Installing template 'php/opcache.ini.sh'...
Maintenance mode disabled
Installing template 'ncp-metrics.cfg.sh'...
The NC data directory has been moved successfully.
There is surely something really simple that I am missing here.