The Quota command for linux Disk Quota (1)

Source: Internet
Author: User

In network management, due to limited hardware resources, you often need to set a linux Disk Quota for multiple users of servers. This function is more necessary for public multi-user servers to be free or charged. Quota is a tool for implementing linux disk quotas in RedHatlinux.

Quota Installation

The official RHLinux CD/RedHat/RPMS directory contains different versions of quota packages. You can use lsquota * to view related information, such as the version number. Of course, you can easily obtain the full name of the software package through the Tab key, and install it using the following command:
Rpm-ivhquota-2.00pre3-7.i386.rpm

Of course, the version number provided here is only for convenience. This version is provided along with RH7. For updated versions, follow the official site of RedHat. After the software package is installed, you can configure the disk quota.
Run rpm-qlquota

Configure the system's linux Disk Quota
First, the disk quota is regional. We can determine which partition is used for the linux disk quota, and which partition does not need to be configured ). Generally, as a web virtual host server,/home And/www or similar) are partitions for users to store resources. Therefore, you can set a linux Disk Quota for these two partitions.

Assume that we need to implement user-level restrictions on/home partitions, and assign a user quota for each group to/www.
Step 1: vi/etc/fstab.
Find the row corresponding to/home And/www, for example:
/Dev/sda5/homeext2defaults12
/Dev/sda7/wwwext2defaults12

To implement user-level linux Disk Quota in/home, modify the mounting option field of sda5 as follows:
/Dev/sda5/homeext2defaults, usrquota12

Note: It's usrquota. Similarly, we can modify the/www line as follows:
/Dev/sda7/wwwext2defaults, maid

For example, edit/etc/fstabLABEL = // ext2defaults, usrquota

Note: Each line of the/etc/fstab file consists of six fields:
The comment of the first field: file system partition) is similar to the volume label );
The second field is the mount point of the file system;
The third field: the disk quota of the file system type can only be implemented on the ext2 file system );
The fourth field is used to mount the file system. If you only want to implement the user-Based Disk Quota, add the usrquota keyword. If you only want to implement the group-Based Disk Quota, add the keyword "maid, if both are required, all data is written and can be separated by commas.
The fifth field indicates whether the file system partition is read-only. If it is 0, it indicates read-only, and 1 indicates that it can be read and written.
Field 6: The check sequence when the system starts to execute fsck.
Note: note the spelling here: usrquota and kgquota. Do not write them as userquota and groupquota.

Use quotacheck to generate in single-user mode. user or. group file quotacheck your directory example: quotacheck/; quotacheck/home if the single user mode reports an error, umount your device/dev/hda * and then execute OK, restart the system, if everything is normal, quota will start to work normally.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.