Maintaining Your cPanel Server

When administering your own cPanel server for the first time, you may not be sure what you should actually be doing. After all, it’s your first time and you probably don’t have an experienced administrator teaching you or watching over your shoulder. That’s where this guide comes in; here we will give you the basics of what you should be aware of and check on every now and again to make sure your server stays online.

Most people are familiar with the adage “Measure twice, cut once” advising that one should always plan carefully before taking action. This holds very true when administering your own server. For the purposes of this guide, I will use this in the context of

  1. Taking Frequent Backups (Measure once)
  2. Checking Server Resources (Measure twice)
  3. Purging Files to Reduce Disk Space (Cut once)

Take Frequent Backups

Particularly important is scheduling automated backups of your content in case of accidental deletion or data loss. In this case, the “Cut once” will be keeping a backup of your own, once create, in an off-site location such as your work computer or an online storage account. The “Measure twice” will include

  1. Making sure you (or your server) are taking frequent backups
  2. Making sure your server has enough available space to create and store the backups you wish to maintain

Fortunately cPanel makes creating a backup a fairly simple task and provides both whole-server backup functionality as well as single-account backups. We go into more detail on these two backup options in the following articles, depending on your desired result, but it is very important to know that cPanel does not have automatic backup enabled by default, so this is definitely something you will want to plan for yourself:

As for making sure you have enough disk space available for backups, we will go into checking or monitoring disk usage in the next section but here I will lay down a few very general rules regarding disk space and backups:

  1. Allow 1.5 to 2.5 times the current disk usage of your content for generating backup files. The reason for this is that during creation there may be up to three “complete” copies of your content if you include the source, the backup file, and temporary files used during compression.
  2. For every backup you plan to keep on the server at any point in time, give yourself additional space equal to the size of your content uncompressed. This is recommended because not all content compresses equally. Sites with a lot of photo and video files for example will have a much lower compression ration than a site of pure text because usually the photos and videos have already been compressed.

So for example, lets assume you have 30 GB of storage and 5 GB of content on a standard cPanel server configuration. If you keep 1 backup on the server, this could be what your disk usage looks like during the automated backup and before cPanel rotates the old backup file.
7 GB – cPanel disk usage before content (typical installation)
5 GB – file, database, and email content
4.9 GB – last month’s backup
4.9 GB – backup file being generated (almost complete)
+ 2.5 GB – temporary files related to backup file being generated
24.3 GB of 30 GB in use during backup generation; 16.9 GB in use after backup is complete and old backup is deleted

So as you can see, even a relatively small website using only 5 GB of space can amount to needing 30 or 40 GB of space depending on personal backup needs.

Checking Server Resources


Have you ever had to wait in a long line at the grocery store and there’s only one or two cashiers? Seems like it takes forever to finally get to the front for what probably amounts to only a few seconds to make your purchase, right? Not having enough RAM or CPU can cause the sites and applications on your server to do that as well. When too many sites or services are asking for resources at the same time, even your smallest quickest site may be stuck in line waiting for what it needs. When this happens it’s usually a very good indicator that either your server doesn’t have enough resources, or something is consuming far more than you had anticipated.

Analogies aside though, if it’s disk space you run out of it is no laughing matter. A lot depends on having disk space (aka storage) available at all times. Files, both your own content and also server required or temporary files, rely on disk space and running out can cause them to become corrupt or simply fail to write. Databases, regardless of engine or format, rely on disk space as well. If you don’t plan ahead and that backup you scheduled for the middle of the night runs out of available space, not only will your backup be ruined but services running on your server may fail as well.


Now for the technical part; how to check your resource usage. cPanel makes it really easy to see current-time resource usage, and provides several sections to view this information:

Inside WHM

Assuming you’re logged in to your WHM console, navigate to the Service Status page, either by using the search box or by navigating to the Server Status page.

WHM >> Server Status >> Service Status location

Here you will see a list of monitored services, and current resource usage including CPU utilization, RAM, SWAP, and Disk.

WHM >> Server Status >> Service Status page

If your server is low on resources to the point where requests or tasks begin to pile up, the Service Status screen will show a critical symbol instead of the green check mark, as shown below:

Note: Disk usage is also shown inside of WHM in the Show Current Disk Usage page with a slightly different layout:

WHM Show Current Disk Usage

Inside cPanel

Many administrators do not know this, but individual customers can actually see server statistics within their own cPanel account by clicking on the Server Information link hidden by default in the account statistics vertical section on the left side of the page. To find this link, simply click the Expand Stats link and scroll down to the bottom of this vertical section.

cPanel Server Information link location

Just like the WHM Server Status page above, this page lists both server processes, RAM, CPU, SWAP, and Disk Usage for the server as a whole.

cPanel Server Information screen


Last, but certainly not least, it is important to point out that WHM is preconfigured with email notification warnings when your server’s disk space starts getting low. These notification options can be modified in the Server Configuration >> Tweak Settings page under the Notifications tab.

WHM >> Server Configuration >> Tweak Settings >> Notifications section

Purging Files to Reduce Disk Space

Junk and Trash Mail

By far one of the most frequent “surprises” found when tracking down disk usage is the size of users’ Junk and Trash folders. The safest way to remove this content of course would be through one of the webmail clients installed by cPanel. This is unfortunately very time consuming if you have a lot of domains or users, but is the only way cPanel provides for per-account deletion of either Trash or Junk mail content.

cPanel does provide a global setting for purging of Trash mail, however, that can be configured through WHM under the Mailserver Configuration page in the Service Configuration section.

WHM's Mailserver Configuration >> Auto Expunge Trash option

Once you’ve navigated to that page, scroll all the way down to the bottom until you see the option and checkbox labeled Auto Expunge Trash, check this checkbox, change the Trash Expire Time if the 30 day default isn’t to your liking, and click Save Changes at the bottom of the page. Now, your server will automatically check for, and delete, any message lingering in your users’ Trash folders for more than 30 days.

Please note that setting this option may not delete this content immediately, but it should delete the next time the cPanel dovecot_auto_expunge_trash script is executed; which is usually nightly. If you absolutely need it to begin purging immediately you can trigger the script manually by running the following command in the terminal of your choice while logged into your server as the root user:


cPanel unfortunately does not provide any method of automatically purging Junk folders like it does for Trash. One could argue that this is a good thing, since a message isn’t guaranteed to be trash unless it is in the Trash folder, but sometimes an admin has to make those tough calls in order to prevent running out of disk space entirely. If you find yourself in one of these situations, you can check the amount of disk space in use by Junk messages older than 30 days (just to be safe) by running the following hand-crafted command:

find /home/*/mail/ -type f -regextype posix-egrep -regex '.*/.Junk/(cur|new|tmp).*' -mtime +30 -exec stat -c %s {} \;|awk '{ s+=0;s+=$1} END {print s}'

Please notice the parameter -mtime +30; this is what specifies to only include messages older than 30 days. You can alter this value to any number that meets your liking. Please also note that this command will return the size of ALL files, older than 30 days, in bytes. If nothing is returned, there are no files matching that criteria on your server to be deleted.

If you wish to proceed with deleting the files identified by the previous command, you can run this command in your terminal to get the job done:

find /home/*/mail/ -type f -regextype posix-egrep -regex '.*/.Junk/(cur|new|tmp).*' -mtime +30 -delete

Backup Files

In addition to the automated backups we helped you configure above in WHM, users have the option to generate one-time single-account backups inside of their cPanel account, either for download or permanent storage. Unfortunately, these backups too are never rotated or purged automatically and can accumulate to cause a disk shortage. Since yet again cPanel does not have a global purge option for these, the following command, run as the root user, will look for files starting with the prefix backup- located in your cPanel user directories:

find /home/*/ -maxdepth 1 -type f -name 'backup-*.tar.gz' -exec stat --printf "%s\t%n\n" {} \;

Please note two differences with both the script above:

  1. Each file and it’s size are output for the above command instead of only a total size
  2. The find commands are not limited to files older than 30 days, so this will find all backup files with this name prefix, regardless of age.

Just like the Junk script above, if you’re confident you wish to delete, the modified command below will delete all file identified above:

find /home/*/ -maxdepth 1 -type f -name 'backup-*.tar.gz' -delete

cPanel Log Files

cPanel comes configured by default to rotate log files when they grow larger than 300 MB. For those who may not know, rotating a log file is the process of archiving the current file by renaming it; usually using a name including the date, and sometimes time, that the file was rotated. Log rotation provides the benefit of limiting log sizes to a reasonable size for server performance while archiving the older log data in case it needs to be reviewed at a later date.

Log rotation settings may be found on the WHM cPanel Log Rotation Configuration page in the Sevice Configuration section

WHM's cPanel Log Rotation Configuration screen

Please note that if you disable log rotation, that only disables the automatic archiving of the log file that maintains the restricted size. Disabling log rotation will not delete previously created archives and can allow the log file in question to grow unrestricted. This unrestricted growth can cause other problems if it’s size approaches 2 GB is size (or 4 GB on a 64-bit OS) so it is strongly recommended to leave rotation enabled.

Unfortunately, the archived log files are left in place indefinitely and there is no single button to click inside of WHM or cPanel to delete them. For that reason, it is very possible that archived log files can slowly (or quickly depending on what is being logged) fill your server’s available storage.

cPanel does not currently provide a point and click interface to clean or delete archived log files. If you wish to do so, cPanel stores these archives on the server in /usr/local/cpanel/logs/archive/, which may be accessed via commandline in your favorite terminal application.

If you would prefer to follow a cPanel provided article, they do provide the following documentation:

Other Log Files

Other installed services also have log rotation enabled but, unlike cPanel logs, many of them are configured to delete files automatically. The process responsible for this, logrotate, cannot be configured inside of cPanel but can instead be viewed or edited via command line at /etc/logrotate.conf. Additional application-specific configuration files are also included from /etc/logrotate.d/

Note: If you don’t need easy access to read these archived files, you can save space on your server by un-commenting the compress directive inside of the logrotate.conf file. This will enable compression as the default option for all files rotated by logrotate, unless explicitly set otherwise by a individual log’s configuration.


In this article we have provided a very short list of things you may need to know administering your own cPanel server for the first time. We’ve walked you through the why and how of taking frequent backups; automated or otherwise. We have shown multiple areas where WHM and cPanel allow you to monitor real-time resource usage. And we have provided recommendations and steps for locating and reducing typical areas of high or unexpected disk usage.

If after reading this article, you determine that you need additional resources, options to increase the available resources on your server are discussed in further details in our article Modifying Your Cloud Product’s Resources. If f you’re still not sure what it is that you need, please contact us for additional assistance.

Was this article helpful?

Yes (12)
No (0)

We're sorry you didn't find this article very helpful. Please help us improve it by leaving your feedback below.