In this article we show you how to check the disk space used on our server. This article is for Linux servers. If you have recently changed the disk size of your server and the changes have not been applied, please review our article about extending partitions manually.
See used space on disk
To see the used space on the disk of our server we will connect through SSH and execute:
df -h
It will return a result like this:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 153G 25G 122G 17% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 4.0K 2.0G 1% /dev/shm
tmpfs 2.0G 113M 1.9G 6% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
none 2.0G 4.0K 2.0G 1% /var/tmp
none 2.0G 108K 2.0G 1% /tmp
tmpfs 396M 0 396M 0% /run/user/0
We should look at /dev/sdaX. If the disk percentage used is 100%, it means that the disk on our server is full. One solution is to expand the disk space of our server. Another option is to find out where the space is being used.
Space used by files
We can see which folders are occupying more disk space by running:
du -sh /home/ /opt/ /root/ /var/ /usr/ du -sh /var/log/ /var/tmp/ /tmp/
It will return results like:
571M /var/
164K /home/
4.0K /opt/
671M /root/
1.7G /usr/
152K /tmp/
1.5M /var/log/
24K /var/tmp/
152K /tmp/
Search large files
If we want to search for larger files of 500MB we can execute:
find / -type f -size +500M -exec ls -lh {} \;
If we want to find 1G files is a matter of changing + 500M for + 1G.