Managing your disk usage


  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: SSH, Account Center access
  • Applies to: Shared Hosting
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: SSH
  • Applies to: Legacy DV & VPS Hosting
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: SSH, root access
  • Applies to: VPS Hosting
    • 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.

Advanced Support can help!

If you're having trouble with the steps in this article, additional assistance is available via Advanced Support, our premium services division. For more information on what Advanced Support can do for you, 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 in VZ7 Power Panel

LEGACY PRODUCT:
The information in this article only applies to Legacy DV & VPS Hosting products. This includes: DV w/SSDs (CentOS 7), DV w/SSDs (CentOS 6), DV, DV Developer, & dv 4.0. Be sure to check the service type in your Account Center before continuing with the instructions below:
legacydv-service.png

  1. Log into your the Parallels Power Panel. For instructions on how to access, please see: How do I access my Virtuozzo Power Panel.
  2. Your total disk space will be viewable on the left-hand side under Storage.
    vps-space_vz7.png

NOTE:
For VZ7 servers have the ability to see the total disk space usage. However, for file removal, we advise using SSH or SFTP.

View disk space in VZ6 Power Panel

  1. Log into your the Parallels Power Panel. For instructions on how to access, please see: How do I access my Virtuozzo Power Panel.

    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 VPS server via SSH you can type the following:

sudo df -h

The first column displayed is the device, in this case your VPS. 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.

sudo 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.

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

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

sudo du -csh

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

sudo 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.


sudo 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 VPS. 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.

View disk space from cPanel

  1. Log into cPanel
  2. Under Files, select Disk Usage:
    shared-manage_disk-01.png
  3. View the report that has been generated for your Shared Hosting.
    shared-manage_disk-02.png

NOTE:
These figures may not reflect recent changes to your account’s disk usage.

View disk space from SSH

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:

du -m

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

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);'