Folder on external storage hidden in Nextcloud

Nextcloud version (eg, 20.0.5): 20.0.14
Operating system and version (eg, Ubuntu 20.04): Debain 9
Apache or nginx version (eg, Apache 2.4.25): Nginx
PHP version (eg, 7.4): 7.3

The issue you are facing:
One folder that is on external storage (loca mount) is on the drive but hidden in Nextcloud.

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

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

<?php
$CONFIG = array (
  'passwordsalt' => '++++',
  'secret' => '++++',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '++++',
    2 => '++++',
  ),
  'datadirectory' => '/usr/local/nextclouddata',
  'overwrite.cli.url' => 'https://++++',
  'dbtype' => 'mysql',
  'version' => '20.0.14.2',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '++++',
  'dbpassword' => '++++',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'open_basedir' => '/dev/urandom',
  'instanceid' => '++++',
  'trusted_proxies' =>
  array (
    0 => '++++',
  ),
  'overwritehost' => '++++',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => '++++',
  'mail_domain' => '++++',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '++++',
  'mail_smtpport' => '25',
  'mail_smtpname' => '++++',
  'mail_smtppassword' => '++++',
  'mail_smtpsecure' => 'tls',
  'maintenance' => false,
  'loglevel' => 0,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'mysql.utf8mb4' => true,
  'skeletondirectory' => '/usr/local/nextclouddata/skeleton',
  'default_language' => 'nl',
  'user_backends' =>
  array (
    0 =>
    array (
      'class' => 'OC_User_ISPCONFIG',
      'arguments' =>
      array (
        0 => 'https://++++',
        1 => 'https://++++',
        2 => '++++',
        3 => '++++',
      ),
    ),
  ),
  'mail_sendmailmode' => 'smtp',
  'session_lifetime' => 900,
  'session_keepalive' => false,
  'remember_login_cookie_lifetime' => 900,
  'encryption.legacy_format_support' => true,
  'encryption.key_storage_migrated' => false,
);

Please post information to the settings of your local storage see e.g. screenshot Local. Also post information of the directory and the user rights e.g.

ls -la /path/to/the/local/top
ls -la /path/to/the/local/top/subdir-which-works
ls -la /path/to/the/local/top/subdir-which-not-works

Sometimes there are also problems with special characters in the name. Please also post them.

I have to hide the file- and foldernames because they could show personal data from people. But I’m pretty sure the rights are ok (770 for all with user www-data):

ls -la /home/ncdatauser/data/ (top)
total 19670880
drwxrwx--- 1 www-data   www-data   10071459524 Mar 21 11:51  .
drwxr-xr-x 4 ncdatauser ncdatauser        4096 Nov  4  2020  ..
drwxrwx--- 1 www-data   www-data    1018851744 Jan 29  2021 '0
drwxrwx--- 1 www-data   www-data      70329688 Dec  6 14:33 '1
drwxrwx--- 1 www-data   www-data      42847828 Mar 10 13:36 '1
drwxrwx--- 1 www-data   www-data     176931756 Apr  1 11:21 '2
drwxrwx--- 1 www-data   www-data    1730782560 Apr  1 11:20 '2
drwxrwx--- 1 www-data   www-data     360167332 Oct 20 14:49 '3
drwxrwx--- 1 www-data   www-data     113939480 Feb  3 22:18 '3
drwxrwx--- 1 www-data   www-data         35564 Dec 22  2020 '4
drwxrwx--- 1 www-data   www-data       1539092 Dec 30  2020 '5
drwxrwx--- 1 www-data   www-data    1033297576 Apr  4 14:28  B
drwxrwx--- 1 www-data   www-data       5295224 Apr  8 15:40  C
drwxrwx--- 1 www-data   www-data          8296 Sep 10  2020  C
drwxrwx--- 1 www-data   www-data     458625740 Feb  6 15:08 'C
drwxrwx--- 1 www-data   www-data     894861524 Mar 10  2021 'C
drwxrwx--- 1 www-data   www-data     207789200 Jan 14  2021 'F
drwxrwx--- 1 www-data   www-data     224222548 Dec 16 10:26  H
drwxrwx--- 1 www-data   www-data      23891768 Apr 13 13:08  I
drwxrwx--- 1 www-data   www-data      80401056 Dec  9 13:24  K
drwxrwx--- 1 www-data   www-data       5391592 Jan 25 09:24  K
drwxrwx--- 1 www-data   www-data         61240 Apr 11 10:44 'M
drwxrwx--- 1 www-data   www-data     843498156 Jul 28  2021  M
drwxrwx--- 1 www-data   www-data         67396 Mar 21 14:36  N
drwxrwx--- 1 www-data   www-data    2159295692 Mar 14 12:23  O
drwxrwx--- 1 www-data   www-data     124800972 Feb  7 22:17 'R
drwxrwx--- 1 www-data   www-data             0 Jan 27  2020 'T
drwxrwx--- 1 www-data   www-data     130152988 Feb 16  2021 'T
drwxrwx--- 1 www-data   www-data             0 May  5  2021 'T
drwxrwx--- 1 www-data   www-data             0 Oct 28  2020 'T
drwxrwx--- 1 www-data   www-data             0 Oct 28  2020 'T
drwxrwx--- 1 www-data   www-data     364365216 Jan 27  2020  T
drwxrwx--- 1 www-data   www-data             0 Jan 27  2020 'T
drwxrwx--- 1 www-data   www-data          8296 Jun 25  2021  T
ls -la /home/ncdatauser/data/1stSUBDIR/2ndSUBDIR/ (dir with hidden subdir)
total 1701832
drwxrwx--- 1 www-data www-data    5938620 Feb 24  2021  .
drwxrwx--- 1 www-data www-data 1730782560 Apr  1 11:20  ..
-rwxrwx--- 1 www-data www-data     215608 Feb 23  2021 'B
-rwxrwx--- 1 www-data www-data    1406552 Feb 23  2021 'G
drwxrwx--- 1 www-data www-data    3901012 Mar 18  2021  K <- This one is not visible in Nextcloud
-rwxrwx--- 1 www-data www-data     271164 Feb 23  2021 'S
-rwxrwx--- 1 www-data www-data     144284 Feb 25  2021 'V
ls -la /home/ncdatauser/data/1stSUBDIR/2ndSUBDIR/3rdSUBDIR/ (inside this hidden dir)
total 13436
drwxrwx--- 1 www-data www-data 3901012 Mar 18  2021  .
drwxrwx--- 1 www-data www-data 5938620 Feb 24  2021  ..
-rwxrwx--- 1 www-data www-data  387116 Mar 11  2021 'A
-rwxrwx--- 1 www-data www-data  126880 Feb 23  2021 'A
-rwxrwx--- 1 www-data www-data   86976 Feb 23  2021 'A
-rwxrwx--- 1 www-data www-data  352192 Feb 23  2021 'C
-rwxrwx--- 1 www-data www-data  353656 Mar  2  2021 'C
-rwxrwx--- 1 www-data www-data  744568 Feb 23  2021 'C
-rwxrwx--- 1 www-data www-data  155328 Feb 23  2021 'C
-rwxrwx--- 1 www-data www-data  337480 Feb 23  2021 'C
-rwxrwx--- 1 www-data www-data  976124 Feb 23  2021 'C
-rwxrwx--- 1 www-data www-data  380692 Mar 11  2021 'S

Of coarse the files in the hidden dir are also not available in Nextcloud.

In the oc_filecache of the database I saw the directory that is missing from Nextcloud is not there:

MariaDB [nextcloud]> select fileid,storage,permissions from oc_filecache where path like '1stSUBDIR/2ndSUBDIR/3rdSUBDIR/';
+--------+---------+-------------+
| fileid | storage | permissions |
+--------+---------+-------------+
| 468923 |       2 |          31 |
| 469123 |       1 |          31 |
+--------+---------+-------------+

For a directory that is available it shows:

MariaDB [nextcloud]> select fileid,storage,permissions from oc_filecache where path like '1stSUBDIR/2ndSUBDIR/3rdSUBDIR/';
+--------+---------+-------------+
| fileid | storage | permissions |
+--------+---------+-------------+
| 469095 |      74 |          31 |
| 469100 |       2 |          31 |
| 469350 |       1 |          31 |
+--------+---------+-------------+

Storage 74 is the external storage.
Storage 2 is files_encryption.
Storage 1 is files_versions.

BTW All files are encrypted on the external storage.

Thank you for the data. But i have no real idea. On my system the rights are 755 (rwxr-xr-x) and not 770 (rwxrwx—). But i think that is not the problem.

Do you use special names?

Also you can perhaps rescan the directory structure.

sudo -u www-data php /path/to/nextcloud/occ files:scan --all

Also you use an old Debian version (9) and an old Nextcloud version (20). Perhaps you can upgrade both and solve the problem.

Perhaps the encryption is the problem. Unfortunately I can not help.

Thanks for trying to help devnull! I have upgraded Debian to Buster (10) and Nextcloud to 21.0.9, but the directory still does not show.

I think the files:scan command might work, but I tried it once on another system finding that all shares were gone. As there are a lot of shares in this system with several teams working with the data I don’t want to risk loosing all this info. Do you know if it is possible to use this command without loosing the shares? Or can one restore them after running the command?

I don’t know if there is a risk of losing the shares. But basically you should know about backup and restore. Test this e.g. on a test system. Sometime you might have real problems.

Both are not the current releases. You can upgrade to Debian 11 and Nextcloud 22/23.

I updated to the latest versions and it made a mess of my installation. Encrypted files didn’t open anymore (not decrypting), so at least I restored everything with a snapshot.

But, after that restore the hidden folder was visible with all the files in it. Very strange…
Only thing was they where not decrypting and thus unreadable. This was resolved by changing the value of the encrypted field in the oc_filecache table from 0 to +1.

So, at the end the files are there again, but it was not resolved the easy way (it’s even not sure what resolved it, which gives a annoying feeling because I’m a bit scared to do the updates again now).