How to determine what is using the most disk space on a 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 the specific directory, first, you’ll need to navigate to that directory using the 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

How to set File Upload Size limit in Apache?

As we know Apache is an open-source and free web server. Here, we will configure apache to set...

How To install Nginx on CentOS 7?

Nginx is a Web server that can be installed on Linux Server. You may have heard about Apache Web...

How to enable cPanel’s Official Let’s Encrypt certificate on WHM/cPanel?

cPanel provides a Free SSL Certificate called AutoSSL Certificate. AutoSSL provides SSL...

R1Soft : An error occurred while loading the hcpdriver module

R1soft CDP backup allows for full server backup and you can use it to perform the bare metal...

How to add user to sudo group in a Linux VPS?

With Sudo you can provide special privileges to any user or group. In Linux, there are few...