Search Engine: Elastic

Article ID: 115085, created on Nov 1, 2012, last review on Sep 27, 2016

  • Applies to:
  • Plesk Automation

Question

Disk usage for a domain/webspace is calculated incorrectly by Plesk Automation. How do I find where the miscalculation occurred?

Answer

The normal condition for disk usage values is as follows:

In CP = in database = on the file system

Let us check the disk usage value in all three places, one by one:

In the Customer Control Panel:

The disk usage is displayed on the domain's/webspace's Statistics page.

It is the value of the disk usage parameter stored in the domains table of the psa database:

mysql> SELECT SUM(real_size) FROM domains d WHERE d.id = <DOMAIN_ID/WEBSPACE_ID> OR d.webspace_id = <DOMAIN_ID/WEBSPACE_ID> ;
+----------------+
| SUM(real_size) |
+----------------+
|      204771328 |
+----------------+

Note: Replace <DOMAIN_ID/WEBSPACE_ID> with the actual domain/webspace ID.

In the database:

  1. Here, disk usage is divided into four groups of services:

    • Web (httpdocs, httpsdocs, subdomains, web_users, webapps)
    • Mail (mailboxes, maillists)
    • Databases (databases)
    • Other (anonftp, logs, domaindumps, configs, chroot)
  2. Information about the size of the four services mentioned above is stored in the disk_usage table of the psa database. You may use the following query to see it:

    SELECT SUM(httpdocs) + SUM(httpsdocs) + SUM(subdomains) + SUM(web_users) + SUM(webapps) AS `web`, 0 + SUM(mailboxes) + SUM(maillists) AS `mail`, 0 + SUM(dbases) AS `databases`, SUM(anonftp) + SUM(logs) + SUM(domaindumps) + SUM(configs) + SUM(chroot) AS `other` FROM `disk_usage` AS `disk_usage` INNER JOIN `domains` AS `domains` ON domains.id = disk_usage.dom_id WHERE (dom_id = '<DOMAIN_ID/WEBSPACE_ID>') or webspace_id = <DOMAIN_ID/WEBSPACE_ID>;
    +-----------+-------+-----------+----------+
    | web       | mail  | databases | other    |
    +-----------+-------+-----------+----------+
    | 137875456 | 331776|    1568768| 65019904 |
    +-----------+-------+-----------+----------+
    

    Note: Replace <DOMAIN_ID/WEBSPACE_ID> with the actual domain/webspace ID.

  3. Run the modified queries. Normally, the sum of the four values should equal the value in the control panel. If this is the case, proceed to the file system stage.

In the file system:

Here, you should manually calculate the size of the needed folders:

  • Web (httpdocs, httpsdocs, subdomains, web_users, webapps)
  • Mail (mailboxes)
  • Databases (databases)
  • Other (anonftp, logs, domaindumps, configs, chroot)

caea8340e2d186a540518d08602aa065 e0aff7830fa22f92062ee4db78133079

Email subscription for changes to this article
Save as PDF