Identify and Prevent Disk Space Abuse Cases in Server

What Is Disk Space Abuse?

Keeping an eye on Disk Space Abuse is a crucial part to prevent websites from facing downtime, slow loading speed, or slow email arrival speed. The disk space of a server could be divided into parts, and you can view information about disk spaces from SSH or WHM. Today, in this article, we’re gonna walk you through some diagnostics that you can take to prevent disk space abuse cases in your server. So, without wasting time. Let’s dive right in!!

Identify Disk Space Issue

When the disk space of a server is fully consumed, all the users associated with that server will see the below error while logging into their cPanels.
“Sorry for the inconvenience! The filesystem mounted at / on this server is running out of disk space. cPanel operations have been temporarily suspended to prevent something bad from happening. Please ask your system admin to remove any files not in use on that partition. ”

Disk Space Error Image
Disk Space Error Image

This is the error that the cPanel users face when disk space is fully consumed and no space is left for the server to perform necessary backend tasks. Many of you must have faced this error with your web hosting provider but eventually you can’t get rid of this error until you have administrative privileges. However if you have root privileges, you can check the disk information manually from the WHM root, and take actions accordingly to prevent users from seeing this error.

Prevent Disk Space Abuse Cases in Server

You can solve disk space issues in your server by following the below steps:

1:  Log into your server via SSH

In order to check the disk space abuse cases in the server, you’ll have to log into your server from SSH. To log into your server via SSH, you’ll need SSH-client software such as PuTTY, WinSCP, or ZOC Terminal (For Mac).

I’ll recommend you to install PuTTY if you’re using Windows OS.

Once installed, open PuTTY, select SSH as your connection type, type the hostname/IP Address or your server, and hit the Open button.

PuTTY Configuration
PuTTY Configuration

Type the username and password of your server to log in (You’ll not be able to see the password. Just type the password and hit enter, don’t get confused).

Log into PuTTY
Log into PuTTY

2:  Check Consumed and Available Disk Space

To check the avaidlable and consumed disk space of all partitions, follow the below steps:

  • Once logged into the SSH using PuTTY, type the below command to display the information of your server’s disk space.


# df -h


Filesystem          Size       Used      Avail      Use%         Mounted on
devtmpfs            1.9G        0        1.9G         0%           /dev
tmpfs              1.9G         0        1.9G         0%           /dev/shm
tmpfs              1.9G       186M       1.7G         10%          /run
tmpfs              1.9G         0        1.9G         0%           /sys/fs/cgroup
/dev/sda2          295G       98G        182G        36%           /
/dev/sda1          969M       130M       773M        15%           /boot
/dev/loop0         3.9G       14M        3.6G        1%            /tmp
tmpfs              379M        0         379M        0%            /run/user/0

You can also see the below image for reference.

Check available and consumed disk space
Check available and consumed disk space

That’s how you can check available and consumed disk space of all the partitions in your server. As you’ve already got the information about the disk space of your server, now you can analyze if any of the Partitions are consuming unusually high disk space and reaching the maximum disk space limit.

3:  Find and Sort Top Disk Abusers

So, here comes the diagnostics part. The first step you should take to solve the disk space issue is to find out who’s consuming top disk space. Well, you can easily do it by following the below command:

First of all, navigate to the home directory by using the cd /home command.

Type the below command:

du -sh * | sort -hr | head -n 40
Note: You can modify the number (40) according to the number of your cPanel accounts.

This might take some time as I’ll scan every file from every cPanel and display the top high disk consumers. Also, if you’re facing the session timeout issue then you can use the screen command and display the result in a file.



du -sh * | sort -hr | head -n 4 > /root/abusers.txt
Note: Type the screen command and hit enter. A new terminal window will be opened, then type the above command and hit enter to execute the command even after the session got time out.

Once the process is completed, the abusers.txt file will be created automatically inside your given directory.

find disk abusers via ssh
find disk abusers via ssh

You can use the cat command to view the result (the list of abusers). Once you find the top abusers, the next step you should take is to find the highest space-consuming files in every abuser (cPanel) account.

4:  Find the Highest Space Consuming Files

You can list the highest space consuming files and take action on them by using the below commands:

find /home/cp_username/ -type f -exec du -h {} + | sort -hr | head -100
Note: Replace the cp_username with the cPanel username you have found as an abuser.
Find highest consuming files
Find the highest consuming files

As you can see in the above image that several files are consuming more than 1GB of space. You can copy those files’ paths and send the user an alert to remove those high space-consuming files.

5:  Delete Trash Files For All Users

Trash files could also be the culprits of higher space consumption. However, you can forcefully delete all the trash files of cPanels by using the root power. Use the below command to delete trash files for all users.

First of all, type the cd ~ command and hit the enter button.

Now type the below command:

Note: The above command will download a file that contains a script to delete everyone’s trash, then only you’ll be able to perform the Delete Trash Files Command. You can skip this part if you already have the delete_everyones_trash script present in your server.

Post downloading the delete_everyones_trash directory, change its permission to 0755 by using the below command.

chmod 0755 delete_everyones_trash

Now, you can execute the command to delete trash files from all the cPanel users.


That’s it.

This is how you can easily diagnose disk space and increase disk space by deleting trash files, highest space consuming files, highest disk space consuming cPanels, Etc.

I hope this article helps you, if not, you can simply hit the comment section. We’ll be happy to assist you. Other than this, you can contact us on Facebook and Twitter for any further inquiries or suggestions. We always appreciate suggestions.

Thank You.

Scroll to Top