cache/images: What happens if I delete contents?

Our server is filling up fast with cached images in the /cache/images directory.

Most of them seem to be related to imported emails (attached images) and seem to be duplicates of the same file (without the filetype extension in the filename) in the /uploads directory.
I deleted an example file from /cache/images and could still view that attachment via SuiteCRM (I assume because it’s still in the /upload folder). The file was not re-added to the /cache/images directory when downloading the attachment from SuiteCRM.

Also: When searching the file ID for these image files in the database I always find two occurences:

  1. table notes
    This is the normal place for attachments.

  2. table aod_indexevent
    We used to use AOD for global search, not anymore though. Does AOD create these duplicate files in cache/images?
    (We’re currently not using AOD anymore, so if /cache/images is AOD-related I’d like to clean it out)


Can the entire folder contents of /cache/images be deleted from time to time? Or are certain files unique and will be missed if deleted? I couldn’t find any up-to-date documentation on this for SuiteCRM.

thanks.

I don’t know the answer and I don’t think you’ll find any documentation on this… : - )

It seems to be related to attached images in Email Templates (Campaigns):

https://github.com/salesagility/SuiteCRM/search?utf8=✓&q="cache%2Fimages"&type=

Can’t you just try deleting it all? Are you in a VM that you can snapshot? Or can you clone your system and try it on the clone?

1 Like

Thanks for the link! That’s a nice little (very sophisticated) trick :slight_smile:

I could clone it, but no guarantee I’ll find all the places where these images might be used…

My suspicion is that most of the files here come from Lucene index (AOD). Certainly not all from email templates. We have only few email templates, and almost no images.

But it’s strange, I did a few more searches within the AOD area and I can’t seem to find any reference to an “images” directory.

Do your images look like the same image repeated very often (for example, every time an email is sent within a Campaign), or do they appear to be all different?

Maybe you can check this with a simple
ls -lS cache/images

to see them sorted by size and see if there are a lot of repeated sizes.

I’m back at this question again…

Does anybody know whether I can safely delete the contents of /cache/images/?
Does anybody know why there seem to be a huge amount of duplicates between /upload and /cache/images ?

Seems like a huge waste of space to me.

Maybe you can use this other neat trick described here:

https://pgorod.github.io/Audit-File-Accesses/

That is useful for many things, actually. For this case, it could help you track when exactly that directory is written to, and when it is read. You could even track a single file, try deleting it, and see if there are any subsequent read errors, or if it is recreated, etc.

1 Like