Cleaning up Magento 1.9 Disk Session Storage

When you choose to store Magento user sessions via file rather than DB, you may run into disk space consumption issues after a while. One resolution is to clean out older session files periodically.

The following commands have proven helpful.

Get the count of session files older than 5 days.

find /var/www/html/var/session/ -mtime +5 | wc -l

Delete session files older then 5 days.
find /var/www/html/var/session/ -mtime +5 -exec rm {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *