Fairly new with nextcloud but preview folder has huge size

Ive been recently given a nextcloud where I work and ive been having a few problems regarding disk usage.

Seems like theres a Preview folder that uses up all the space on the hard drive.

Can i just delete everything inside that folder or is there a procedure i have to do?

I have 0 idea how the file system works for it.


I think a good point to start is the adminstrator guide in which the preview function is explained. If you want to customize the preview generation please have a look on the Preview Generator app.

Deleting the content of the preview folder is only a short term solution unless you’re

  • disabling the preview generation in total
  • customize the configuration of the preview generation so that it fits your needs
  • make sure that enough disk space is available on your hard disk.

Hey, check this out regarding config this:

and this

And remember, after you change the config, you have to regenerate previews again. Here is a good explanation how:

Well as a temporary solution. Can i just delete whats inside the preview folder? Or can i like break something if i do?

It will not be “brocken”, but simply delete preview folder will not delete links in database, so that new preview will not be generated.

To “reset” the preview cache

  1. Stop Webserver (apache / nginx)
  2. Moved the appdata_instaceName/preview folder outside the appdata folder. You can just remove it if you are confident.
  3. Run sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files:scan-app-data to fix database
  4. Start Webserver and Test everything works
  5. Finish up (delete moved folder, etc).

We dont really use the webpage function of nextcloud, we just sync it with the computers. But ill give what you said a try!

1 Like

Then you could disable previews in config.php afterwards:

'enable_previews' => false,

Do i have to add this line or should it show up? Cause it doesnt for me.

You have to edit your config.php (usually under /var/www/nextcloud/config/config.php), if you have this parameter already there, change it to false, if not you have to added it, because default value is true or previews enabled.

After you edit your config you have to do some DB cleanup as described above.