Set disk quota in 5.Linux
Set disk quota
Summary
Execute in the kernel
Enable on a file system basis
Different policies for different groups or users
Restrict based on block or node
Enforce soft limits (soft limit)
Hard limit (hard limit)
Initialization
Partition mount options: usrquota, grpquota
Initialize the database: quotacheck
Execution
Enable or cancel quotas: quotaon, quotaoff
Edit quota directly: edquota username
Edit directly in shell:
Setquota usename 4096 5120 40 50 / foo
Define the original standard user
Edquota-p user1 user2
Report
User survey: quota
Quota Overview: repquota
Other tools: warnquota
The steps to achieve disk quota are as follows:
1. Enable quota mount option
Vim / etc/fstab usrquota,grpquota
two。 Create a quota database
Quotacheck-cug / home
Setenforce 0
3. Enable the database
Quotaon-p / home to see if the database is enabled
Quotaon / home enable database
4. Set quota entry
Edquota wang
Edquota-p wang mage
Setquota tom 100000 150000 00 / home
5. Test
Quota wang
Repquota / home
Dd
Examples are as follows:
It is best to create a partition before operation, then format it, and then mount it to the home directory under the root, so that the home directory is independent on a partition.
1) enable disk quota mount option
Execute mount-o remount to take effect again
2) create a quota database
3) enable the database
Quotaon-p to see if the database is enabled
Quotaon enables the database
Quotaoff disables database
4) set quota entry
Edquota username
Edquota-p username1 username2 (copy quota information for user 1 to user 2)
Setting quota information in non-interactive environment with setquota command
5) Test
Use the quota command and requota command to view