Skip to main content

How to Troubleshoot a Full Server Disk

A full server disk prevents the system from writing new data, which can cause services like email, databases, and websites to stop functioning. This guide helps a WHM Server Administrator identify the cause of the disk space exhaustion and clear the...

A full server disk prevents the system from writing new data, which can cause services like email, databases, and websites to stop functioning. This guide helps a WHM Server Administrator identify the cause of the disk space exhaustion and clear the necessary files to restore service.

Before you begin

You will need:

  • Root access to the server via WHM or SSH.

  • A current understanding of the server's file structure.

Identify the largest partitions and files

To resolve a full disk, you must first identify which partition is full and which specific directories are consuming the most space.

  1. Log in to your server via SSH.

  2. Run the following command to see the status of all partitions:

    df -h

  3. Identify the partition that is at 100% (or near 100%) capacity.

  4. Once the full partition is identified, use the du command to find the largest directories within that partition. For example, to see the top 10 largest directories in the root directory, run:

    du -ah / | sort -rh | head -n 10

  5. Repeat this process for subdirectories (e.g., /var, /home, or /tmp) until you identify the specific folders causing the issue.

Common areas for disk space consumption

Depending on the results of your search, the following areas are common culprits for disk space issues:

Log files

Large log files in /var/log or /var/log/apache2 can accumulate over time.

  • Check for unusually large .log files.

  • If a log file is excessively large, you can clear it by truncating it:

> /path/to/file

(Replace /path/to/file with the actual path of the log file.)

Temporary files

The /tmp directory may contain old temporary files that were not deleted.

  • Check the size of the /tmp directory.

  • Clear old files that are no longer in use.

Mail queues

A massive buildup of mail in the system queue can fill up the /var partition.

  • Check the size of the mail queue.

  • If the queue is full of undeliverable mail, you may need to purge the queue.

Clear the space and verify

Once you have identified and removed the unnecessary files or cleared the logs, you must verify that the system has regained sufficient space.

  1. Run the df -h command again.

  2. Confirm that the partition in question now has available space.

  3. Check that the services affected by the full disk (such as Apache, Exim, or MariaDB) are running correctly.

If the disk fills up again quickly

If the disk fills up again shortly after you clear it, a process may be generating logs or data at an abnormal rate.

  • Check for runaway processes: Use the top or htop command to see if any process is consuming excessive resources.

  • Check for error loops: Review the logs for a specific service to see if it is stuck in a loop and writing errors to a log file repeatedly.

  • Verify cron jobs: Ensure that any automated scripts are completing successfully and not creating duplicate files.

Limitations

  • This procedure does not include instructions for expanding the physical disk size or adding new storage to the server.

  • Removing files from the /home directory will delete data belonging to your cPanel accounts. Ensure you do not delete active user data.

  • Truncating a log file while a service is actively writing to it may not immediately free up space until the service is restarted.

Did this answer your question?