|
VPS quota allows you to specify limits on two aspects of disk storage for your
Virtual Private Server:
- the number of inodes a user or a group of users may have;
- the number of disk blocks that may be allocated to a user or a group of users.
To enable VPS quota for all Virtual Private Servers, you need to have:
- freevps kernel (build 1056256121 or higher) installed on the host box
- freevps-tools (freevps-tools-x.x-n package) installed on the host box
- H-Sphere VPS scripts (hsphere-vps-x.x-n package) this is not necessary
- new quota-3.09-1.vps package for Virtual Private Servers installed on all VPS.
Remember that quota-3.09-1.vps package is only for VPS installation!
If hsphere-vps-x.x-n package is installed
H-Sphere VPS upgrade
installs quota-3.09-1.vps on all existing virtual servers,
enables quota on root partition (/) and
configures VPS to turn on/off quotas at VPS start/stop.
To install quota-3.09-1.vps manually, you need to:
To reconfigure quota on Virtual Private Server:
- Enter Virtual Private Server:
if hsphere-vps-x.x-n package is installed
# cd /hsphere/shared/scripts/
# ./vps-enter VPS_NAME
or log into it with SSH:
# ssh root@VPS_NAME (or # ssh root@VPS_IP_ADDRESS)
or use vserver script (if VPS is running)
# /usr/sbin/vserver <VPS_NAME> enter
here VPS_NAME - name of Virtual Private Server (VPS_IP_ADDRESS - VPS IP address)
- If the /dev/hdv1 block special file does not exist, create it:
touch /dev/hdv1
- Modify /etc/fstab
Partitions where quota is not yet enabled normally look like:
/dev/hdv1 / vfs defaults 1 1
To enable user quota on a file system (for example, on the root partition),
add "usrquota" to the fourth column - the one that contains the word "defaults"
(refer to man fstab for details):
/dev/hdv1 / vfs defaults,usrquota 1 1
To enable both user quota and group quota on a file system:
/dev/hdv1 / vfs defaults,usrquota,grpquota 1 1
By default, your Virtual Private Servers are to be configured with user and group quota
enabled on the root partition (/).
- Make sure that the following line is present in /etc/mtab:
/dev/hdv1 / vfs rw,usrquota,grpquota 0 0
- Activate quota software by running quotacheck.
This will generate the files to maintain the quota databases
(refer to man quotacheck for more details):
# /sbin/quotacheck -avugm
Here:
-a - check quota for all mount points specified in /etc/fstab
-m - create quota files
-u - check user quota
-g - check group quota
-f - force check
If quota activation failed, try also to use quotacheck for new quota format -F vfsv0:
Supported formats are:
vfsold - original quota format
vfsv0 - new quota format
rpc - use RPC calls
xfs - XFS quota format
- quotaon and quotaoff
quotaon is used to turn on quota accounting:
# quotaon -augv
Run quotaoff to turn it off:
# quotaoff -augv
These commands are executed at the Virtual Private Server start and stop, respectively.
- Check the quota information for mountpoints:
# repquota -a
or
# quotastats
Building FreeVPS quota
You can build FreeVPS quota on your own box:
Enter to temporary derectory
# cd /var/tmp
Create the directory tree for building quota tools:
# mkdir -p freevps-quota/patches freevps-quota/src.rpm
# cd freevps-quota
Download the required sources:
# wget http://www.freevps.com/download/make_rpm/patches/quota-freevps.patch.gz -P freevps-quota/patches
# wget http://www.freevps.com/download/make_rpm/patches/lkcd-411-rh-2.4.18-27.7.gz -P freevps-quota/patches
# wget http://www.freevps.com/download/make_rpm/src.rpm/quota-3.09-1.src.rpm -P freevps-quota/src.rpm
# wget http://www.freevps.com/download/make_rpm/make_quota_rpm
# wget http://www.freevps.com/download/make_rpm/quota-freevps.spec
Run quota build script:
# su -
# chmod +x make_quota_rpm
# ./make_quota_rpm
New quota package will be located in your Linux package repository, e.g.:
/usr/src/redhat/RPMS
New FreeVPS quota patches will be available at:
http://www.freevps.com/download/snapshots
|