7

I want to make some space on disk and clean

What file & folders are safe to delete?

I found /media/import/ files are safe to delete

Deleting files and folder effect performance too?

Is it okay to delete '/www/media/catalog/product/cache'?

10

You can safely delete the files in the following folders:

  • /media/import
  • /var/report

Besides of that you can also remove old session files by using find /path/to/magento/var/session -name 'sess_*' -type f -mtime +7 -exec rm {} \;

Removing old session files can already have a performance impact.

For improving the performance of you Magento installation there is even more you can do than just deleting old and unnecessary files.

34 ways to speed up your Magento e-commerce website

7

While it's ok to remove /www/media/catalog/product/cache it's where Magento stores resized images and doing it on a live site will cause a slowdown while Magento recreates all those cached images so it doesn't have to recreate them 'on the fly' whenever it needs to serve them out.

It's better to expire out cached images older than X days as removing product doesn't remove images.

Command line to clear out any cached images older than 6 months:

find /path/to/magento/media/catalog/product/cache/* -type f -mtime +180 -exec rm -f {} \;

Another cleaning technique is to download the Image Clean module from Magento Connect. Magento doesn't remove gallery images when product is deleted so you can have a horrific amount of junk images left if you have a lot of items you sell with a short product selling lifetime.

Also, make sure you have cron jobs set up properly as part of your disk space can be eaten up in storage of log_ tables in the database and if the log cleaning isn't functioning, the database grows immensely.

  • I would add cleaning media/import folder and rm -rf /path/to/magento/var/import_history/*.csv – Gediminas Nov 2 '18 at 11:13
3

In addition to @mhauri's answer I'd like to add:

Check your var/log directory if the system.log or exception.log files are big. You should have a look at the issues in there before you empty the files.

  • Thanks for edit and answer! I'm curious beside var folder, especially on media folder. My 'media' folder currently 32 GB :( which make some problem to me. (Yeah I have upload many products images but hope I can reduce some like I found I can delete /media/import/) – Moon Feb 21 '15 at 17:01
  • This one really clear good amount of space. Thanks @anna – Jai Jan 24 '17 at 7:05
-1

Cache and Sessions accumulate. Sometimes so much they can't be deleted from "within" the folder. Deleting the whole folder works but new folders must be put back into place and critical to duplicate original ownership and permissions so check before deleting

from within /magento/var/ directory rm -rf session rm -rf cache

  • var/session rm is a very BAD idea. You lose all customers Shopping Cart immediately. Also all customers will be logged-out. And admin users too. NEVER rm var/session/dir, ever. – Andriy Gonchar Feb 28 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.