Disk exhaustion from old mail is a frequent hosting issue. It is often caused by silent failure of cleanup automation, not sudden traffic growth.
Operational failure pattern
In this case, maintenance scripts were removed or moved during migrations. Impact:
- unlimited Trash mailbox growth
- accumulated
error_logand temp files - fast storage increase on specific accounts
Immediate remediation was restoring cleanup routines through cron.
Native cPanel cleanup using Dovecot queries
Beyond root-level scripts, Email Disk Usage in cPanel supports custom queries using Dovecot syntax for granular cleanup.
1) Time-based cleanup
savedbefore 30d
Targets messages saved more than 30 days ago.
2) Sender-based cleanup
from "alertas@dominio.com.br"
Useful for high-volume automated senders.
3) Smart Trash/Spam cleanup
Inside Trash, use:
all
To remove all messages in selected folder.
Or:
seen savedbefore 15d
To delete only old read items.
Quick query reference
| Goal | Dovecot query |
|---|---|
| Messages larger than 10 MB | larger 10M |
| Old unread messages | unseen savedbefore 60d |
| Filter by subject | subject "Backup diário" |
| Messages before date | before 01-Jan-2024 |
Operational best practices
- Audit cron jobs after migrations and panel updates.
- Train users to use Email Disk Usage for self-service.
- Always preview hit count before mass deletion.
- Define retention policy per mailbox type.
Advanced SSH option
You can apply the same logic in batch mode with:
doveadm purgedoveadm expunge
This scales maintenance across many mailboxes.
Sustainable email storage management combines server automation and precise Dovecot query filtering in cPanel. This prevents full-disk incidents while preserving important data.
This post is licensed under CC BY-NC.
Comments
Join the discussion below.
Comments are not configured yet. Add Cusdis settings in /assets/json/config/blog-comments-config.json.