Linux Disk Quota configuration (1)

Source: Internet
Author: User
Article Title: Linux Disk Quota configuration details (1 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Quota has always been a useful thing! What should I do? For example, if you have applied for the Internet mail service, you will surely understand what 20 mb of email space and 30 mb of free Webpage space are, how is this 20 MB and 30 MB defined? Haha! That's right. It's just quota! If we want to limit the size of the hard disk used by users, um! Let's take a look!

What is quota?

"Quota" literally means it, huh, huh! It means how many "quotas" are there! If it is used for pocket money, it is similar to the meaning of "how much pocket money is a month. What if it is on the capacity space? In Linux, haha! Is the capacity limit.

In Linux, because it is a multi-person and multi-task environment, many people may use one hard disk space together. If a few of them occupy a large amount of hard disk space, it is bound to compress the power of other users! Therefore, the administrator should grant users the hard disk permission to properly allocate system resources! Avoid protest! For example, the default home directory of our user is under/home. If/home is an independent partition, it would be about 10 Gb, and there would be 30 people under/home, that is, each user should have an average space of MB. However, a user inserted a lot of films under his home directory, occupying 8 GB space. Think about whether it caused inconvenience to other normal users? At this time, you have to rely on the help of "quota!

General Usage of Quota

Quota is usually used in the following situations:

For Web servers, for example, the size limit of each person's webpage space!

For Mail servers, for example, the email space limit for each person.

For File servers, for example, the maximum available network hard disk space for each user.

In Linux, quota is used to manage hard disk space!

Quota usage restrictions

There are several steps to use this module. Let's talk about it separately! In addition, there are several basic restrictions on the use of quota:

For the entire partition only:

In practice, quota restricts the entire partition. For example, if your/dev/hda5 is mounted under/home, all directories under/home will be restricted!

The core must support quota:

The kernel of the Linux system must support the quota module: if you are using the FC4 preset core, hey! Congratulations! Has your system preset the open quota module ?? If you compile the core program on your own, pay special attention to whether you have enabled the quota module? We will describe the core compilation process in the future!

Quota record file:

Currently, the new Linux distributions, such as Fedora Core 4 and SuSE Server9, use the Core version of Kernel2.6.xx. This Core version supports the new quota module and uses the default file (aquota. user, aquota. group) will be different from the old version of quota. user, quota. group! (One more !) The old version of quota can be converted by convertquota!

Valid only for normal identity users:

This is interesting! Not all Linux accounts can set quota. For example, root cannot set quota, because almost all the data in the system is yours! Pai_^

Quota:

The quota Program has the following restrictions on the entire partition:

Soft:

This is the minimum capacity limit. The user's capacity within the grace period can exceed soft, but the disk capacity must be reduced to soft capacity within the grace period!

Hard:

This is the capacity of "definitely cannot exceed! What does it mean compared to soft? Generally, hardlimit is higher than softlimit. For example, if the network disk space is 30 MB, hardlimit is set to 30 MB. However, in order to give users a certain degree of vigilance, therefore, when the used space exceeds 25 MB, for example, if the user uses 27 MB space, the system will warn the user, this allows users to reduce their file volume to 25 MB (that is, softlimit) within the "Grace Period! That is to say, the capacity between soft and hard is actually a wide limit! It can serve as a warning to users!

Grace period:

Then, you can clearly understand what it means! That is, when the space used by your users exceeds softlimit, but it has not reached hardlimit, then within this "grace period, you must ask the user to reduce the disk capacity to softlimit! When the user limits the disk capacity usage to softlimit, the "time-out period" is automatically started, and the user reduces the disk capacity to softlimit, the grace period will be automatically canceled!

Basic quota commands

Before getting started with quota, let's take a look at the instructions to be used by quota! There are basically two types: Query functions (quota, quotacheck, quotastats, warnquota, and repquota), and edit quota content (edquota and setquota ). Let's talk about these basic commands!

/Etc/mtab

No! Didn't it mean to explain the instructions related to quota? Why does it mention the record file actually mounted by the file system? Haha! Note that ~ When we use quota, the system basically searches for "partition with the quota parameter on the system". So ??? Yin Yi and? Why? When using uota, our Filesystem must support quota. In general, we need to edit/etc/fstab and re-mount Filesystem so that the system's Filesystem supports quota! This concept is very important! Pai_^

Quota

[Root @ linux ~] # Quota [-uvsl] [username]

[Root @ linux ~] # Quota [-gvsl] [groupname]

Parameters:

-U: followed by username, indicating that the user's quota limit value is displayed. If username is not connected, the limit value of the executor's quota is displayed.

-G: followed by groupname, indicating that the quota limit value of the group is displayed.

-V: displays the quota value of each filesystem;

-S: The value can be displayed by inode or disk capacity limit;

-L: only the quota value of the filesystem on the current local machine is displayed.

Example:

Example 1: show the current quota limit of the root user:

[Root @ linux ~] # Quota-guvs

Example 2: show the disk quota of the dmtsai user

[Root @ linux ~] # Quota-vs-udmtsai

Note that if you do not have any filesystem supported by quota on your system,

When using these two examples, "No information is listed 』! Do not think an error has occurred!

This command is only used to display the quota limit of a group or user currently! You can use it to observe it!

Quotacheck

[Root @ linux ~] # Quotacheck [-avug] [/mount_point]

Parameters:

-A: All filesystems supported by quota are scanned in the/etc/mtab. After this parameter is added,/mount_point does not need to be written because all filesystems are scanned!

-U: aquota. user is created for users to scan files and directories.

-G: aquota. group is created for the usage of files and directories scanned by groups.

-V: displays information about the scanning process;

-M: force the quotacheck scan.

Example:

Example 1: scan all partitions in/etc/mtab that contain the partitions supported by quota.

[Root @ linux ~] # Quotacheck-avug

Quotacheck: Can't find filesystem to check or filesystem not mounted with quota option.

Don't be nervous. This is a normal phenomenon ~ Because you have not enabled the quota parameter!

We will explain how to issue the quota parameter later. If the scan is normal, it will be as follows:

[Root @ linux ~] # Quotacheck-avug

Quotacheck: Scanning/dev/hdb1 [/disk2] done

Quotacheck: Checked 3 directories and 4 files

[Root @ linux ~] # Ll/disk2

Total 32

-Rw ------- 1 root 6144 Sep 5 14: 56 aquota. group

-Rw ------- 1 root 6144 Sep 5 14: 56 aquota. user

Drwx ------ 2 root 16384 Jun 25 16:22 lost + found

The first operation of quotacheck may have some error messages, which should be normal!

If you use ls-l to check the mount point supported by quota, if aquota. group and aquota. user appear, the quota record file has been created!

[1] [2] Next page

Related Article

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.