Shares removed after not using local external storage for a few minutes

Nextcloud version (eg, 12.0.2): 18.0
Operating system and version (eg, Ubuntu 17.04): CentOS 8
Apache or nginx version (eg, Apache 2.4.25): nginx 1.14.1
PHP version (eg, 7.1): 7.2.11

The issue you are facing: Local external storage always “unmounts” and deletes all share links

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

Steps to replicate it:

  1. Add local external storage
  2. Acces the storage and create a share link
  3. Don’t touch Nextcloud for a few minutes
  4. Open the link or check shared links section
  5. See 404/empty list of shares

Problem with external storages that is after they are not accessed for a small while, it seems that they are unmounted somehow and Nextcloud forgets everything. Folders you access have to be rescanned. With a larger folder, you need to refresh the page, because the files are apparently not loaded in time and Nextcloud show “no files” message. That happens every time after you’re not using the storage.
Bigger problem is that every time this happens, Nextcloud drops shares and the links show 404’s (no URL rewriting). The shared links section, where you could see the links after you create them, is emptied. The external folder are located on an HDD (XFS).

sorry, there’s nothing in the logs at the time this thing happens

config.php

{
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "localhost",
        "192.168.0.100",
        "xxx"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "18.0.0.10",
    "overwrite.cli.url": "xxx",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "memcache.local": "\\OC\\Memcache\\APCu",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 6379
    },
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "twofactor_enforced": "true",
    "twofactor_enforced_groups": [
        "admin",
        "xxx"
    ],
    "twofactor_enforced_excluded_groups": [],
    "mail_smtpmode": "sendmail",
    "mail_sendmailmode": "pipe",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "app_install_overwrite": [
        "printer",
        "files_snapshots"
    ],
    "preview_max_x": 800,
    "preview_max_y": 800,
    "preview_max_scale_factor": 2
}

It actually seems to be caused by cron. Tried disabling cron entirely for now and that “fixes” the problem. I’m not sure what cron is supposed to be useful for, when documentation says that it scans folders. For me it has opposite effect.

I would still like to know how to fix the cron and what is the cause of this issue.