How Can You Check Server Disk Space Usage

This article will help you regarding server disk space usage and how to regulate it.

We all have encountered problems while opening our website, due to some kind of glitch or problem. Having an error while opening our website is a common problem when you log into cPanel or check your email.

It may happen due to server problems like server-down or internet-down. Sometimes it happens because your server has reached its disk space limits and you cannot create your current files or write them.

If you want to check and find out the overall disk usage on your server, then you can use the following command which will help you. df –h

You will see an output similar to this

 [[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 160G 160G 20K 100% /

You can also monitor your inode usage. If you have reached 100% inode usage, then you will not be able to create new files or directories and you will be alerted that your space is full.

If you want to check the entire usage on your server, you can use the command: df -i

You will see an output similar to this  

 [[email protected] ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/vda1 988264 985843 2421 100% /

The df command shows you that if you are near your disk’s limits or not. Moreover, if you want to see whether all your disk space or inodes are being used or not.

 If you want to track your usage to see how much has been used then you can use the du command to check.

The following du command will crash the disk usage for each directory within/ and will help you to read and understand.
 [[email protected] ~]# du -h --max-depth=1 / | sort -hr
160G /
100G /backup
42G /home
8.4G /usr
6.8G /var
2.7G /opt

You can use du to view inode usage. 

[[email protected] ~]# du --inodes --max-depth=1 / | sort -hr
985843 /
579631 /home
364933 /home
163487 /usr
17238 /opt
11128 /var
3010 /etc
2429 /root

df and du are the best methods to find out the disk usage as you only have access via SSH. If you want to know more about how to manage your hard drive space, then please check out our cPanel tutorials.