Knowledgebase: Linux

How to Evaluate Disk Usage on a Linux VPS

Posted by on September 04 2015 03:41 PM

The following commands will assist you in evaluating or freeing additional disk usage on a Linux server. You will need to connect to your server via SSH to run the following commands.

  • Get an overview of available and used space. In this example, the primary partition /dev/sda3 is using 37Gb out of the 56Gb allocation

df -h

  • Get a break-down of each root level folders usage.

du -hs /*

  • Show the top five root level folders by disk usage.

du -sm /* | sort -rn | head -n 5

  • Find Cpanel Site Logs Over 10Mb.

find /home/*/access-logs/* -size +10M -exec ls -lh {} \; | awk '{print $5 , $9}'

  • Delete Cpanel Site Logs Over 10Mb.

find /home/*/access-logs/* -size +10M -exec rm -f {} \;

  • Find Apache Site Logs Over 10Mb.

find /usr/local/apache/domlogs/* -type f -size +10M -exec ls -lh {} \; | awk '{print $5 , $9}'

  • Delete Apache Site Logs Over 10Mb.

find /usr/local/apache/domlogs/* -type f -size +10M -exec rm -f {} \;

  • Find Server Logs Over 10Mb.

find /var/log/* -size +10M -exec ls -lh {} \; | awk '{print $5 , $9}'

  • Delete Server Logs Over 10Mb.

find /var/log/* -size +10M -exec rm -f {} \;

  • Show disk usage for each site.

du -sm /home/* | sort -rn

If you have any further questions that were not answered in this article, please contact us.

(1 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Copyright © 2016 HostMySite