Previews are getting deleted automatically over night

Hi folks,

I’ve all my photos linked as external (local) storage into my nextcloud instance. For browsing them smoothly, I’m also using the preview generator app.

For some reasons, some previews are getting deleted over night and i was not able to figure out the cause for that deletion right now.

So my use case looks like followed:

  • added a new photo folder in the external storage
  • performed occ files:scan for the new folder
  • performed occ preview:generate-all for that new folder

After that, all previews are available and browsable in the file systems preview folder.

When performing the occ preview:generate-all on the next day, some previews are created from scratch. And the reason is, that the previews have been deleted from the preview folder and also from the filecache table. I’ve inspected that behaviour some days and it is reproducable every day for the same images.

I’ve also tried to “reimport” the folder, by renaming, occ files:scan and occ preview:generate-all, but it didn’t fixed the problem. I can reproduce that behaviour for some other images now.

My nextcloud is based on the official docker image with nextcloud version 24.0.1. Database is MariaDB, also based on the official docker image and up to date.

I’ve also inspected the database and was not able to see any cause there. The affected images are entered into filecache table and after preview generationg, the previews are entered into file cache, too.

Any ideas, what can cause the nightly deletion of some (and allways the same previews)?

Kind regards Jonas


i’ve created a script, to check, when the previews are beeing deleted. Last night it happened about 23:31 German Time.

I think it’s related to some cleanup task, which is started within cron.php.

I recreated the previews now, to check if they go away to the same time next night.

Any ideas, which task might delete the previews? And the more exiting question: Why???
I assume that something will not be entered correctly into the database, but i didn’T figured it out right now.

Are there any ways to get some debug output/logs from cron.php?

Kind regards

and they went away at 07:51 today again. It’s realy weird :thinking:


I didn’t managed to find the root cause for that until now. But I still assume that it must be located in the oc_file_cache table.

I allready did some cloud tuning, as i found out that my DB was quite slow while doing querys on the filecache. I moved my DB from a Docker container inside a VM into a linux container directly on the host, which speed up the slow query up to 10 times faster.
I also installed redis (specially for file locking), as I had a problem with the file locking. Redis solved this problem.

But my initial problem still exists :frowning:

For now I have a workaround…

  • moving the affected files into a folder outside the cloud
  • occ files:scan
  • moving the files back
  • occ files:scan again
  • generating the previews again

But this is a realy stupid workaround. No one else here with a same issue?