Evaluate Disk Usage on Linux Cpanel Server

The following commands will assist you in evaluating your disk usage on a Linux Server with Plesk.

  • Get overview of available and used space

    df -h

    cpaneldiskoverview

    On this server the primary partition /dev/sda3 is using 37Gb out of the 56Gb allocation

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

    du -hs /*

    cpaneldiskrootlevelusage

  • Show top 5 root level folders by disk usage

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

    cpaneltop5rootlevel

  • You will generally find a majority of disk space that can be freed up in logs.

  • Find Cpanel Site Logs Over 10Mb

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

    cpanelsitelogs

  • 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}'

    cpanelsitelogs

  • 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}'

    cpanelserverlogs

  • Delete Server Logs Over 10Mb

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

  • Show disk usage for each site

    du -sm /home/* | sort -rn

    cpaneldiskeachsite

  • On this server we have managed to free just over 2Gb

    df -h

    cpaneldiskoverviewafter