Originally by Katie Hartraft.
As your community grows and you gain more accounts, your server disk space fills up with it. Oftentimes, this can be helped by clearing out old accounts. If you are not looking to decommission accounts or are still running into disk space trouble, you may choose to investigate individual accounts with high disk usage. Below I will cover where to check disk usage for a single cPanel account both within the cPanel dashboard and within SSH/Terminal.
cPanel
cPanel has a tool in the control panel called Disk Usage which is found under the Files section. It can also be found on the right-hand sidebar under Statistics.
Disk Usage will calculate the size of every folder in your account and display it in a nice graph. More often than not you’ll find that the public_html folder, which houses all your web content, is the largest but that could still leave you searching for more information on where within that folder the culprit is.
Thankfully cPanel has provided an update to this feature. If you scroll down, the tool is at the bottom of the page.
Clicking the > symbol in front of the directory you wish to examine will expand it and show the subdirectories as shown in the example below. Each directory with a > in front of it can be expanded further.
This will help quickly navigate the account and see what type of data is taking up the most space and where.
Command Line
If you would rather not have to go into the cPanel account, you can search through the files in a similar via the command line in Terminal.
Once connected through SSH into the root of the server, navigate to the user’s folder (/home/cpanelusername
) and enter the command ncdu
. The interface given is fairly friendly and will allow you to navigate files using your arrow keys, with directories/files listed largest to smallest.
Because the folders and files are ordered by size we recommend starting at the root of your account and running the tool. You can use the arrow keys to move up or down and enter to navigate into a folder and get a readout of the size of its contents. In our experience, it makes quick work of analyzing disk space issues and finding any opportunities to clear out the cruft. When you’re finished simply hit the q
key to quit.
We’ve added ncdu
to most of our servers but if for some reason it’s not available on your server, put in a support ticket and we’d be happy to make sure it gets added.
If you have concerns about disk usage on your cPanel, you can find recommendations for managing your usage in this article.