172
edits
Changes
Table of contents, incondistent quota, other
The aim of this article is to understand where the numbers that are shown by <code>stat</code>/<code>df</code> utils in [[VE]] come from.
== Conventions and Notations ==
Consider typical OpenVZ setup, where <code>ext2</code> separate filesystem is mounted on <code>/vz</code>. <code>ext2</code> is called ''underlying filesystem'' in such situation.
command to get information we need, and later discuss df output.
-->
: If quota is off for [[VE]] (DISK_QUOTA=no), the total amount of space, that [[VE]] potentially can acquire, equals amount of total space on partition. Certainly some space can be used by other [[VE]]s, but potentially [[VE]] can have all the space on device. Number of free blocks for [[VE]] equals number of free blocks on partition. Note, that it implies that [[VE]] root user, can fill all the space, including the space, that is reserved for root user of [[HN]]. This is why, you shouldn't reside [[VE]]s private areas on root filesystem of your [[HN]]. Amount of available disk space for [[VE]] equals the number of available blocks for underlying filsystem. Thus, we have the following relationships:
:: <math>total_{simfs}</math> = <math>total_{ext2}</math>
: thus in [[VE]] you obtain information about disk usage of partition, but not disk usage of [[VE]].
: If quota is on, amount of disk space that [[VE]] potentially can acquire should be equal quota barrier:
:: <math>total_{simfs} = quota_{barrier}</math>
:: <math>free_{simfs} = quota_{barrier} - quota_{used}</math>
: This is the most interesting and difficult to explain case. Nevertheless I tried to do it. So, our assumption is that:
:: <math>quota_{barrier} - quota_{used} > free_{ext2}</math>
:: <math>avail_{simfs} = quota_{barrier} - quota_{used}</math>
The table below summarize summarizes all possible cases.
== Cases Conclusion ==
So we have three basic variants. Variant number one is not good, because [[VE]] administrator can't get information about [[VE]] disk usage and [[HN]] administrator can't limit [[VE]] disk usage. Variant three is not good 'cause we have some weird (but logical) values in <code>df</code>/<code>stat</code> output in [[VE]], e.g. total disk space can decrease. Variant two is perfect. How can we provide this varaint always take place? Here is the simple rule:
Even if you want [[VE]] to be unlimited, consider reasonable values. Use the following formula:
:: <math>\sum_{i=1}^Nq_i = \le S - s</math>(5)<math>q_i</math> - quota barrier for [[VE ]] <math>i</math>
<math>S</math> - total amount of space on underlying filesystem
<math>s</math> - amount of space used by not [[VE]]s private area: templates, locks, etc.
{| border="1" cellpadding="5" cellspacing="0" align="center"
| colspan="2" | Quota off
| <math>total_{simfs} = total_{ext2}</math>
<math>avail_{simfs} = avail_{ext2}</math>
|}
TODO: Add Roma's images
TODO: Add examples with stat/df