cPanel disk cleanup – How it benefits your server
Disk space critical in your server? You’d end up seeing website errors, MySQL crashing, errors while uploading files and a lot of other issues in the server.
In our role as Outsourced Tech Support services for web hosts, disk space issues are a commonly resolved issue for server owners who report service or site issues.
Today, we’ll see the different situations that cause disk space to get filled up, and how we resolve them.
5 scenarios when cPanel disk cleanup is required
Disk space issues that affect websites can be categorised into two – quota issues of the user account & hard disk issues in the server.
1. User quota issues
Every user account in a cPanel server is allocated a share of the server’s disk space, based on the plan purchased. This is referred to as the ‘quota’ of the user.
This quota can be filled up due to many factors. The cPanel -> ‘Disk Usage’ feature lists down the files and folders that consume this quota.
While it is fine to let the website files use the quota, there are some other culprits that can consume this available disk space and cause errors in site.
i. Backup files
Backups are taken for disaster recovery. Many a times, users take backups of their website folders but forget to remove them or download them later on.
If backups are not rotated or downloaded to local machines, they will easily clog up the account space. Website functionality will get affected due to this.
ii. Migration data
When accounts are migrated from one cPanel server to another, the files are made into packages of the format ‘cpmove-account*.gz’.
These packages, if not removed from the user account after restoration, can take up disk space of the user and cause quota to fill up.
iii. Temporary files
File uploads via PHP scripts or cPanel File Manager involves temporarily storing this file in a temporary directory, until the file is fully moved to its destined folder.
If the upload process fails in between, these temporary files or session files can remain in the folder and can eventually cause quota to be used up.
iv. Domain statistics
Webstats are very useful for site owners to analyze their website traffic and potential customers. Statistics files are produced by processing the log files.
Log files and statistics files can consume space, if not rotated properly. A huge spike in traffic such as peak sales, dos attacks, spamming or abuse, can also cause log files to grow up quickly.
v. Email attachments
Another problem maker is the mail folder. If the mail client is configured to keep a copy of mails in the server, mails would not be deleted from the server even after they are downloaded.
Emails with huge attachments can take up the disk quota. Not clearing old mails or purging the trash directory can also lead to mail directory filling up the space.
2. Server hard disk issues
When a user’s quota exceeds, only his website is affected. But if the server hard disk gets full, all the services and sites in the server face issues.
The disk usage of a cPanel server can be seen from the WHM -> System Health -> Show Current Disk usage option in the root WHM.
The server’s disk space can get filled up due to many reasons, as listed here.
Backups aid in disaster recovery, especially in case of a hard disk crash. Ideally the backups are to be stored in a separate location from the server.
But many server owners keep backups in the same server, to save costs. If not configured properly, these backups and pile up and cause disk partition to get full.
ii. Temporary files
PHP session files, files uploaded via scripts, database files, and other software related files can get stored in the temporary folder in the server.
Due too huge file uploads, crash during sessions, too many database operations, etc., this temporary folder can get filled up and cause services to fail.
iii. Core dump files
Core dump files are huge files that are created when the process terminates unexpectedly. For instance, crashes in Apache web server can leave core dump files.
If gone unnoticed, these core dump files can take up space in the server’s main partitions, and thus lead to errors in website or related services.
iv. Log files
Every service has related log files to record the access attempts, errors, etc. Each domain too has its own log files to store bandwidth usage and traffic details.
The log files can grow large in servers with high traffic, under attack or too many sites. If not rotated properly, these can easily fill up server space.
v. Software related files
Server software updates such as package manager updates, cPanel updates, third party software updates, etc. can cause downloads of too many files.
When the upgrade gets interrupted in between, it can leave unwanted files in the server. Downloading files manually and later forgetting to delete them, can also cause disk space issues.
cPanel disk cleanup – The major tasks involved
In the servers we manage, we prevent the disk space issues by doing these preventive maintenance steps.
- Whenever possible, we configure backups in secondary location for better disaster management and disk space saving.
- In the servers with local backup storage, we configure backup retention and incremental backups to save space.
- We set disk alert notifications, so that whenever an issue occurs, our 24/7 team can promptly resolve them to ensure websites and services are not affected.
- Package updates and software installations are monitored for successful completion and unwanted files or cache are removed from server.
- Our custom cronjob helps to locate and clear off temporary and unwanted files that cross their expiry dates.
- We do periodic server scans to track malicious files, obsolete accounts, hack attempts and other data that can affect disk usage.
- Log files are periodically examined and rotated to ensure no malicious traffic, errors or piling up of logs happen.
- File system tweaks, disk re-partitioning and upgrades are performed in critical cases where there is no other way out.
Disk space errors are a commonly encountered in all servers. Today we saw how our Dedicated Hosting Engineers perform cPanel disk cleanup in the servers we manage.