If, like me, you find yourself in a monthly battle trying to reclaim 1-2GB of disk space on smaller systems, this might help. Some of our PBXs get a little too close for comfort, and I stumbled across this recently:
Clear the FreePBX Module Cache
A FreePBX 16 system that had been updated regularly since 2019 contained 998 cached packages occupying 2.7GB of disk space. Clearing the cache immediately recovered the full 2.7GB without affecting the installed modules.
FreePBX caches downloaded module packages in:
/var/www/html/admin/modules/_cache
On systems that have been updated for several years, this directory can grow to several gigabytes because every downloaded module package is retained. If the directory is already small, there is nothing worth cleaning up.
This cache only contains downloaded module packages. Removing it does not uninstall any modules or affect your configuration. FreePBX will automatically download packages again if they are needed for future updates or reinstalls.
Check the cache size
du -sh /var/www/html/admin/modules/_cache
Count cached packages
ls -1 /var/www/html/admin/modules/_cache | wc -l
Clear the cache
rm -f /var/www/html/admin/modules/_cache/*
Verify the result
du -sh /var/www/html/admin/modules/_cache
df -h /