I'm using Magento 2.4 and my installation is using 200GB, I'd like to reduce it.
I want to remove old logs, backups, caches, duplicated images and etc.
How could I optimize it?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityAll the ones you mention are worth being looked at. I may have some more for you to take a look:
in pub folder, it is useful to remove files that are not meant to be there and pub is often misused.
this command will list these big files for you (this command assumes you are in a terminal at the pub folder of your magento site)
find . -type f -size +5M
Find the images for which products have been deleted. There are scripts out there performing query for doing this search but I have not used any since Magento 2 came
find images that are quite big and may not be needed:
find . -name "*png" -type f -size +2M
find . -name "*jpg" -type f -size +2M
files that may have been created during development. I doubt it is your case but possibly worth a try:
find . -name "*sql" -type f
find . -name "*zip" -type f
find . -name "*gz" -type f
although it is less common, this same practice can apply to vendor folder and app folder. As you know, these folders do contain the modules for your site. I have come across modules creating export files and these could amount to large amount of space. The command below would list the possible files
find . -name "*csv" -type f