Page tree
Skip to end of metadata
Go to start of metadata

Overview

This document provides the steps to clear a full partition. Usually, the /var directory fills up first, because it holds all of the system logs. 

Note:

The /usr directory may also fill up quickly due to Apache.

Clear a full partition


Check the directory space from the command line.

To check the disk space from the command line, perform the following steps:

  1. Log in to your server as the root user via SSH.

  2. Examine your system to locate the directory or log that uses the most space. To do this, change to the /var directory and run the du -sh command.

    • The du utility prints the estimated disk space usage of each file and directory for the path that you specified.
    • The -sh argument causes the command to print the information in a human-readable format.

    The output will resemble the following example:

     Click to view...
    4.0K	./cpanel/acllists
    0	./cpanel/analytics/data
    0	./cpanel/analytics/logs
    0	./cpanel/analytics/run
    4.0K	./cpanel/analytics
    24K	./cpanel/plugins/wordpress-instance-manager-plugin
    24K	./cpanel/plugins
    0	./cpanel/passreset
    8.0K	./cpanel/mailman/diskusage_cache
    8.0K	./cpanel/mailman
    563M	./cpanel
    4.0K	./named/data
    0	./named/dynamic
    0	./named/slaves
    124K	./named/cache
    236K	./named
    44K	./www/html
    0	./www/cgi-bin
    44K	./www
    0	./cvs
    0	./proftpd
    2.8G	.

    The numbers in the left column of the output represent the file size of each file and directory that the specified directory path contains, in human-readable format.

    Note:

    Due to the number of files and directories in the /var directory, this example only shows partial output from the du utility.

  3. Examine the output and determine which directories use the most space.

  


 

Delete selected files and directories.

You can delete individual files within a directory and individual directories. To do this, perform the following steps:

  1. Change to the directories that contain the most disk space.
  2. Examine the size of each file in the directory. To do this, run the du -h * command.
    The output will resemble the following example:

    Note:

    The following example displays the output for the /var/www/html directory.

    4.0K	400.shtml
    4.0K	401.shtml
    4.0K	403.shtml
    4.0K	404.shtml
    4.0K	413.shtml
    4.0K	500.shtml
    12K	cp_errordocument.shtml
    4.0K	index.html


  3. Either delete the files or save the most recent entries.
    • To save the most recent entries, run the following commands:

      Note:

      In these commands, filename represents the file to delete, and filename.new represents the file to which to save the most recent entries.

      tail -5000 filename > filename.new
      mv filename.new filename
      sync
    • To delete the files, run the following command:

      cat /dev/null > filename 

 


 

Restart the service.

After you delete the files and directories, restart the service that created the file. To do this, follow the directions in our How to Restart Services documentation.