BuycPanel Blog

BuycPanel Blog

Latest news and updates

2/27/2015 – Clearing a Full Partition on cPanel

Posted by Jamison on 27 02 2015.

When you want to erase a full partition on cPanel, you may be wanting ultimately to free up more space on your directories. If you haven’t performed your scheduled system maintenance and general housekeeping for your computer setups, you may be getting a message that warns you that you’re about to use up all your space on your main user partition.

 

If you want to create a separate partition for your cPanel, you either have to reformat your whole computer or clear the partition cPanel is on and start over from scratch. Once you’re installed cPanel again, your system may run more smoothly sicne you’ve freed up a lot of space.

 

So if you’re having a problem with disk space, try clearing a full partition. How do you do this?

 

There are a few possible solutions. Usually, the /var directory fills up first. This is because the /var directory holds all of the system logs.

 

  • To view the directory or log that takes up the most space, run the following commands:
 

 

 

cd /var

du -sh

 

Keep in mind that this shows the space that is used and available in each directory, as well as the file sizes of each file in the current directory.

 

Once you’re done with bringing up the space for each directory,

 

  1. Examine the output and determine which directory takes up all of the space. Run the cd directory command, where directory is the name of the directory, to navigate to that directory.
  2. Repeat these first two steps until you find the files that take up the most space.
  3. When you find the directory or file that takes up the most space, you can either delete the files or save some of the most recent entries. Run the following commands to save the most recent entries:
 

 

 

 

tail -5000 filename > filename.new

mv filename.new filename

sync

    4. Restart the service that created the file to release its file lock.

 

The /usr directory also fills up due to Apache. To look at the Apache logs, run the following commands:

 

 

 

cd /usr/local/apache

du -sh

 

Take note that the the logs/error_log or logs/access_log files are sometimes very large. At this point, you can delete them or use the tail set of commands that are described above.

 

Another solution you can try is to clear up disk space. Here’s how:

 

Since cPanel is often installed on the /usr partition and it is typically small, your /usr partition can quickly reach 100% capacity.

 

Cleaning up Disk Space

 

You can find the core files in:

 

/usr/local/cpanel/base

The name of the core files will follow this format.

core.#

where # is the number of the process that died.

You can safely remove these files.

 

Fixing the Issue

 

Forcing a cPanel update has fixed the issue.

 

/scripts/upcp –force

 

Adjusting cPanel Notifications

 

In the Tweak Settings part of cPanel, you can adjust notifications for certain disk usage and other alerts. You need 10% free or at least 500MB for any partition containing cPanel.  If the partition contains other items, like MySQL, you may want to have more space.