Change data directory to fuse mounted s3fs (Wasabi bucket)

Nextcloud version (eg, 20.0.5): 22.1.1
Operating system and version (eg, Ubuntu 20.04): Debian 10
Apache or nginx version (eg, Apache 2.4.25): nginx 1.14.2
PHP version (eg, 7.4): 8.0

The issue you are facing:

Error Message:

Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.

when trying to set data directory to mounted s3fs partition. I have copied all files (including the .ocdata file) over to the mounted partition and the mountpoint as well as all the files in the s3fs partition are owned by www-data. I have tried using a symlink and reinstalling Nextcloud and setting the s3fs partition as the data directory. Both ways result in the same error (so I guess it is not a symlink related issue).

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. mount Wasabi s3fs partition owned by user www-data. /etc/fstab entry:
    s3fs#mybucket mountpoint fuse allow_other,_netdev,uid=33,gid=33,umask=007,use_path_request_style,url=https://s3.eu-central-1.wasabisys.com/ 0 0
  2. cp -a /var/www/nextcloud/data mountpoint
  3. sudo -u www-data php occ maintenance:mode --on
  4. mv /var/www/nextcloud/data data_backup
  5. sudo -u www-data ln -s mountpoint /var/www/nextcloud/data
  6. sudo -u www-data php occ maintenance:mode --off

The output of your Nextcloud log in Admin > Logging:

Not accessible

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocofw0hke00q',
  'passwordsalt' => '**********',
  'secret' => '**********',
  'trusted_domains' =>
  array (
    0 => 'example.com',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.1.1.2',
  'overwrite.cli.url' => 'https://example.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '**********',
  'installed' => true,
  'maintenance' => true,
);

The output of your Apache/nginx/system log in /var/log/nginx/access.log:

xxx.xxx.xxx.xxx - - [09/Sep/2021:11:14:15 +0000] "HEAD / HTTP/1.1" 301 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36"
xxx.xxx.xxx.xxx - - [09/Sep/2021:11:14:16 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36"
xxx.xxx.xxx.xx - - [09/Sep/2021:11:16:55 +0000] "GET /apps/files/?dir=/&fileid=6 HTTP/2.0" 503 2887 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"