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.

Thanks!

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
    or
  • customize the configuration of the preview generation so that it fits your needs
    or
  • make sure that enough disk space is available on your hard disk.

Hey, check this out regarding config this:
https://ownyourbits.com/2019/06/29/understanding-and-improving-nextcloud-previews/

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).
1 Like

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.

@gas85
Thanks for the solution

But how can i do the rescan WITHOUT occ access (no bash or ssh) on a shared hosted system ?
That is a very big problem with nextcloud (also running the index updates is not possible).

i disabled previewing in the config (months ago), but the folder contains still 12 GB (GIGAbyte !!!) files. why isn’t nextcloud automatically (and f.eg. successive) rescanning and cleaning those files ? can those files & folders within “/cloud/data/appdata_xyz12345678/preview” simply be deleted without loosing data ?

Check Web OCC App: https://apps.nextcloud.com/apps/occweb But this is not working with NC 19+ :frowning:

It is not cleaned automatically, you have to reclaim space:

Check Web OCC App

As you already noted: Not available for V19+ (and i am using V20 currently)

It is not cleaned automatically, you have to reclaim space

Yes. I recognized. But that would be an interesting question for the nc developers, WHY those settings are not checked by interval or cannot be triggered manually from the normal admin/user backend.

Run sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files:scan-app-data to fix database

Simply not possible, because there is still no SSH or bash access.

That is simply bad developed, when space is filled up automatically - but for cleaning it you need manual action and special privileges. 12 GB is a lot of space for useless data … i think i have to replace nextcloud by another software.

I would not blame nextcloud. If you will delete all pictures, previews will be also deleted, it is only some issue with defaults.
Try to install webmin, this allows you to have ssh even in web.

In addition to what already have been said, you could also limit the size of the previews, which should safe you a a significant amount of space.

https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/previews_configuration.html