How to Free up Disk Space in Magento 1.9.x
How to Free Up Disk Space in Magento 1.9.x: Complete Cleanup Guide
Is your Magento 1.9.x website running out of disk space? Large cache directories, accumulated logs, outdated session files, old backups, and generated product image files can gradually consume server storage.
When available disk space becomes critically low, your Magento store may encounter operational problems, including failed file uploads, interrupted backups, session issues, and database write errors.
In this guide, ObeySoft explains how to free up disk space in Magento 1.9.x safely, identify large directories, clean unnecessary files, and maintain your Magento store without accidentally deleting important business data.
Quick Answer: To free up disk space in Magento 1.9.x, identify the largest directories using SSH or your hosting file manager, back up important files and the database, clear Magento’s application cache, remove confirmed expired session files, rotate unnecessary logs, review generated image caches, and enable automatic database log cleaning.
Important: Magento 1 reached its official end of support in June 2020. These cleanup instructions are intended for maintaining legacy installations, not as a substitute for security updates or migration.
Why Does Magento 1.9.x Consume So Much Disk Space?
Magento uses various directories and database tables to store temporary files, operational information, and eCommerce data.
Over time, some files may grow significantly.
Common causes include:
- Large application cache directories
- Accumulated PHP session files
- Old system and exception logs
- Cached product image variations
- Outdated database visitor logs
- Old website backups
- Temporary export and import files
- Inactive extensions generating excessive logs
Before removing files, you should determine which locations actually consume the most storage.
Step 1: Check Magento Server Disk Usage
The safest starting point is identifying where disk space is being used.
Connect to your hosting server using SSH.
Run:
df -h
This command displays filesystem capacity, used space, and available space.
Next, navigate to your Magento 1.9 root directory and run:
du -sh var media app skin 2>/dev/null
This shows the approximate disk space occupied by these directories.
To inspect individual folders inside var:
du -h --max-depth=1 var | sort -h
If the server uses a different version of du, use compatible options supported by that system.
SEO and performance tip: Disk space cleanup is a maintenance activity. It does not directly improve Google rankings, but resolving storage-related failures can help maintain website availability and reliability.
Step 2: Back Up Your Magento Website Before Cleanup
Before deleting files, create a verified backup of your Magento database and important website files.
Your backup should cover:
- Magento database
- Product and category media
- Custom themes
- Custom extensions
- Configuration files
- Business-critical import and export files
Ideally, store the backup outside the affected filesystem so it does not consume the remaining disk space.
Do not proceed with destructive commands unless you have verified the target directories and confirmed a recovery method.
Step 3: Clear Magento 1.9 Cache Files
Magento 1.9 stores filesystem-based application cache files in:
var/cache/
These files can accumulate and occupy disk space.
Method 1: Clear Cache Using Magento Admin
Log in to your Magento administrator dashboard.
Navigate to:
System → Cache Management
Use the available cache management options to refresh or flush the appropriate Magento cache.
Be careful with Flush Cache Storage, especially if your store uses a shared caching backend.
Method 2: Clear Filesystem Cache Through SSH
If your Magento installation uses the standard filesystem cache backend, inspect the directory first:
du -sh var/cache
Then, during a maintenance window, remove confirmed disposable cache contents using your hosting file manager or approved server maintenance procedure.
Always preserve the directory itself and any required permissions.
Note: If your installation uses Redis, Memcached, or another custom cache backend, clearing var/cache may not clear the active cache.
Step 4: Clean Expired Magento Session Files
Magento installations configured for file-based sessions commonly store session data in:
var/session/
Large stores may accumulate thousands of session files.
Check session storage size:
du -sh var/session
You can inspect older files using:
find var/session -type f -name 'sess_*' -mtime +7 -print
This command lists matching files older than seven days based on file modification time. It does not delete them.
Important: File age alone does not prove that a session has expired. Confirm your session lifetime settings, session storage backend, and operational requirements before removing files.
Deleting active sessions may log customers out or interrupt their shopping sessions.
For high-traffic stores, carry out session cleanup during a low-traffic maintenance window.
Step 5: Review Magento System and Exception Logs
Magento 1.9 commonly uses the following log files:
var/log/system.log
var/log/exception.log
These logs can become large when an extension, theme, or server issue repeatedly generates errors.
Check log sizes:
du -sh var/log
List log files:
ls -lh var/log/
Review recent errors:
tail -n 100 var/log/exception.log
If a log is growing continuously, investigate the underlying error rather than repeatedly deleting its output.
Configure a suitable server-side log rotation policy to compress and remove logs according to your retention requirements.
Keep important diagnostic logs until relevant issues are resolved.
Step 6: Manage Magento Product Image Cache
Magento 1.9 generates resized product images for catalog pages and product displays.
The standard generated image cache location is:
media/catalog/product/cache/
Depending on the size of your catalog, this directory may consume substantial storage.
Check its size:
du -sh media/catalog/product/cache
Magento 1.9 provides an admin function to clear generated product image caches.
Navigate to:
System → Cache Management → Flush Catalog Images Cache
Magento can regenerate image variations when they are requested, provided that the original images and required image-processing components are functioning correctly.
Critical warning: Never confuse the generated image cache with the original product image directory.
Do not delete:
media/catalog/product/
as a whole. It contains your original catalog images as well as generated cache files.
Clearing a large generated image cache may temporarily increase server load and slow image delivery while the store rebuilds the images.
Step 7: Enable Automatic Magento Database Log Cleaning
Magento 1.9 can accumulate visitor tracking and reporting data in database log tables.
These tables can increase database size over time.
Magento 1.x provides an automatic log-cleaning option.
Enable Log Cleaning
- Log in to Magento Admin.
- Open System → Configuration.
- Expand Advanced.
- Select System.
- Find Log Cleaning.
- Set Enable Log Cleaning to Yes.
- Choose an appropriate log retention period.
- Save the configuration.
Ensure Magento cron jobs are running correctly, since scheduled cleanup depends on them.
A retention period such as 15 or 30 days may be a starting point, but choose it according to your reporting, auditing, and business requirements.
Do not manually truncate Magento database tables without a verified backup and a clear understanding of the table dependencies.
Step 8: Remove Unnecessary Backups and Temporary Files
Old backup archives can consume significant disk space.
Review common backup and temporary storage locations, including:
var/backups/
var/export/
var/import/
Actual paths vary by installation and extension.
Inspect the size of these directories:
du -sh var/backups var/export var/import 2>/dev/null
Delete files only after confirming that they are no longer required and that appropriate copies exist elsewhere.
Retain backups needed for disaster recovery, tax records, reconciliation, and historical business operations.
Never remove active import files or backups that have not been verified.
Step 9: Check Database Storage Consumption
Magento databases may become large due to accumulated logs, reporting data, catalog information, and third-party extensions.
Use your hosting database management tool or phpMyAdmin to inspect table sizes.
A useful read-only SQL query is:
SELECT
table_name,
ROUND((data_length + index_length) / 1024 / 1024, 2)
AS size_mb
FROM information_schema.tables
WHERE table_schema = DATABASE()
ORDER BY (data_length + index_length) DESC
LIMIT 20;
This displays the largest tables in the currently selected database.
Review the results before performing any cleanup.
Removing data from database tables may not immediately reduce the physical disk usage reported by your hosting provider.
Database optimization and space reclamation depend on the MySQL storage engine and server configuration, and may require additional temporary disk space.
Step 10: Prevent Magento Disk Space Problems
A one-time cleanup will not solve the problem permanently if your store continues generating large unnecessary files.
Follow these preventive maintenance practices:
- Monitor server disk usage regularly.
- Use an appropriate backup retention policy.
- Enable Magento database log cleaning.
- Configure server log rotation.
- Review persistent application errors.
- Monitor session growth.
- Avoid unnecessary image cache regeneration.
- Review old exports and temporary files.
- Maintain sufficient free storage for database and application operations.
- Investigate unexpected disk growth before performing destructive cleanup.
Magento 1.9 Disk Cleanup Checklist
| Directory or Component | Recommended Action | Risk |
|---|---|---|
var/cache/ |
Clear verified disposable cache | Low to moderate |
var/session/ |
Remove confirmed expired sessions | Moderate |
var/log/ |
Rotate and archive unnecessary logs | Moderate |
media/catalog/product/cache/ |
Flush generated image cache | Moderate |
var/backups/ |
Remove verified obsolete backups | High |
var/export/ |
Review and remove old export files | Moderate |
| Database logs | Use Magento scheduled log cleaning | Moderate |
| Original product media | Preserve original files | Critical |
The appropriate cleanup depends on how your Magento installation is configured.
Common Magento Disk Space Problems
Magento Shows “No Space Left on Device”
This error generally indicates that the application or server cannot write additional data to a filesystem.
Start with:
df -h
Then identify large directories and confirm whether the problem involves disk capacity, inodes, quotas, or a separate storage mount.
Magento Product Images Stop Loading
Check file permissions, original image availability, media paths, server errors, and image cache generation.
Do not delete the complete product media directory.
Magento Logs Keep Growing
Repeated errors may indicate broken extensions, PHP compatibility problems, cron failures, or server configuration issues.
Review the errors and resolve their causes.
Magento Database Becomes Too Large
Check visitor logs and reporting tables using read-only queries, and configure scheduled cleanup where suitable.
Database backups and professional review are recommended before modifying production data.
Does Cleaning Magento Disk Space Improve SEO?
Disk cleanup does not directly guarantee better search rankings.
However, sufficient storage can help prevent website errors that negatively affect visitors and search-engine crawlers.
A stable website supports:
- Reliable page availability
- Successful product image loading
- Consistent checkout operation
- Scheduled sitemap generation
- Functional server-side processes
- A more dependable shopping experience
For SEO, AEO, and GEO readiness, combine technical maintenance with useful content, structured product information, crawlable pages, and consistent site architecture.
Frequently Asked Questions
How do I free up disk space in Magento 1.9?
Check server storage, identify large directories, back up your website, clear unnecessary cache files, remove expired sessions, rotate old logs, review generated image caches, and enable automatic database log cleaning.
Can I delete Magento’s var/cache folder?
Filesystem cache contents are generally disposable, but you should use Magento’s cache management tools or a verified maintenance procedure. Confirm the configured cache backend before deleting anything manually.
Is it safe to delete Magento var/session files?
Deleting active session files can log users out or interrupt shopping activity. Remove only sessions confirmed to be expired according to your store configuration.
Can I delete Magento product image cache?
You can clear generated product image cache files using Magento’s cache management functionality. Preserve original product images and verify the image regeneration process.
How do I check disk space using SSH?
Use df -h to inspect filesystem usage and du -sh to measure directory sizes.
Why is Magento 1.9 running out of space?
Common causes include excessive logs, cached images, temporary files, backups, large databases, and extensions generating unexpected data.
Does Magento 1.9 support automatic log cleaning?
Yes. Magento 1.x includes a built-in log-cleaning configuration that works through scheduled jobs when configured correctly.
Is Magento 1.9 still supported?
No. Official support for Magento 1 ended in June 2020. Legacy stores should plan migration to a supported eCommerce platform and implement appropriate security safeguards.
Magento Development and Maintenance Services by ObeySoft
Managing a legacy Magento store can become challenging when server storage, application performance, database maintenance, and compatibility problems affect daily operations.
ObeySoft provides Magento development, website troubleshooting, eCommerce maintenance, technical SEO, performance optimization, and website migration services.
We help businesses investigate technical issues, review their existing website architecture, and plan suitable improvements.
Whether you need help with Magento disk usage, product image problems, server configuration, or an eCommerce migration, professional technical assessment can help reduce operational risk.
Website: https://www.obeysoft.com/
Conclusion
Freeing up disk space in Magento 1.9.x requires a careful approach.
Begin by identifying the largest storage consumers, backing up your data, and using Magento’s built-in maintenance tools wherever possible.
Cache files, expired sessions, logs, generated images, and outdated backups may all contribute to storage problems, but each requires different handling.
The safest strategy is to measure first, back up important data, clean only verified unnecessary files, and monitor the results.
For long-term security and maintainability, businesses still operating Magento 1.9 should also develop a migration plan to a supported eCommerce platform.

