Running out of disk space is a very common issue.  Be it a web-hosting service provider or the end-user.  I wanted to share a few tips that the technical support staff  at InstaCarma use to resolve disk-space issues on a cPanel server. As we all know, there are various partitions on a server which are meant for different purposes. So, the methods used to deal with space issues on these partitions will also vary. Let us see them one by one.

The /USR partition

1. Restart the httpd service. This might free a little space some times.

2. Check for apache logs like error_log, access_log , suexec_log in /usr/local/apache/logs . These can either be cleared off or if you need the logs then you can take a zipped copy and keep it aside.

3. Same can be done for the files in cPanel logs (/usr/local/cpanel/logs)  as well .

4. Domlogs – Get into  the /usr/local/apache/domlogs/ directory. Run the following command :-

# ls -al -SR | head -10        —> It will list 10 files in the decreasing order according to their size

If the domlog file is too large for a domain then it is possible that awstats is not running . Check whether cpanellogd is running on the server  using  pstree . If not, restart it .
Else, it is possible that awstats for only that particular domain is not updating. Get into the directory /usr/local/cpanel/base and check if any file as ‘awstats.domainname.com.conf’ exists.   If yes , delete that file.

Now,  run /scripts/runweblogs for that user.  It will update the awstats and automatically clear the domlogs file thereafter. Do not delete the domlogs file itself.

5. Remove old and unwanted backups of  ‘apache’  that might have been taken long ago. Also, check for any other duplicate folders that can be removed safely.

6. Remove core files, if any . Normally, some core files (like core.1234) might be present in /usr/local/cpanel/whostmgr/docroot . Check for these and remove them.

—————————————————–

The /HOME partition

1.  Check for unwanted cpmove/tar files for the user accounts in /home and delete them.

2.  Check for any cpmove folders as well in /home

3.  Check the folder ‘cprestore’  in /home for any tar files. Be careful. These should  be deleted only if they are very old,say about 4-5 months.

4. Using find command you can check for unwanted tar files(especially cpmove/backup) in the entire home directory. Check their size. If you think that deleting them will  make considerable difference to the disk space then delete them.

5. Check for core files and delete them.

6.  Search for large accounts and see if they are hosting any prohibited content or violating your company policies. If yes, take appropriate measures as per your policies.

—————————————————–

The /VAR partition

1. Restart the mysql service.

2. Log files in /var/log like exim_mainlog, mailmon.log, messages, mysqld.log, mysql_slow_queries.log  can be deleted after taking backups of the required ones..

Note that there is no point in deleting these log files if the size is very small. Check whether deleting these would make any difference.

If you are deleting them then do re-create the files, or you can use the command ‘echo ” ” > logfile’ to empty the existing files.

3.  Clear Mysql logs like server-name.err or any other  present  in /var/lib/mysql

4. Delete mysql-bin.000* file  in /var/lib/mysql, if present.

5. There might be useless large .sql files   in /var/lib/mysql . Delete them.

6.  Remove unwanted emails from spool. You can use the following code to do that :

exim -bpc
exim -bpru | grep frozen | awk {‘print $3’}|xargs exim -Mrm
exim -bpru | grep “<>” | awk {‘print $3’}|xargs exim -Mrm
exim -bpru | grep “nobody” | awk {‘print $3’}|xargs exim -Mrm
exim -bpru|awk {‘print $3’}|xargs exim -Mrm
exiqgrep -o 86400 -i | xargs exim -Mrm
exim -bpc

7. There might be yum cache files inside the /var/cache folder which can take space. To remove them do:
#  yum clear all
#  yum list all

8. Again, search for any core files ( core dump ) like core.12* etc.

—————————————————–

The /BACKUP partition

1. Remove any tar/cpmove files if they are too old and large.

2. Remove any old  configuration backups ( like apache.bkp) or any log file backup , say 3-4 months old.

3. Check for core files and remove them.

These are some of the general steps that can be followed to deal with space issues on the servers.

Read some more blogs also:-

Top things to consider before DevOps implementation

The future prospects of Managed IoT Services

Why do you need Managed IT Services for your Business?

Contact Us, if you have any queries regarding this.


Shares
Contact Us On WhatsApp