Deprecated: Hook custom_css_loaded is deprecated since version jetpack-13.5! Use WordPress Custom CSS instead. Jetpack no longer supports Custom CSS. Read the documentation to learn how to apply custom styles to your site: in /srv/www/ on line 6078
exim Archives ⋆ SysAdminStuff

How to clear disk space on cPanel server

By default drives will come with 5% of all filesystems allocated as reserved disk space allocated for privileged users, and not shown as available space.

Since drives in use today tend to be large, reserved block percentage can be lowered to 1%, or specified to specific number of block.

To set the reserved space to 2500 blocks “tune2fs -r 2500” can be used.

tune2fs -r 2500 /dev/sda5

To set reserved space to 1% of disk size “tune2fs -m 1” can be used.

tune2fs -m 1 /dev/sda5

Files that can be cleared by main partitions/folders, to reduce disk usage on cPanel servers:

Reduce /home usage

Several files and folders can be truncated or removed on /home.

When EasyApache is run, it will leave file behind, that were used for Apache/PHP build, that can be removed if space is needed.

EasyApache files can be removed with following command.

rm -rfv /home/cpeasyapache

cPanel FileManager can leave temporary files, that were created during user uploads.
These can be removed with following command:

rm -fv /home/*/tmp/Cpanel_*

If you were moving any accounts to the server with WHM Transfer Tool, temporary account migration files can be left on drive.

These can be removed with following command:

rm -rvf /home*/cpanelpkgrestore.TMP*

Disk space can be recovered by deleting Softaculous and Fantastico backups from user folders, if they are used.

rm -fv /home*/*/.softaculous/backups/*
rm -rfv /home/*/fantastico_backups

If you were making cpmove file manually, they will by default be created inside /home.
You can clean any leftover cpmove files with following command:

rm -rvf /home/cpmove-*

Often large portions of disk space can be used up by large error_log files inside account home folders.

You can empty all error_log files to 0 bytes usage with following command:

find /home/ -name error_log -type f -print -exec truncate --size 0 "{}" \;

If users have large number of account backups in their home folders, those can use up a lot of space.

Accounts backups can be removed from user folders with following command:

for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
Summary of all used commands, for clearing /home
#Emtpy all error logs
find /home/ -name error_log -type f -print -exec truncate --size 0 "{}" \;
#Remove EasyApache files
rm -rfv /home/cpeasyapache
#Remove Softaculous backups
rm -fv /home*/*/.softaculous/backups/*
#Remove account backups
for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
#Remove Fantastico backups
rm -rfv /home/*/fantastico_backups
#Remove temporary cPanel files
rm -fv /home/*/tmp/Cpanel_*
#Remove any cpmove files
rm -rvf /home/cpmove-*
#Remove temporary account migration files
rm -rvf /home*/cpanelpkgrestore.TMP*
Reduce /var usage

Disk space in /var can be cleared by deleting archived logs, which will usually end with .gz, or contain year inside their name, like such as “maillog-20161113”.

Archived logs can be cleared with following commands:

rm -fv /var/log/*.gz
rm -fv /var/log/*201*

Disk space in /var can get also get used up by core dump files inside /var/spool/abrt/ directory, which get created in cases of kernel panic.

These file can be cleared up with following command:

rm rfv /var/spool/abrt/*

Check the size of exim stats database, which can sometimes take several gigabytes in size, depending on settings:

du -sh /var/lib/mysql/eximstats/

In case eximstats database is large, consider emptying the database, and changing retention settings.

How to clear or disable eximstats on cPanel

Reduce /usr usage

Disk space in /usr can be cleared by removing cPanel and Apache archived logs, or old installation files of Apache, and if installed, maldet.

Every time you rebuild Apache with EasyApache, old installation files will be moved to “apache.backup*” directory.

Remove old Apache files with following command:

rm -rfv /usr/local/apache.backup*

Similar thing happens with maldet, if it is installed, on updates, old installation will be moved to “maldet.bk*” folder.

Remove old maldet files with following command:

rm -rfv /usr/local/maldet.bk*

Clear disk space by removing archived cPanel logs:

rm -fv /usr/local/cpanel/logs/archive/*.gz

Remove archived Apache logs:

rm -fv /usr/local/apache/logs/*.gz
rm -fv /usr/local/apache/logs/archive/*.gz

Although not often, sometimes maldet logs can use up a lot of space.
Remove maldet logs:

rm -fv /usr/local/maldetect/logs/*
Summary of all used commands, for clearing /usr
#Remove old Apache files
rm -rfv /usr/local/apache.backup*
#Remove old maldet files
rm -rfv /usr/local/maldet.bk*
#Remove maldet logs
rm -fv /usr/local/maldetect/logs/*
#Remove archived cPanel logs
rm -fv /usr/local/cpanel/logs/archive/*.gz
#Remove archived Apache logs
rm -fv /usr/local/apache/logs/*.gz
rm -fv /usr/local/apache/logs/archive/*.gz

How to Free Up Disk Space on a cPanel Server

11 Ways to Free Up Disk Space on a cPanel Server

How to clear or disable eximstats on cPanel

What is eximstats

Eximstats, on WHM/cPanel servers, is used to maintain statistics and information about email messages processed by Exim mail service.

If the data in it is not cleared often enough it can grow, and cause issues with disk space, or MySQL resource usage, as the size of the database can cause higher memory and disk consumption.

Disabling eximstats

If you do not have any need for Exim statistics, which are used for Mail Delivery Reports on  Home »Email »Mail Delivery Reports, gathering exim statistics can be disabled from WHM or command line.

In WHM it can be disabled by going to Home »Service Configuration »Service Manager, and unchecking the service, and then clicking on the Save button on the bottom.

This will stop the database from being populated with new data.

Eximstats in Service Manager
Service Manager

From command line, you can disable the database from being populated by running a following command:
/usr/local/cpanel/bin/tailwatchd --disable=Cpanel::TailWatch::Eximstats

Lowering Eximstats retention time

Database is periodically cleaned, and by default Exim stats are retained in database for 10 days, which can be changed in WHM by going to Home »Server Configuration »Tweak Settings and changing the “The interval, in days, to retain Exim stats in the database” setting on the “Stats and Logs” tab.

Setting can also be changed by altering the “exim_retention_days” value in “/var/cpanel/cpanel.config” file.

Empty eximstats database

Database can be cleared either by deleting from its four tables, defers, failures, sends and smtp, or by dropping the database completely, and creating a fresh one with empty tables from “/usr/local/cpanel/etc/eximstats_db.sql” file.

To delete all of the data from the tables following command can be used:

mysql -e "use eximstats;delete from defers;delete from failures;delete from sends;delete from smtp;delete from smtp;"

To drop the database and recreate it again, following commands can be used:

mysqladmin drop eximstats
mysqladmin create eximstats
mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

Reverse DNS does not match SMTP Banner

UPDATE: WHM/cPanel removed support for in version 11.50, so changes below are not valid for versions 11.50+


If you make an SMTP test on you might be getting a following error shown in the test results “Reverse DNS does not match SMTP Banner”.

This error is showing because your SMTP greeting message is not matching the PTR records for the IP of the SMTP server used in test.

Following files need to be used and configured properly, for SMTP banner to match reverse DNS records.


Configure Exim to use mailhelo and mailips file

Go to WHM to Home »Service Configuration »Exim Configuration Manager and in Basic Editor on Domains and IPs tab set following settings:

Send mail from account’s dedicated IP address: OFF
Reference /etc/mailhelo for outgoing SMTP HELO: ON
Reference /etc/mailips for outgoing SMTP connections: ON

Configure necessary values in configuration files

Edit or create  /etc/mail_reverse_dns file and set the following in it for needed IPs.

x.x.x.x: rdns of the IP x.x.x.x
y.y.y.y: rdns of IP y.y.y.y

Edit or create /etc/mailhelo file and set following in it for the domains that you want to setup SMTP banner for. reverse dns of the IP used for domain
*: default SMTP HELO for unconfigured domains

Edit or create /etc/mailips file and set following in it: x.x.x.x #x.x.x.x is the IP used for outgoing mail for domain
*: y.y.y.y #y.y.y.y is the default IP that will be used for unconfigured domains

Configure exim.conf to use correct SMTP Banner

Following values need to be configured in exim.conf for SMTP Banner to be set to rDNS values set in /etc/mail_reverse_dns.


Be default only smtp_banner is set on cPanel servers, and it has a different value then needed.

root@server1 [~]# egrep "smtp_active_hostname|message_id_header_domain|smtp_banner" /etc/exim.conf
smtp_banner = "${primary_hostname} ESMTP Exim ${version_number} \

smtp_banner will probably look like this on your cPanel server.

"${primary_hostname} ESMTP Exim ${version_number}  \#${compile_number} ${tod_full} \n   We do not authorize the use of this system to transport unsolicited, \n   and/or bulk e-mail."
Configure values in exim.conf over shell

Locate the line smtp_banner and change its value so it looks like following:

smtp_banner = "${smtp_active_hostname} ESMTP Exim ${version_number} \"

Add smtp_active_hostname line value to exim.conf to look line following:

smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/mail_reverse_dns}{$value}{$primary_hostname}}

Add message_id_header_domain line to exim.conf to look like following:

message_id_header_domain = $smtp_active_hostname

In the end related values in exim.conf should look like this:

root@server1 [~]# egrep "smtp_active_hostname|message_id_header_domain|smtp_banner" /etc/exim.conf
smtp_banner = "${smtp_active_hostname} ESMTP Exim ${version_number} \"
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/mail_reverse_dns}{$value}{$primary_hostname}}
message_id_header_domain = $smtp_active_hostname

Restart exim with /scripts/restartsrv_exim and SMTP tests should now pass without the SMTP banner warning.

Configure values in exim.conf over WHM

In your WHM go to Home »Service Configuration »Exim Configuration Manager and go to Advanced Editor.

Search for the smtp_banner field and change default value to:

"${smtp_active_hostname} ESMTP Exim ${version_number} \"


Edit smtp_banner in WHM
Edit smtp_banner in WHM

Find the “Add additional configuration setting” button and add two new configuration settings smtp_active_hostname and message_id_header_domain.

additional configuration settings
Add additional configuration setting in WHM

For smtp_active_hostname set the following value:


For message_id_header_domain set the following value: