How to Identify and Prevent Disk Abuse Cases in Server?

You can easily identify and then prevent disk abuse cases in Server by using the below given commands.
Before procedding to execute any command, log in to your Server with root credentials.

 

#1. Check Consumed and Available Disk Space

  • Type the below command to display the information of your server's disk space.

 

# df -h 

 

#2. Find and Sort Top Disk Abusers

 

Now, 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. This can be done easily by following the below command.
  • Navigate to the home directory by using the cd /home command and then execute the following command.
du -sh * | sort -hr | head -n 40
*You can modify the number 40 as per your choice.
  • Now, execute the below given command to sort top disk abusers.
du -sh * | sort -hr | head -n 4 > /root/abusers.txt
  • 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 account.

#3. 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
*Replace cp_username with the cPanel account name which you find as an abuser.
  • List of all the files consuming more that allotted quota will appear. You can copy the path of the files and send it to the owner of the account with an alert.

#4. Delete Trash Files For All Users

  • Use the below command to delete trash files for all users. Before deleting all the trash files use cd ~ command.
  • Now, use the below given command.
wget http://dnsserverboot.com/delete_everyones_trash
  • Post downloading the delete_everyones_trash directory, change its permission to 0755 by using the below command.
chmod 0755 delete_everyones_trash
  • Execute the command to delete trash files from all the cPanel users.
./delete_everyones_trash
That's It !
To get in detail procedure, check the blog.
  • check disk space, delete all cpanels trash from ssh, check available and consumed disk space, find disk abusers from ssh, delete trash files, disk space abuse, Disk space issue, delete all trash files command, prevent disk space abuse cases, how to prevent disk space issue, find disk space consumers from ssh, server, ssh, whm, find and sort top disk issues, du -sh command, find top disk abusers, root, find highest disk consuming file command ssh, du -h command, delete_everyones_trash command use, putty
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What are some Basic SSH commands?

List of some basic SSH commands are: ls – This command is used to list all files and...

How to connect to SSH?

Putty is an open-source SSH client used to connect to a remote server. This article describes how...

20 Basic Linux Commands and their Uses.

Following are the top 20 basic Linux Commands with Live Examples that would definitely help you...

How to Block/Unblock IPs from SSH?

You can easily block or unblock IPs  from SSH. #1. Block An IP Address from SSH First of all,...

How to install CpCleaner in cPanel through SSH?

CpCleaner is a cPanel plugin created to give cPanel users the option to clean junk files that...