Data Directory is invalid? (Yes, I've searched!)

Hey All!

Having screwed up my previous Nextcloud install, I’m having to start again.

I’ve installed Nextcloud on Ubuntu within Virtualbox (on a Windows 11 host). I want my data directory to be on a (local) network drive that will be backed up. I’ve set up the SMB mounts using fstab:

//<IP_Address>/Users /media/u cifs credentials=/home/<user>/.smbcredentials,uid=www-data,gid=www-data,vers=3.0,nounix 0 0

I keep getting the message:

When I do an ls -l -a in /media/u/Nextcloud, I see:

drwxr-xr-x 2 www-data www-data     4096 Oct 26 12:05 .
drwxr-xr-x 2 www-data www-data     4096 Oct 25 06:45 ..
drwxr-xr-x 2 www-data www-data        0 Oct 26 11:32 appdata_ocuvapdk1w2t
drwxr-xr-x 2 www-data www-data        0 Oct 26 11:32 files_external
-rwxr-xr-x 1 www-data www-data      542 Oct 26 10:59 .htaccess
-rwxr-xr-x 1 www-data www-data        0 Oct 26 10:59 index.html
drwxr-xr-x 2 www-data www-data        0 Oct 26 10:59 <user>
-rwxr-xr-x 1 www-data www-data 94559001 Oct 26 11:33 nextcloud.log
-rwxr-xr-x 1 www-data www-data        0 Oct 26 10:59 .ocdata

My config.php looks like this:

$CONFIG = array (
  'instanceid' => 'ocuvapdk1w2t',
  'passwordsalt' => '<redacted>',
  'secret' => '<redacted>',
  'trusted_domains' =>
  array (
    0 => '<redacted>',
  ),
  'datadirectory' => '/media/u/Nextcloud',
  'check_data_directory_permissions' => false,
  'dbtype' => 'mysql',
  'version' => '25.0.0.18',
  'overwrite.cli.url' => '<redacted>',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '<redacted>',
  'dbpassword' => '<redacted>',
  'installed' => true,
  'maintenance' => false,
);

From what I can see, the Nextcloud config points to the data directory at /media/u/Nextcloud, and that folder has a .ocdata file. www-data has the correct permissions. But still I get this error.

Anyone got any thoughts on what the issue could be here? It’s driving me nuts!

So it seems that this is a re-occurence of an issue that popped up in NC18 (Ensure there is a file called ".ocdata" in the root of the data directory - #3 by quamis) - the fix is to go into Basic Settings, then change to Ajax, then to Cron. The warning message that is displayed points the admin down the wrong rabbit hole! :slight_smile:

This type of setup should only be used for testing. It isn’t likely to be stable long term.

I strongly discourage this approach. Involving a Windows filesystem as your data directory is asking for trouble. My guess is this is the cause of your problems.

If you really must have the data directory on network storage, you’d probably have better luck using iSCSI or maybe NFS.

I would suggest instead keeping the data in the VM and just backing it up to the network drive. It will perform better that way too.

2 Likes

Hi Karl, thanks for taking the time to reply.

I’m a home user, with a single server that needs to serve many purposes, with Windows 11 being an essential for various reasons. If Virtualbox isn’t a recommended solution, what’s the alternative that doesn’t involve adding dedicated hardware? Proxmox?

Regarding storage, I must say I find it hard to get my head around the concept that user data should be nested within the application itself and not stored separately to protect it from applications getting wiped etc. Given the endless issues I face with Nextcloud (mainly due to me not being a Linux guy or a developer), I want to have the assurance that if/when I decide to give up on Nextcloud, all user content will still be available on a standard shared drive.

I’m assured by the fact that I had it working in VirtualBox with network storage previously (although I didn’t do snapshots and backups properly), but you’re not the first person to give those warnings, so maybe I should accept that trying to make NC fit into my setup is just a bad idea…

@captainkev
I think the best possibility is to use the linux storage (Virtualbox) for datadirectory (primary storage) and for more data External Storage at another place e.g. SMB/CIFS.

I would not really use this productively. Also, the access via the External Storage is not optimal. I think best External Storage is Local. Yaybe you can get this mounted in your Virtualbox somehow.

Well… I personally wouldn’t recommend running it on Windows in anything other than Hyper-V, but you can run it in VirtualBox if you need to. Just be careful about shutting it down gracefully before turning it off or sleeping, etc.

I run VMware ESXi on my home setup, but that’s probably atypical.

You say you face endless issues, but then, those endless issues are likely due to you doing weird stuff like this to your setup. So store the data as intended and back it up if you’re worried about data loss.

How about this. Run Nextcloud AIO in Docker on your VM normally and just see if that resolves all your problems. It has a built-in backup utility, but if you’re not comfortable with it, you can zip the whole data directory onto your SMB daily if you want to.

2 Likes