
Managing Resources
48
What are Disk Quotas?
Disk quotas enable system administrators to control the size of Linux file systems by limiting
the amount of disk space and the number of inodes a Virtual Private Server can use. These
quotas are known as per-VPS quotas or first-level quotas in OpenVZ. In addition, OpenVZ
enables the Virtual Private Sever administrator to limit disk space and the number of inodes that
individual users and groups in that VPS can use. These quotas are called per-user and per-group
quotas or second-level quotas in OpenVZ.
By default, OpenVZ has first-level quotas enabled (which is defined in the OpenVZ global
configuration file), whereas second-level quotas must be turned on for each Virtual Private
Server separately (in the corresponding VPS configuration files). It is impossible to turn on
second-level disk quotas for a Virtual Private Server if first-level disk quotas are off for that
Virtual Private Server.
The disk quota block size in OpenVZ is always 1024 bytes. It may differ from the block size of
the underlying file system.
OpenVZ keeps quota usage statistics and limits in
/var/vzquota/quota.
vpsid
- a
special quota file. The quota file has a special flag indicating whether the file is “dirty”. The file
becomes dirty when its contents become inconsistent with the real VPS usage. This means that
when the disk space or inodes usage changes during the VPS operation, these statistics are not
automatically synchronized with the quota file, the file just gets the “dirty” flag. They are
synchronized only when the VPS is stopped or when the HN is shut down. After
synchronization, the “dirty” flag is removed. If the Hardware Node has been incorrectly brought
down (for example, the power switch was hit), the file remains “dirty”, and the quota is re-
initialized on the next VPS startup. This operation may noticeably increase the Node startup
time. Thus, it is highly recommended to shut down the Hardware Node properly.
Disk Quota Parameters
The table below summarizes the disk quota parameters that you can control. The
File
column
indicates whether the parameter is defined in the OpenVZ global configuration file (G), in the
VPS configuration files (V), or it is defined in the global configuration file but can be
overridden in a separate VPS configuration file (GV).
Parameter
Description
File
disk_quota
Indicates whether first-level quotas are on or off for all VPSs or for a
separate VPS.
GV
diskspace
Total size of disk space the VPS may consume, in 1-Kb blocks.
V
diskinodes
Total number of disk inodes (files, directories, and symbolic links) the
Virtual Private Server can allocate.
V
quotatime
The grace period for the disk quota overusage defined in seconds. The
Virtual Private Server is allowed to temporarily exceed its quota soft
limits for no more than the
QUOTATIME
period.
V
quotaugidlimit
Number of user/group IDs allowed for the VPS internal disk quota. If
set to 0, the UID/GID quota will not be enabled.
V