How to implement file system quota under Linux system

Source: Internet
Author: User

1. Quotas, also known as limits, are for partitions, not users or files, and not the entire hard disk;
2. Kernel version must be more than 2.4 to support; see if the kernel supports quotas.
3.root is not restricted by quota, only ordinary users are restricted;
4. Terminology in quotas:
<1> Soft limit: warning limit, can be broken;
<2> Hard limit: Maximum available limit, no breakthrough;
<3> Quota Size: In the size of K units, the number of files in units;
<4> Quota Grace Date: Reduce the hard limit back to the soft limit of the grace time;
5. Quotas can be set for users or groups, respectively, as:
User quota: Usrquota
Set quotas for individual users;
Group Quota: Grpquota
Set quotas for all members in the entire group;
6. Steps for configuring quotas:
<1> #vi/etc/fstab #系统启动时, file systems and partitions that need to be mounted
To mount the/home partition, enable the quota feature and modify the following:
<2> #mount-o remount/home #重新卸载再挂载做配额的分区
#cat/etc/mtab #查看已经挂载的分区是否启用磁盘配额功能
Note:/etc/mtab This file is a partition that has been mounted after system startup.
<3> Quota detection: Detect quotas in the system, create quota files under partitions and write system quota information;
#useradd US1
#quotacheck-cavug
#ll/home #查看/home generates two quota database files
<4> Edit the quota size for a user or group
#edquota-U US1
#edquota-G US1
<5> viewing user and group quota reports
#repquota –a
#repquota-ag
<6> Enable quota feature
#quotaon –avug
<7> Test users ' quotas
#su-US1//Toggle Normal User test user quotas
$CP/bin/*/home/us1//Copy file test quota limit effect
#repquota-A//view quota report
<8> Check that the current directory size is used
#du-H
<9> Modify the grace time of a quota (for the entire partition, the time unit can be days, hours, minutes, seconds)
#edquota-T
<10> quota replication (multiple target users can be specified at the same time)
#edquota-P US1 US2 US3 US4 US5


Let's show you how to implement file system quotas on Linux systems

Create a disk partition/DEV/SDB1

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/84/wKiom1fCURqTFx4ZAACHL_EM63g664.png-wh_500x0-wm_3 -wmp_4-s_3983334119.png "style=" Float:none; "title=" 1 Create a disk partition. png "alt=" wkiom1fcurqtfx4zaachl_em63g664.png-wh_50 "/ >

To see if the partition was created successfully and synchronized

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/84/wKioL1fCURrwMY8eAABQ6nXAJ9k665.png-wh_500x0-wm_3 -wmp_4-s_446459425.png "style=" Float:none; "title=" 2 to see if the creation was successful. png "alt=" wkiol1fcurrwmy8eaabq6nxaj9k665.png-wh_50 "/ >

Formatting/DEV/SDB1 partitions

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/86/84/wKiom1fCURuQolbBAAB2rWY8mNI753.png-wh_500x0-wm_3 -wmp_4-s_1088867422.png "style=" Float:none; "title=" 3 format the partition. png "alt=" wkiom1fcuruqolbbaab2rwy8mni753.png-wh_50 "/ >

Create a/mnt/home temporary mount point

Mount the/DEV/SDB1 under/mnt/home

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/86/84/wKiom1fCURuyCpXFAAANV-4Ltac166.png-wh_500x0-wm_3 -wmp_4-s_306945234.png "style=" Float:none; "title=" 4 is temporarily attached to the home directory of MNT. png "alt=" Wkiom1fcuruycpxfaaanv-4ltac166.png-wh_50 "/>

Migrating/home data to the/mnt/home directory

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/86/84/wKioL1fCURuQJK9yAABLFLt0xa4139.png-wh_500x0-wm_3 -wmp_4-s_711978775.png "style=" Float:none; "title=" 5 migrate home data to the home directory under the MNT directory. png "alt=" Wkiol1fcuruqjk9yaablflt0xa4139.png-wh_50 "/>

Mount the/DEV/SDB1 partition to the/home directory

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/84/wKiom1fCURzgMU96AABGtMTvCM0203.png-wh_500x0-wm_3 -wmp_4-s_902859178.png "style=" Float:none, "title=" 6 mount the partition to the home directory. png "alt=" WKIOM1FCURZGMU96AABGTMTVCM0203.PNG-WH _50 "/>

Temporary mount point prior to uninstallation/mnt/home

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/84/wKioL1fCURyzoju2AAAKuPRX0rY200.png-wh_500x0-wm_3 -wmp_4-s_264448471.png "style=" Float:none; "title=" 7 uninstalls the temporary mount point. png "alt=" wkiol1fcuryzoju2aaakuprx0ry200.png-wh_50 "/ >

Modify the configuration file to automatically mount the boot

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/86/84/wKiom1fCURyDky52AAB4PsV6vTA996.png-wh_500x0-wm_3 -wmp_4-s_1984795491.png "style=" Float:none; "title=" 8 Modify the configuration file to start. png "alt=" WKIOM1FCURYDKY52AAB4PSV6VTA996.PNG-WH _50 "/>

Modify the Fstab file to add Mount options Usrquota,grpquota

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/84/wKioL1fCUR3hNkNvAABVzTq7o0k927.png-wh_500x0-wm_3 -wmp_4-s_2128229894.png "style=" Float:none; "title=" 9 Modify the Fstab file to add Usrquota and Grpquota.png "alt=" to the partition Wkiol1fcur3hnknvaabvztq7o0k927.png-wh_50 "/>

Re-mount to make it effective

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/86/84/wKioL1fCUR2T5G6oAACG8pw_BEQ770.png-wh_500x0-wm_3 -wmp_4-s_2909348688.png "style=" Float:none; "title=" 10 re-mount it to take effect. png "alt=" wkiol1fcur2t5g6oaacg8pw_beq770.png-wh_50 "/>

Create a quota database

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/86/84/wKiom1fCUR2DpQCvAAAZ5i465bg906.png-wh_500x0-wm_3 -wmp_4-s_12125820.png "style=" Float:none; "title=" 11 Create a database. png "alt=" wkiom1fcur2dpqcvaaaz5i465bg906.png-wh_50 "/ >

To see if the quota database is enabled

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/84/wKioL1fCUR7jOWkjAAAV9gLFr_w148.png-wh_500x0-wm_3 -wmp_4-s_3998210100.png "style=" Float:none; "title=" 12 See if the database is started. png "alt=" Wkiol1fcur7jowkjaaav9glfr_w148.png-wh_ "/>

Enable the Quota database

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/84/wKiom1fCUR6iUA9bAAAa2tXsXVM536.png-wh_500x0-wm_3 -wmp_4-s_67911726.png "style=" Float:none; "title=" 13 enable the database and view. png "alt=" wkiom1fcur6iua9baaaa2txsxvm536.png-wh_50 "/ >

Set User Wangcai disk quotas

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/84/wKiom1fCUR7B29lsAAAa32beZDk049.png-wh_500x0-wm_3 -wmp_4-s_1942974894.png "style=" Float:none; "title=" 14 sets the user disk quota. png "alt=" wkiom1fcur7b29lsaaaa32bezdk049.png-wh_50 "/>

View disk quotas for user Wangcai

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/86/85/wKiom1fCUR_AcJITAAAd8rb3rTE136.png-wh_500x0-wm_3 -wmp_4-s_530286732.png "style=" Float:none; "title=" 16 view the user's disk quotas. png "alt=" wkiom1fcur_acjitaaad8rb3rte136.png-wh_50 "/>

To view disk quotas on a partition

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/86/84/wKioL1fCUR-i_CfYAAA0bIyfz2k607.png-wh_500x0-wm_3 -wmp_4-s_2709758872.png "style=" Float:none; "title=" 17 view the disk quotas on a partition. png "alt=" wkiol1fcur-i_ Cfyaaa0biyfz2k607.png-wh_50 "/>

Note: If the following error occurs when you create the quota database

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/86/85/wKiom1fCUSDwFmf_AAFfe3KyCAA245.png-wh_500x0-wm_3 -wmp_4-s_1455905529.png "style=" Float:none; "title=" 18 Create DATABASE times wrong. png "alt=" wkiom1fcusdwfmf_aaffe3kycaa245.png-wh_50 "/>

You can use the following methods to resolve

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/84/wKioL1fCUSDRMWypAACFRIMr58g196.png-wh_500x0-wm_3 -wmp_4-s_781385482.png "style=" Float:none; "title=" 19 solution. png "alt=" wkiol1fcusdrmwypaacfrimr58g196.png-wh_50 "/ >


This article is from the "11798474" blog, please be sure to keep this source http://11808474.blog.51cto.com/11798474/1843493

How to implement file system quota under Linux system

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.