1. Related Commands and documents
Quota, Quotacheck, Quotaon, Quotaoff, Quotastats, Quotasync, Repquota, Edquota, Setquota
/etc/fstab
Aquota.user, Aquota.group
2. Syntax description
(1) Quotacheck
Executes the quotacheck instruction, scans the partitions that are attached to the system, and generates Quota.user and Quota.group files under the file system root of each partition, setting the disk space limits for users and groups.
Parameters:
-a scan in the/etc/fstab file, there is a partition that joins the quota settings.
-D Displays the instruction execution process in detail to facilitate troubleshooting or understanding the execution of the program.
-G scans the disk space to calculate the number of directories and files occupied by each group ID.
-R excludes the partition where the root directory resides.
-U scans the disk space to calculate the number of directories and files occupied by each user ID.
-V Displays the instruction execution process.
(2) Quotaon
Execute the Quotaon instruction to turn on user and group space restrictions, the file system root directory of each partition must have Quota.user and Quota.group configuration files.
Parameters:
-A opens the space limit in the/ect/fstab file, adding quota settings to the partition.
-G to open the group's disk space limit.
-U turns on the user's disk space limit.
-V Displays the instruction instruction execution process.
(3) Quotaoff
Execute the Quotaon instruction to turn on user and group space restrictions, the file system root directory of each partition must have Quota.user and Quota.group configuration files.
Parameters:
-A close in the/ect/fstab file, there is a space limit for the partition that joins the quota setting.
-G turn off the disk space limit for the group.
-U closes the user's disk space limit.
-V Displays the instruction instruction execution process.
(4) Quotastats
Display statistics related to the quota subsystem
(5) Quotasync(6) Quota
Executing the quota instruction, you can query the limits of disk space and know how much space has been used for a single user.
Parameters:
-g lists the disk space limits for the group.
-Q Concise list that lists only the parts that exceed the limit.
-U lists the user's disk space limit.
-V Displays the space limit for the user or group on all storage devices that are mounted on the system.
-V Displays version information.
(7) Repquota
Reports on the status of disk space limits and clearly how much space each user or group has used.
Parameters:
-A is listed in the/etc/fstab file, with the usage status of the partitions added to the quota settings, including users and groups.
-g lists the disk space limits for all groups.
-U lists the disk space limits for all users.
-V Displays all space restrictions for that user or group
(8) Edquota
Edquota presets Use VI to edit the quota settings for a user or group.
Parameters:
-U sets the user's quota, which is a preset parameter.
-G sets the quota of the group.
-p< source user name > apply the quota settings from the source user to another user or group.
-T sets the grace period.
(9) Setquota
Set quotas for each user or group to make it easier to set up quotas in batches.
Parameters:
-A read in the/etc/mtab file with the Add quota partition to set
-G to the group's disk space limit.
-U limits the disk space of the user.
-P based on reference user or group disk space limit
(10) command to read/etc/fstab and/etc/mtab
/etc/mtab:quota, Quotacheck, Repquota, Edquota, Setquota
/etc/fstab:quotaon, Quotaoff
3, installation Quota
Yum-y Install quota*
4, open to quota support
#/etc/fstab and/etc/mtab differences
/etc/fstab is a partition that is mounted with the system or mounted using the Mount command
/etc/mtab is the system real-time partition mount information, which dynamically updates the partition mount information according to the Mount, Umount command
It can also be understood that the former is static and the latter is dynamic
If the system has just started to complete,/etc/fstab and/etc/mtab display the partition mount condition is consistent
If you use Umount to unload a partition, the/etc/fstab is inconsistent with the partition's real-time mount, and/etc/mtab is immediately updated based on Umount, consistent with the live mount of the partition
#修改/etc/fstab file, add Usrquota and Grpquota in column 4th
/DEV/MAPPER/VG_IREDMAIL-LV_ROOT/EXT4 Defaults,usrquota,grpquota 1 1
#使用mount重新挂载分区, effective with quota support
Mount-o remount/
#可以使用mount查看 whether/etc/fstab has added support
Mount
#有usrquota, the Grpquota word indicates that support has been added to/etc/fstab
#如果已经开启quota支持, a aquota.user or Aquota.group file is created at the root of the scanned partition
#如果未启用则会报告相关信息
QUOTACHECK-CUGMV/
#生成配额文件后默认并没有开启配额功能
#查看状态
Quotaon-p/or Quotaon-pa
#开启限额功能
QUOTAON-UGV/or QUOTAON-AUGV
-A to/etc/fstab specifies all partitions to be
-U for users
-G for Groups
-V shows the execution process
#关闭限额功能
QUOTAOFF-AUGV/
#-a parameter,/etc/fstab specifies the partition to open quota, otherwise you need to add a partition or directory
Quotaon-augv
#如果aquota. User and Aquota.group are missing or unintentionally deleted, forcing a rescan to generate
QUOTACHECK-CUGMFV/
5, Edquota description
Inode: Store file attribute information, limit the number of files that can be created
Hard: Store the contents of the file, limiting the capacity to use the disk
6. Set disk quota Considerations for group and group users at the same time
If the IT group has a hard limit of 10G, the group has 4 members it1, IT2, it3, and IT4 respectively, with quotas of 4G, 3G, 3G, and 2G.
If It1 uses 3G, It2 uses 3G, IT3 also uses 3G, then IT4 can use up to 1G disk capacity
(IT1+IT2+IT3+IT4) Use capacity <= Group limit 10G
7. Disk Quota Instance
(1) The user limit
To user it soft limit 1024KB, hard limit 2048KB
Settings, soft:1024,:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/0B/wKioL1Vyo0SggmRNAABkWSC2cKM515.jpg "/>
Limit effect, duplicate files larger than 2048KB are rejected:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/0F/wKiom1VyoaWz-H3tAAHNXz7RPFg553.jpg "/>
To limit the effect, copy files less than 2048KB:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/0B/wKioL1Vyo0XCxobuAAI84v8zmng708.jpg "/>
It has a maximum limit of 2048KB capacity for user it, and then limits the number of files created. The original created files are all deleted, because with some hidden files, so inodes display as 5.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/0F/wKiom1VyoaaSUHO6AABpGTRgWws076.jpg "/>
The number of created files is soft limited to 6 and the hard limit is 7:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/10/wKiom1VyoaaCPXfzAABi5dn4p8I887.jpg "/>
When a user creates a 8th file, it is rejected:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/0B/wKioL1Vyo0aTjFq9AAHtVk_7WrA399.jpg "/>
The number of inodes has reached the maximum limit, so it will be rejected:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/10/wKiom1VyoaeS766aAABm56lXWsE794.jpg "/>
While satisfying both the blocks and inodes limits, there is no rejection:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/0B/wKioL1Vyo0exK1jhAACwvdaypTs725.jpg "/>
(2) restrict the user and group simultaneously
Add a system user and add it as a samba user
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/10/wKiom1VyoaigoceGAAF0iuBzH9I201.jpg "/>
For IT group soft limit 2048KB, hard limit 4096KB:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/0B/wKioL1Vyo0fAbtXJAABsN4KfYl8568.jpg "/>
Delete the files created by the user it, and then create 1024KB and 2048KB size files for it1 and it2, respectively:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/10/wKiom1VyoaizbmA3AAGfaDw1F4E598.jpg "/>
To change the file owner to the corresponding user is considered a file created by the user:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/0B/wKioL1Vyo0ijL448AAEVZ6LK6yo327.jpg "/>
The group it hard limit is 4096KB or 4M, while It1 and It2 have already occupied 3M capacity, so user it is rejected when it creates more than 1M files:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/10/wKiom1VyoamCkFvzAAHtQ8oryfc232.jpg "/>
Creating less than 1M files is not denied:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/0B/wKioL1Vyo0nR_PVXAAIZ-o-ol6E353.jpg "/>
Limit the user it soft to 256KB, hard limit to 512KB, and take a look at what priority the group and user limits are:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/0B/wKioL1Vyo0rC1jjxAABmtKks2RE665.jpg "/>
User it creates more than 512KB less than 1024KB file effects:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/10/wKiom1VyoauD5K2gAAImH7hztMo179.jpg "/>
This article is from the "Love On Action" blog, please be sure to keep this source http://1055745601.blog.51cto.com/5003160/1659191
Linux disk quotas