How to determine what is using the most disk space on my Linux server?

There are times when you receive following error while accessing the cPanel WebMail or WHM. You should have a look with VPS disk space and make sure that you have not maxed out on the disk space. 

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.

If you have root access to your Linux VPS, you can check disk space usage either via SSH or WHM.


Check disk space usage via SSH


You can easily check disk space usage from SSH by issuing the following command.

df -h

Check Diskspace

You will get output similar to above. An output indicates that out of 25 GB of total disk space 6.9 GB Diskspace is used and 17 GB is FREE. In this particular case, significant amount of free disk space is available so you do not need to remove any data to release the disk space. We have come across several incidents where customers used 99% of disk space and locked themselves out from all access. Here are some useful variants of the df command.

df -a  //  It displays the file system disk usage and their memory utilization.

df -k  //  It displays the file system information and usage in 1024-byte blocks.

df -m //  It displays the information of file system usage in MBs (MegaBytes).

df -i   //  It displays the information of inode numbers and their percentage in file system. 


Find files with a certain size


To determine which folder or files are taking up your disk space, command du can be used with different variations. The following command will display all files and folders sorted by MegaBytes at current location.

du --max-depth=1 | sort -n | awk 'BEGIN {OFMT = "%.0f"} {print $1/1024,"MB", $2}' 
You should see an output of all files and folders with their size in MegaBytes as follows.

Check Files in MBs

Similarly, you can use variations of this command to list all files and folders over 1 GB as follows. To run this command on specific directory, first you’ll need to navigate to that directory using cd command.

du --max-depth=1 | sort -n | awk 'BEGIN {OFMT = "%.0f"} {print $1/1024,"GB", $2}'  

Here are some more uses of du command.

du  /home/directory-name  // It gives the disk usage summary of directory /home/directory-name and each of its sub directories.

du -h /home/directory-name  //  It gives the results in Human Readable Format that means you can see sizes in Bytes, KBs, MBs and GBs.

du -sh /home/directory-name  //  It gives grand total disk usage size of specific directory.

du -a /home/directory-name  // It gives the disk usage of all the files and directories in specified directory.

du -ah /home/directory-name  // It displays disk usage of all files and folders in specified directory in human readeable format.

du -ha --time /home/directory-name  // It displays the disk usage of all files and folders sorted by the modification time.


Check disk space usage from WHM


If you are not comfortable with shell commands, you can always use WHM. From WHM, you can monitor the cPanel accounts with the highest disk space usage. See our article on how to check disk space usage of cPanel accounts via WHM. Note that you are not allowed to remove any files from WHM. To remove the files, you will have to access individual cPanel account’s File Manager that has the large disk space usage.
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

Do You Provide TUN/TAP On VPS Hosting?

Typically, TUN/TAP is used when you want to utilize VPN services from your VPS. Windows VPS...

How to Install SHOUTCast Radio Server on Linux VPS?

This tutorial will assist you to install SHOUTcast Distributed Network Audio Server (DNAS 2.0) in...

How to Manage Linux Cloud VPS From Client Area?

This article will assist you to manage your Linux Cloud VPS from client area (though you will...

How Do I Create Multiple Reverse DNS Records On Same IP Address?

Each IP address should have single reverse DNS (rDNS). Also, your rDNS hostname should resolve...

Fix :: SSH Error: Starting sshd: Missing privilege separation directory: /var/empty/sshd

Problem Statement Could not connect to Linux machine through SSH. Error Message While starting...