Problems with data dir on btrfs file system

Hi all,
i have a problem wich drives me nuts.

I want to have my data dir on a btrfs file system.
It’s mounted on /mnt/btrfs
I made a dir “/mnt/btrfs/nextcloud”, chowned it to www-data:www-data (same as my html-dir NC rns in) with 755 rights.

I still got the message, that nextcloud can not create or write to this folder during installation / configuration.

Any hints?

Thanks

Juergen

Is your /mnt/btrfs accessible too?

What OS and version are you running?
What is the output of these commands?

$ mount |grep btrfs
$ ls -ld /mnt/btrfs
$ ls -ld /mnt/btrfs/nextcloud
$ touch /mnt/btrfs/nextcloud/testfile
$ ls -l /mnt/btrfs/nextcloud/
$ getsebool

Hi,

@anon9582441

The folder /mnt/btrfs is owned by root:root and has 755 rights.
Changed it to 777. No effect.

@Steve

I’m running debian 9 an a HP microserver.
root@gen8:~# uname -a
Linux gen8 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u5 (2018-09-30) x86_64 GNU/Linux

Nginx worker process runs as www-data

root@gen8:~# ps axuf | grep nginx
root     40321  0.0  0.0  12780  1020 pts/0    S+   10:21   0:00  |                   \_ grep nginx
root     19733  0.0  0.0  90228  1136 ?        Ss   Okt25   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
www-data 19734  0.0  0.0  91340  6760 ?        S    Okt25   0:00  \_ nginx: worker process

root@gen8:/mnt/btrfs# mount |grep btrfs
/dev/sda on /mnt/btrfs type btrfs (rw,relatime,space_cache,subvolid=5,subvol=/)

root@gen8:/mnt/btrfs# ls -ld /mnt/btrfs
drwxrwxrwx 1 root root 52 Okt 25 21:09 /mnt/btrfs

root@gen8:/mnt/btrfs# ls -ld /mnt/btrfs/nextcloud
drwxr-xr-x 1 www-data www-data 8 Okt 25 21:27 /mnt/btrfs/nextcloud

root@gen8:/mnt/btrfs# touch /mnt/btrfs/nextcloud/testfile
root@gen8:/mnt/btrfs# ls -l /mnt/btrfs/nextcloud/
insgesamt 0
-rw-r--r-- 1 root root 0 Okt 26 10:16 testfile

root@gen8:/mnt/btrfs# getsebool
getsebool:  SELinux is disabled

Best regards

Juergen

Hi,
ok, no more answers till now.
But as i can see more users in the forum having trouble when the data folder is not in the default location (/var/www/nextcloud/data) i would assume that there is a kind of bug here.

I will try to investigate

Juergen

you certain the reason is the FS? can you try w/ another (eg ext4)?
keeping the datadir outside the webdir is definitely possible (and sensible) - maybe there is an installation-error of some kind (eg destdir exists and cannot be created)?
on my installation i keep the data in'datadirectory' => '/home/nc/data' (but i can’t remember if i started out with that or if i moved it later).
/home/nc/ is 755-owned by root, and inside that /data ist 750-owned by www-data:www-data.
(as an aside: if you decide to stick with btrfs it might make sense to use a more fine-grained structure of subvolumes inside the rootvol)
GOOD LUCK!

did you find a fix i am using the external storage as a workaround?

Instead of changing the data directory I simply mounted some btrfs subvolumes directly in the www directory.

 /var/www/domains/my.domain/htdocs/nextcloud/data
 /var/www/domains/my.domain/htdocs/nextcloud/data/__groupfolders/1
 /var/www/domains/my.domain/htdocs/nextcloud/data/__groupfolders/2
...
 /var/www/domains/my.domain/htdocs/nextcloud/data/appdata_xxxxxxx/preview (avoids backing up previews..)

It is very easy to make snapshots and keep backups with btrbk backup tool.