Set Disk Quota (second edition)
Set Disk Quota
Case:
/Test directory 777 50 m/user
1. Enable the partition Disk Quota Function
Temporary settings: Run mount-o remount, usrquota/test
Permanent settings: edit the/etc/fstab file and mark the usrquota [user quota] Or kgquota [user group quota, not commonly used] on the Mount attribute.
/Dev/sdb1/test ext4 defaults, usrquota 1 2
2. Create a quota database
Quotacheck-cvuga [quota, quota, quota]
-C create
-V: Show Details
-U creates a detection user quota
-G: create a user group quota for detection.
-A: detects all partitions.
Quotacheck-cvu/test # create only the user quota, and accurate to/test Partition
After you run this command, two files, aquota. user and aquota. groups, will be created.
-If SELinux is enabled, the command may fail to be executed.
Solution-Disable SELinux
Setenforce 0
Getenforce
Then run quotacheck-cvu/test.
OK!
3. Enable the quota Function
Quotaon [partition name]
Example: quotaon/test
[Disable the quota function: quotaoff partition name]
Iv. edit user quota
The edquota user name enters the user quota editing mode.
For example, edquota hadoop
Format description: blocks (kb) soft hard limits the size of the user's Space
Inodes soft hard limits the number of files created by the user]
Soft limit: defines the amount of disk space that a user can use. When the user exceeds this limit, the user will receive a warning that the quota is exceeded.
You can use edquota-t to set the grace period.
Grace period: defines the duration for users to use their file systems under Soft Limits
Hard limit: when a user attempts to store a file in a directory that has exceeded the limit value, the user reports a file system error and cannot create a file.
In fact, only the limit in blocks can be set: hadoop users can only use 50 M, as shown in
[Edquota-g user group name edit user group quota]
5. If multiple users need to copy the user quota
Edquota-p template user copying user 1 copying user 2... copying user n
Vi. Detection
VII. View quota Information
Quota [user name] # view the user's quota usage. You can view your disk quota without adding a user name.
Repquota-a or repquota/test # The administrator can view the quota information.