How to find what is using the most disk space on my server

If you notice you are not able to connect to your cPanel, Webmail, or WHM and your website is slow and giving errors, your server may be maxed out on the disk space. A common error you may see is like the following when going to your cPanel.

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.

Important! This is for VPS or Dedicated server customers only. If you are getting this error and you are not on a VPS or a Dedicated server, you will need to contact tech support to have our systems support check the server disk space.

You can check your Disk space usage through shell or you can check the disk space through the WHM. The purpose of this article is to show you how to check the disk space through shell.

How to view your overall disk size and usage

Checking disk space through Shell

You can check your disk space usage through the Shell Command line by typing the following command in your shell client.

df -h

You will get a similar to the following output.

root@vps#### [~]# df  -h Filesystem            Size  Used Avail Use% Mounted on /dev/vzfs              39G   38G  858M  98% / none                  512M  4.0K  512M   1% /dev

This Output shows that out of the 39 gigs of total disk space, 38 gigs are used with 858mb of space left over. This leaves the server at 98% disk space. This is enough to cause cPanel login failures, FTP file upload errors, and slow website issues. At this point you will need to remove some of the files from the server to bring the server back to normal operation.

Using the Web Host Manager

If you are not familiar with using command line, you can look at your disk space usage through the WHM . The WHM will show you the accounts with the highest usage. For more information on checking your Disk space through WHM, see our article on How to Monitor Disk Space and Bandwidth Usage in WHM. Unfortunately, you cannot remove files through the WHM, you will need to access the cPanel File Manager for the account that has the large disk space usage and remove the files / folder through File manager.

How to find files with a certain size

There are two commands you can use to check which folder files are taking up your disk space. You can use the “find” or the “du” command. Below explains the two commands you can use.

Important! You must have permission to access the files you are searching for. If not you will get permissions errors.

Finding all file sizes with the “du” command

The following command will display all files and folders sorted by MegaBytes.

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

You should see an output of all your folders with the size of them in megabytes similar to the following:

0 MB ./.htpasswds 0 MB ./.trash 0 MB ./public_ftp 0 MB ./etc 0 MB ./.fontconfig 0 MB ./.cpanel 0 MB ./mail 4 MB ./tmp 1173 MB ./public_html 1224 MB .

This output shows that all files over 1 MB are in the /public_html. You can run this command on a directory basis to find folders that are large. Also, this command can be customized to refne your search.

Finding specific file sizes using the “find” command

Below is the “find“command that looks for specific files in the “home” directory. The following script is finding files that are 500000k or larger

find /home -type f -size +500M -exec du -h {} \;

The previous command will output a similar result like the following.

/home/userna5/public_html/error_log: 514M /home/userna5/backup-userna5.tar.gz: 738M

Here you can see that there is a backup that is 738MB large. You can find your backup files that are no longer needed and remove them to free up space.

If you cannot fix the disk space issue on your server, you can have tech support look into the matter for you. If you do not have any space to free up and cannot find files to remove, you can always upgrade your hosting plan to a plan with a larger disk.

15 thoughts on “How to find what is using the most disk space on my server

  1. If they say you aren’t out of space then its probably an inode capacity that you are reaching.  Set up a third party service like drop box to push files to after a certain time (monthly, weekly), you can tell them to run a cron job to push these files over there. Hope that helps!

  2. Hi!

    Thanks for the wonderful article. I am a wordpress user without coding skills. But I have been creating sites using Themes and plugins available. And so I have no idea how files get accumulated everytime I use themes and plugins and my server shows that the public html folder is full. When I spoke to the Server people they said you haven’t used up your space but the NUMBER OF FILES IS HIGH. They told me to remove all unnecessary files. Can you please enlighten people like me on things we need to keep in mind to reduce the number of unnecessary files. Any tips or tricks to do that without using coding? I will be extremely happy.

    1. If you want to keep the number of files down, then you simply need to keep the number of loaded themes to a minimum. Themes and some plugins will cause the number graphic files to multiply. If you’re not using a plugin, then make sure that you deactivate it and the delete it from your installation.

    1. Hello Vishesh,

      If you are logging into SSH and getting permission errors, then it may be related to security or ownership of that particle file/folder. If you’re not logged in as a root user, then you may not be able to see everything. You can only obtain root access with VPS and Dedicated hosting accounts.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  3. my domain is example.in how may check my domain web space ,how uses and how free space in my site reply please…….

  4. Very helpful… there were some hidden files which caused disk space discrepency in my case. This is bang on.

  5. Receiving some errors???

    root@server-1 [/]# du –max-depth=1 | sort -n | awk ‘BEGIN {OFMT = “%.0f”} {print $1/1024,”MB”, $2}’
    du: cannot access `./proc/4583/task/4583/fd/4′: No such file or directory
    du: cannot access `./proc/4583/task/4583/fdinfo/4′: No such file or directory
    du: cannot access `./proc/4583/fd/4′: No such file or directory
    du: cannot access `./proc/4583/fdinfo/4′: No such file or directory
    du: cannot access `./proc/29976/task/29985/fd/418′: No such file or directory
    du: cannot access `./proc/29976/task/4816′: No such file or directory

    1. Hello Hamza,

      The error you are receiving is due to the process not being able to find specific files as they do not exist. Are you one of our customers? If so, are you on a VPS or Dedicated server? If so, you may want to contact our Live Support as this command should run fine for you.
      Kindest Regards,
      Scott M

Was this article helpful? Join the conversation!