Can't set the data directory to a mounted directory


Nextcloud 16, Ubuntu 18.04 LTS

I have installed nextcloud successful and can access to the Nextcloud-Startpage, where i have to finish my setup. Here i want to configure my “Data Directory” to a mounted folder - but get the error, that Nextcloud can’t create this folder or can’t write in this folder.

It’s mounted with fstab and rc.local:
/dev/sdb /var/nextcloud_data ext4 defaults 0 2
(i know i should use uuid, i will change later…)

The folder permissions are like above, when mounted:

root@ubuntu:/var# ls -la /var/nextcloud_data/
total 24
drwxr-xr-x 3 www-data www-data 4096 Jul 22 12:40 .
drwxr-xr-x 15 root root 4096 Jul 22 08:05 …
drwxr-xr-x 2 www-data www-data 16384 Jul 3 07:28 lost+found

When unmounted, the permissions are:

root@xxx:/var# ls -la /var/nextcloud_data/
total 8
drwxr-xr-x 2 www-data www-data 4096 Jul 22 07:50 .
drwxr-xr-x 15 root root 4096 Jul 22 08:05 …

Anyone an Idea?

Please post the error message.


Das Datenverzeichnis /var/nextcloud_data kann nicht erstellt oder es kann darin nicht geschrieben werden.

Means: Can’t create or can’t write

If the command sudo chown -R www-data:www-data /var/nextcloud_data (nginx, don’t know the webuser for Apache) doesn’t help, then you can try this post:

What means the error.log of your web server?

Hmm, even if it’s working with 777 … i think i shouldn’t use this for a cloud directory …

apache error.log
[Tue Jul 23 14:08:02.874938 2019] [proxy_fcgi:error] [pid 6137:tid 140356695840512] [client] AH01071: Got error ‘Access to the script ‘/var/www/nextcloud/csrftoken’ has been denied (see security.limit_extensions)\n’

Set on 777 and even the same error … what’s wrong …

My first thought is, are you running SELinux or something similar to protect/safeguard the file system? If so, did you make the necessary rule exceptions?


No, i don’t use SELinux or similar.

May the problem is the permissions on /var ?

drwxr-xr-x 15 root root 4096 Jul 22 08:05 var/

or on the disk where the data folder is ?

root@de1lvapp098p:/etc# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 9 Jul 22 12:48 UUID -> …/…/sdb

configured the same as before … and it’s working now

Sorry for no better resolution