Managing your disk usage


  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: SSH, Account Center access
  • Applies to: All DV
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: SSH, root access

Introduction

This article will show you various ways to monitor your server's disk space. Each hosting platform has a specific allocated disk space. As your disk usage increases, you may notice a decrease in your server's performance.

  ct-kb-1_1

CloudTech Can Help!
(mt) Media Temple offers disk management services via CloudTech, our premium services division. To learn more, please click here.

View disk usage

You may view your Disk Usage Report at anytime in your Account Center. For detailed instructions and screenshots, please see: Viewing disk usage on your Grid hosting service.

View disk space from Parallels Power Panel

  1. Log into your the Parallels Power Panel. For instructions on how to access, please see: Three Plesk panels.

    Plesk10_virt_defaultscreen

  2. Total disk usage is listed by percentage at the top.

    DV4 PPP DU.jpg

  3. You can also view a breakdown of the disk usage. From the left menu, click on Resources.
  4. Next, click on the Disk tab.

    DV4 PPP DU-Report.jpg

View disk space from SSH

  1. Connect to your server via SSH. For detailed instructions, please read this article.
  2. Change directory:
    cd ../..
  3. Run this command:
    du -sh

    Code translation

    • du: This is the estimate file space usage.
    • -s: Display only a total for each argument.
    • -h: Print sizes in human readable format (e.g., 1K 234M 2G).

    The output will look similar to this:

    gs-example.com:/home/69855$ du -sh
    du: `./users/username%mt-example.com': Permission denied
    du: `./users/username%gs-example.com': Permission denied
    du: `./users/user%gs-example.com': Permission denied
    112M    .

    The "Permission denied" notice is expected since the mail directory is owned by the individual email user, not the Server Administrator.

To check your Total Disk Usage for your entire DV server via SSH you can type the following:

df -h

The first column displayed is the device, in this case your DV. The next three columns show the total size, the amount used, and the amount available.

Filesystem Size Used Avail Use% Mounted on
/dev/vzfs 20G 658M 19G 4% /
simfs 20G 658M 19G 4% /tmp
simfs 20G 658M 19G 4% /var/tmp

TIP:

  • You can use -m for megabytes.
  • You can use -k for kilobytes.

Another useful command is du. Running this command will list all directories with their filesize from your current directory.

du

A good example of using this command would be to view the sizes of your site's directories:

NOTE:

Remember to replace example.com with your domain name.

du -m /var/www/vhosts/example.com/httpdocs

To show the total directory size of the current directory, you can run the following command:

du -csh

To show directory sizes as a listing, you can use the command:

du -sh *

Searching for large files

You can use the following command to search for files over 10MB in size:

NOTE:

To adjust the size of your search replace +10000k with the size you desired, such as the following:

  • 50MB: +50000k
  • 100MB: +100000k
  • 500MB: +500000k
site=`pwd | awk -F/ '{ print $3 }'`; find /home/$site/ -type f -size +10000k -print0 | xargs −0 ls -lhSr | awk '{printf "%*s %s\n", 7, $k":",$9}'

The output will look similar to this:

find: /home/69855/users/username%mt-example.com: Permission denied
find: /home/69855/users/username%gs-example.com: Permission denied
find: /home/69855/users/user%gs-example.com: Permission denied
-rw-r--r--  1 gs-example.com gs-example.com 16M Jun  7  2010 /home/69855/data/squirrelmail/Ny6oAM1v63eLUlQxlEXaOnNHXtSeYukE: /home/69855/data/squirrelmail/Ny6oAM1v63eLUlQxlEXaOnNHXtSeYukE

Again, the "Permission denied" notice is expected since the mail directory is owned by the individual email user, not the Server Administrator.


find / -mount -noleaf -type f -size +10000k -print0 | xargs -0 ls -lhSr | perl -ne '/(\S+\s+){4}(\S+)\s+(\S+\s+){3}(.*)/ and printf("%*s %s\n",7,$2.":",$4);'

Resolving "Out of Disk Space" Errors

  • Large log files are a common cause of unexpected issues on your DV. To prevent this, you can configure log rotation from within Plesk.
  • Failed or overnumerous domain backups are a common cause of unexpected full disk space. Be sure to remove any files related to any failed Plesk backups. We also strongly advise configuring a tight backup rotation to clear out old backups when new ones are made.
  • For information on how to remove large files, please see Common SSH Commands.
  • Consider adding temporary disk space.