The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Dealing with space issues.

Discussion in 'General Discussion' started by InstaCarma_Tech, Jun 15, 2009.

  1. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Apr 22, 2009
    Likes Received:
    Trophy Points:
    I am seeing a lot of posts regarding space issues. So, I thought of putting together a few tips to deal with such problems.

    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 ‘’ 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.
  2. PlatinumServerM

    PlatinumServerM Well-Known Member

    Jul 10, 2005
    Likes Received:
    Trophy Points:
    New Jersey, USA
    cPanel Access Level:
    Root Administrator
    Nice tutorial :)

    I would just like to mention that although this looks simple, anyone doing this should be careful if they are not fluent with ssh. These can be disastrous if done wrong.

Share This Page