当 Plesk 用户创建一个订阅时,Plesk 会开始计算其使用的磁盘空间容量。潜在消耗磁盘空间的主要有以下几类:

  • (总是包括)网站、FTP 和 web 用户的内容(包括日志文件和统计报告)。
  • 数据库
  • 远程数据库。
  • 邮箱。
  • Java 应用程序。
  • 邮件列表。
  • 订阅备份文件。
  • 作为服务器级备份一部分的订阅备份。

本小节阐述 Plesk 如何计算 Linux 和 Windows 上每个部分使用的磁盘空间容量。如果要在计算磁盘空间容量时包括或排除某些选项,请进入 工具与设置 > 服务器设置 页面。

总的磁盘空间使用容量可在 工具与设置 > 总结报告 。总结报告会显示所有订阅使用的总磁盘空间容量。

如果您想要按订阅查看磁盘空间使用情况,请进入  订阅 ,点击订阅名称并切换到 经典 查看模式(点击 image 75739 图标并点击 经典模式 )。主域名、其它域名和子域名的磁盘空间使用情况将会在  磁盘使用  栏中显示。

image 75734

子域名和其它域名内容占用的磁盘空间会算入主域名的磁盘空间使用量中。

子域名或其它域名计算的磁盘空间使用量值通常比较低,只包括域名配置和日志等的系统文件。

变量

接下来我们会使用以下变量简化描述:

  • HTTPD_VHOSTS_D is the absolute path to the directory with virtual hosts.
  • CATALINA_HOME is the absolute path to the Tomcat installation directory.
  • PRODUCT_ROOT_D is the absolute path to the Plesk installation directory.
  • PLESK_MAILNAMES_D is the absolute path to the directory with mailboxes.
  • PGSQL_DATA_D and MYSQL_VAR_D are the absolute paths to the directories with MySQL and PostgreSQL databases correspondingly.

变量值会根据操作系统而变化。在 Linux 上,您可以在 /etc/psa/psa.conf 中找到这些值。

网站内容、匿名 FTP 内容、网站用户的内容

该类别内容总是包括在磁盘空间使用量计算内。

On Windows, the size of website content is the total size of the %plesk_vhosts%\<domain_name> directory excluding these directories:

%plesk_vhosts%\<domain_name>\anon_ftp
%plesk_vhosts%\<domain_name>\<subdomain_name>\anon_ftp
%plesk_vhosts%\<domain_name>\<addon_domain_name>\anon_ftp
%plesk_vhosts%\<domain_name>\web_users
%plesk_vhosts%\<domain_name>\<subdomain_name>\web_users
%plesk_vhosts%\<domain_name>\<addon_domain_name>\web_users

在 Linux 上,网站内容的大小是以下目录的总大小:

HTTPD_VHOSTS_D/<domain_name>/cgi-bin
HTTPD_VHOSTS_D/<domain_name>/error_docs
HTTPD_VHOSTS_D/<domain_name>/httpdocs
HTTPD_VHOSTS_D/<domain_name>/<subdomain_name>
HTTPD_VHOSTS_D/<domain_name>/<addon_domain_name>
HTTPD_VHOSTS_D/system/<domain_name>/pd

在 Windows 上,匿名 FTP 内容的大小是以下目录的总大小:

%plesk_vhosts%\<domain_name>\anon_ftp
%plesk_vhosts%\<domain_name>\<subdomain_name>\anon_ftp
%plesk_vhosts%\<domain_name>\<addon_domain_name>\anon_ftp

在 Linux 上,匿名 FTP 内容的大小是以下目录的总大小:

HTTPD_VHOSTS_D/<domain_name>/anon_ftp

在 Windows 上,网站用户内容的大小是以下目录的总大小:

%plesk_vhosts%\<domain_name>\web_users
%plesk_vhosts%\<domain_name>\<subdomain_name>\web_users
%plesk_vhosts%\<domain_name>\<addon_domain_name>\web_users

在 Linux 上,网站用户内容的大小是以下目录的总大小:

HTTPD_VHOSTS_D/<domain_name>/web_users

注解: If the directories mentioned above contain hard links, Plesk includes the size of each link in calculation only once, disregarding the number of the link instances.

We will refer to the total of website, FTP, and web users’ content as WEB_CONTENT in the formula for calculation the total disk space usage.

日志文件和统计报告

在 Windows 上,统计报告的大小是以下目录的总大小:

%plesk_vhosts%\<domain_name>\.plesk\statistics
%plesk_vhosts%\<domain_name>\<subdomain_name>\.plesk\statistics
%plesk_vhosts%\<domain_name>\<addon_domain_name>\.plesk\statistics

在 Windows 上,日志的大小是以下目录的总大小:

%plesk_vhosts%\<subscription_name>\logs

在 Linux 上,日志文件和报告的大小是以下目录的总大小:

HTTPD_VHOSTS_D/system/<domain_name>/statistics

We will refer to the total logs and reports size as LOG_AND_STAT in the formula for calculation the total disk space usage.

数据库

先计算单个网站的数据库大小,然后再计入总大小中。

On Windows, the size of MySQL databases is the sum of data length and index length in the following query: SHOW TABLE STATUS FROM <db_name>.

To get the size of MS SQL databases, the system runs the query exec sp_databases for each database under a particular website. The results are summed and multiplied by 1024.

On Linux, the size of PostgreSQL databases is the total size of directories PGSQL_DATA_D/base/<db_oid>. Here db_oid stands for OID of a database under a certain website.

On Linux, the size of MySQL databases is the size of the directory MYSQL_VAR_D/<db_name>. Here db_name stands for a database name under a certain website.

We will refer to the total databases size as DATABASES in the formula for calculation the total disk space usage.

远程数据库

您可以把远程主机上的数据库计入磁盘空间使用量中。在 Linux 上,只会包括远程 MySQL 数据库( 远程 MySQL 数据库 选项)。在 Windows 上,会把任何类型的远程数据库计算在内( 远程数据库 选项)。

邮箱

每个网站的邮箱大小是这些邮箱对应的目录的总大小。邮箱的路径根据信息传输代理不同而不同(例如,MailEnable)。

  • (Windows, MailEnable) <mailbox_dir>\<domain_name>\MAILROOT\<mailbox_name>. The mailbox_dir is stored in the Windows registry HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mail Enable\Mail Enable\Connectors\SF.
  • (Windows, SmarterMail) <mailbox_dir>\Users\<mailbox_name>. The mailbox_dir is obtained by calling the GetDomainSettings method of the svcDomainAdmin web service.
  • (Linux) PLESK_MAILNAMES_D/<domain_name>.

We will refer to the total mailboxes size as MAILBOXES in the formula for calculating the total disk space usage.

Java 应用程序

On Windows, the total size of Java applications is the size of the directory CATALINA_HOME\psa-wars\<domain_name>. Here CATALINA_HOME is the value of the InstallPath parameter in the Windows registry, in HKLM\SOFTWARE\Apache Software Foundation\Tomcat\<Tomcat_version>.

On Linux, the directory with Java content is CATALINA_HOME/psa-wars/<domain_name>.

We will refer to this total as JAVA_APPS in the formula for calculation the total disk space usage.

备份文件

在 Linux 上,可通过以下工具调用获取备份大小:

PRODUCT_ROOT_D/admin/bin/pmm-ras --get-domain-dumps-disc-usage --domain-guid <domain_guid> \
--session-path PRODUCT_ROOT_D /PMM/logs

If the administrator specifies to exclude website backups nested in server-level backups from user quota, the utility is run with an extra option, --skip-server-dumps.

On Windows, the size of backups is cached and is the sum of numbers that follow size_ in file names size_xxxxxx. These size_ files are stored in %plesk_dir%\Backup\<backups_dir>\<domain_name>\.discovered\*\.

The backups_dir is:

/domains – 如果备份是管理员所有。

/resellers/<reseller_username>/domains – if a website is owned by a reseller.

/resellers/<reseller_username>/clients/<customer_username>/domains – if a website is owned by a customer of some reseller.

/clients/<customer_username>/domains – if a website is owned by a customer directly under the administrator.

If the file %plesk_dir%\Backup\dumps_dir\<domain_name>\.discovered\*\ownertype_server exists then the size of website backups nested in server-level backups is not added to the disk space usage.

We will refer to the backups size as BACKUPS in the formula for calculation the total disk space usage.

计算总的磁盘空间使用容量

计算总的磁盘空间使用容量的公式如下:

TOTAL = WEB_CONTENT

+ LOG_AND_STAT (if the log files and statistic reports option is selected in Tools & Settings > Server Settings)

+ DATABASES (depends on the databases option on Linux and MySQL databases and Microsoft SQL databases)

+ MAILBOXES (if the mailboxes option is selected)

+ JAVA_APPS (if the Java applications option is selected)

+ BACKUPS (if the domain backup files option is selected; the value depends on backup files created by the administrator)

Here placeholders (for example, WEB_CONTENT) stand for the totals of respective categories.