
Managing Resources
52
Setting Up Second-Level Disk Quota Parameters
In order to work with disk quotas inside a VPS, you should have standard quota tools installed:
# vzctl exec 101 rpm -q quota
quota-3.12-5
This command shows that the
quota
package is installed into the Virtual Private Server. Use
the utilities from this package (as is prescribed in your Linux manual) to set OpenVZ second-
level quotas for the given VPS. For example:
# ssh ve101
root@ve101's password:
Last login: Sat Jul 5 00:37:07 2003 from 10.100.40.18
[root@ve101 root]# edquota root
Disk quotas for user root (uid 0):
Filesystem blocks soft hard inodes soft hard
/dev/simfs 38216 50000 60000 45454 70000 70000
[root@ve101 root]# repquota -a
*** Report for user quotas on device /dev/simfs
Block grace time: 00:00; Inode grace time: 00:00
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 38218 50000 60000 45453 70000 70000
[the rest of repquota output is skipped]
[root@ve101 root]# dd if=/dev/zero of=test
dd: writing to `test': Disk quota exceeded
23473+0 records in
23472+0 records out
[root@ve101 root]# repquota -a
*** Report for user quotas on device /dev/simfs
Block grace time: 00:00; Inode grace time: 00:00
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root +- 50001 50000 60000 none 45454 70000 70000
[the rest of repquota output is skipped]
The above example shows the session when the
root
user has the disk space quota set to the
hard limit of 60,000 1Kb blocks and to the soft limit of 50,000 1Kb blocks; both hard and soft
limits for the number of inodes are set to 70,000.
It is also possible to set the grace period separately for block limits and inodes limits with the
help of the
/usr/sbin/setquota
command. For more information on using the utilities
from the
quota
package, please consult the system administration guide shipped with your
Linux distribution or manual pages included in the package.