OwnCloud server can't load external storage folder content

Steps to reproduce

I have a hard drive on my server mounted on /mnt/data/ that I need to use as the ownCloud server storage space.

(I’ve been considering (and tried) to use a symlink from /var/www/owncloud/data/user/files/symlink to /mnt/data/ but it doesn’t work.)

I have added 'files_external_allow_create_new_local' => 'true', to ownCloud config file config.php , so I now successfully can add a local storage with ownCloud web UI. I have changed permissions of /mnt/data/ so that everything is now recursively owned by www-data , the Debian HTTP user used by ownCloud.

Expected behaviour

Have the files stored on the hard drive appear in the ownCloud web UI browser.

Actual behaviour

Under the “storage” section of ownCloud web UI admin settings, I can add a folder configured to be /mnt/data/ (it shows a green circle), it will then appear on the user’s web UI but saying there are no files in it, wether there are and I rescan using ownCloud php occ files:scan --all command.

Also, when I add a subfolder configured to be the existing subfolder on external disk /mnt/data/subfolder , it doesn’t add it, showing a red square in the settings in web UI as an error. It also shows " Some of the configured external mount points are not connected. Please click on the red row(s) for more information " on top of ownCloud web UI.

Server configuration

Operating system: Debian 10

Web server: Apache 2.4.38

Database: MariaDB 10.3

PHP version: 7.3

ownCloud version: 10.4

Updated from an older ownCloud or fresh install: fresh install

Where did you install ownCloud from: wget

Signing status (ownCloud 9.0 and above):

No errors have been found.

The content of config/config.php:

$CONFIG = array (
‘updatechecker’ => false,
‘instanceid’ => ‘XXX’,
‘secret’ => ‘XXX’,
‘trusted_domains’ =>
array (
0 => ‘XXX’,
),
‘datadirectory’ => ‘/var/www/owncloud/data’,
‘overwrite.cli.url’ => ‘http://XXX/owncloud’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘10.4.1.3’,
‘dbname’ => ‘owncloud’,
‘dbhost’ => ‘127.0.0.1’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘owncloud’,
‘dbpassword’ => ‘XXX’,
‘logtimezone’ => ‘UTC’,
‘apps_paths’ =>
array (
0 =>
array (
‘path’ => ‘/var/www/owncloud/apps’,
‘url’ => ‘/apps’,
‘writable’ => false,
),
1 =>
array (
‘path’ => ‘/var/www/owncloud/apps-external’,
‘url’ => ‘/apps-external’,
‘writable’ => true,
),
),
‘installed’ => true,
‘mail_domain’ => ‘XXX’,
‘mail_from_address’ => ‘XXX’,
‘mail_smtpmode’ => ‘smtp’,
‘mail_smtpsecure’ => ‘ssl’,
‘mail_smtphost’ => ‘XXX’,
‘mail_smtpport’ => ‘587’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘files_external_allow_create_new_local’ => ‘true’,
);

List of activated apps:

Enabled:
  - comments: 0.3.0
  - configreport: 0.2.0
  - dav: 0.5.0
  - federatedfilesharing: 0.5.0
  - federation: 0.1.0
  - files: 1.5.2
  - files_external: 0.7.1
  - files_mediaviewer: 1.0.2
  - files_sharing: 0.12.0
  - files_trashbin: 0.9.1
  - files_versions: 1.3.0
  - firstrunwizard: 1.2.0
  - market: 0.5.0
  - notifications: 0.5.0
  - provisioning_api: 0.5.0
  - systemtags: 0.3.0
  - updatenotification: 0.2.1
Disabled:
  - encryption
  - external
  - user_external

Are you using external storage, if yes which one: /mnt/data/

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

ownCloud log (data/owncloud.log)

{"reqId":"Xs1KuGj7dKk8CJX9BUYHvQAAAAU","level":3,"time":"2020-05-26T16:58:32+00:00","remoteAddr":"XXX","user":"XXX","app":"PHP","method":"GET","url":"\/owncloud\/index.php\/apps\/files_external\/userglobalstorages\/2?testOnly=false","message":"stat(): stat failed for \/mnt\/data\/subfolder\/ at \/var\/www\/owncloud\/lib\/private\/Files\/Storage\/Local.php#135"}
{"reqId":"Xs3Ezk11SNrNX-hE214s2QAAAAU","level":3,"time":"2020-05-27T01:39:26+00:00","remoteAddr":"XXX","user":"XXX","app":"PHP","method":"GET","url":"\/owncloud\/index.php\/apps\/files_external\/userglobalstorages\/2?testOnly=false","message":"stat(): stat failed for \/mnt\/data\/subfolder\/ at \/var\/www\/owncloud\/lib\/private\/Files\/Storage\/Local.php#135"}
{"reqId":"Xs3E2yULs4GyYBXseygU@QAAAAg","level":3,"time":"2020-05-27T01:39:39+00:00","remoteAddr":"XXX","user":"XXX","app":"PHP","method":"GET","url":"\/owncloud\/index.php\/apps\/files_external\/globalstorages\/2?testOnly=true","message":"stat(): stat failed for \/mnt\/data\/subfolder\/ at \/var\/www\/owncloud\/lib\/private\/Files\/Storage\/Local.php#135"}
{"reqId":"Xs3E39C7EPKUjlFH7kFYpwAAAAc","level":3,"time":"2020-05-27T01:39:43+00:00","remoteAddr":"XXX","user":"XXX","app":"PHP","method":"GET","url":"\/owncloud\/index.php\/apps\/files_external\/globalstorages\/2?testOnly=true","message":"stat(): stat failed for \/mnt\/data\/subfolder\/ at \/var\/www\/owncloud\/lib\/private\/Files\/Storage\/Local.php#135"}
{"reqId":"Xs3E8gJrlt2LKJk3wdzBzQAAAAA","level":3,"time":"2020-05-27T01:40:02+00:00","remoteAddr":"XXX","user":"XXX","app":"PHP","method":"POST","url":"\/owncloud\/index.php\/apps\/files_external\/globalstorages","message":"stat(): stat failed for \/mnt\/data\/subfolder\/ at \/var\/www\/owncloud\/lib\/private\/Files\/Storage\/Local.php#135"}

Hey,

it seems to me that a quite similar message (including the “red square”) was discussed only a few months ago in:

Thank you. I indeed think it’s a permission option as well, but can’t understand it. The external mount point and its content is rightly owned by www-data.

Solved it, it was indeed just a Linux permissions issue. In my case, www-data owning the external drive content wasn’t sufficient, I needed to change the permissions rules to 755: chmod -R 755 /mnt/data

1 Like