In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to install quota in CentOS system". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "how to install quota in CentOS system" together!
1. mount directory join quota
View/home directory mount
The code is as follows:
[root@bogon ~]# df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 2.0G 35M 1.8G 2% /home
The code is as follows:
[root@bogon ~]# mount | grep home
/dev/sda3 on /home type ext4 (rw)
quota file system parameters for users and groups: usrquota, grpquota
The code is as follows:
[root@bogon ~]# mount -o remount,usrquota,grpquota /home
View OK Added usrquota,grpquota
The code is as follows:
[root@bogon ~]# mount | grep home
/dev/sda3 on /home type ext4 (rw,usrquota,grpquota)
Edit the fstab file to mount quota at system startup
The code is as follows:
[root@bogon ~]# vi /etc/fstab takes effect after restart
LABEL=/home /home ext4 defaults,usrquota,grpquota 1 2
remount
The code is as follows:
[root@bogon ~]# umount /home
[root@bogon ~]# mount -a
[root@bogon ~]# mount | grep home
2. quota installation generates usrquota, grpquota two directories
quota check scan of entire system file system with usrquota, grpquota parameters
The code is as follows:
[root@bogon ~]# quotacheck -avug
-bash: command not found
The code is as follows:
[root@bogon ~]# yum install quota
Install quota
The code is as follows:
[root@bogon ~]# quotacheck -avug
Automatically create usrquota, grpquota two directories
The code is as follows:
[root@bogon ~]# ll -d /home/
-rw------- 1 root root 8192 Mar 6 11:58 /home/aquota.group
-rw------- 1 root root 9216 Mar 6 11:58 /home/aquota.user
At this point, due to some need, or under some circumstances, the command "has to" be run:
The code is as follows:
[root@bogon ~]# quotacheck -avug -mf
Parameter-m[M] means: Force to check the quota of the hard disk in "read, write" mode (there is a certain possibility of "writing" data loss, should ensure that no process is writing to this partition. It is recommended to do it in single-user mode.)
The code is as follows:
[root@bogon ~]# quotaon -auvg
Start quota
/dev/sda3 [/home]: group quotas turned on
/dev/sda3 [/home]: user quotas turned on
3. quota limit size setting
myquota1 account Add quota limit Use fixed here Disk size per user is 500 MB
The code is as follows:
[root@bogon ~]# useradd myquota1
[root@bogon ~]# edquota -u myquota1
Filesystem blocks soft hard inodes soft hard
/dev/sda3 80 500000 600000 10 0 0
Copy myquota1 user information to myquota2
The code is as follows:
[root@bogon ~]# edquota -p myquota1 -u myquota2
The code is as follows:
[root@bogon ~]# edquota -g myquotagrp
Edit the total usage size of the myquotagrp group
Filesystem blocks soft hard inodes soft hard
/dev/sda3 160 10000000 12000000 20 0 0
The code is as follows:
[root@bogon ~]# edquota -t
Modify grace time when user files exceed size
The code is as follows:
[root@bogon ~]# quota -uvs myquota1 myquota2
Query usage
Filesystem blocks quota limit grace files quota limit grace
/dev/sda3 80 495M 595M 10 0 0
Disk quotas for user myquota2 (uid 501):
Filesystem blocks quota limit grace files quota limit grace
/dev/sda3 80 495M 595M 10 0 0
The code is as follows:
[root@bogon ~]# quota -gvs myquotagrp
Query myquotagrp usage
The code is as follows:
edquota -g myquotagrp
Filesystem blocks soft hard inodes soft hard
/dev/sda3 160 1000M 1200M 20 0 0
The code is as follows:
[root@bogon ~]# repquota -auvs Query all user usage
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 20 0 0 2 0 0
myquota1 -- 32 495M 595M 10 0 0
myquota2 -- 32 495M 595M 10 0 0
myquotagrp -- 64 1000M 1200M 20 0 0
Statistics:
Total blocks: 7
Data blocks: 1
Entries: 4
Used average: 4.000000
4. quota test
Build a 550MB file using myquota1 and watch the quota result!
The code is as follows:
[root@bogon ~]# dd if=/dev/zero of=bigfile bs=1M count=550
[root@bogon ~]# repquota -auv
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
myquota1 +- 556840 500000 600000 13days 11 0 0
You can see myquota1's grace appearing!
Create another large file with a total capacity of more than 600 megabytes!
The code is as follows:
[root@bogon ~]# dd if=/dev/zero of=bigfile2 bs=1M count=600
du -sk
600000 . The file size has been checked. The set size operation failed.
The code is as follows:
[root@bogon ~]# warnquota Check for warnings
If you want to cancel the disk space limit, you can use the following command, please see:
The code is as follows:
[root@bogon ~]# quotaoff /home
(Remove disk space restrictions.)
The code is as follows:
[root@bogon ~]# quotaon /home
(Disk Space Limit is now enabled.)
PS: Basic usage of quota command
syntax
quota [ -u [ User ] ] [ -g [ Group ] ] [ -v | -q ]
described
The root user can view the restrictions of other users using the-u flag with the optional User parameter. Users without root privileges can view the restrictions of the groups to which they belong by using the-g flag with the optional Group parameter.
Note:
If a particular user does not have files on a file system for which he has quotas, the command displays quota: none for that user. Displays the user's actual quota when the user has files in the file system.
flag
-g Displays the quota for the user group.
-u Displays user limits. This flag is the default option.
-v Displays quotas on file systems that have no allocated storage.
-q Prints a concise message containing only information about file systems that have exceeded their usage quota.
Note:
The-q flag takes precedence over the-v flag.
safety
Access control: This command is owned by the root user and the bin group.
Privilege Control: This program is setuid in order to allow non-privileged users to view personal quotas.
example
(1). To display the quota for user keith, enter:
The code is as follows:
quota
The system displays the following information:
User quotas for user keith (uid 502):
Filesystem blocks quota limit grace Files quota limit grace
/u 20 55 60 20 60 65
(2). To display the quota for user davec as root, enter:
The code is as follows:
quota -u davec
The system displays the following information:
User quotas for user davec (uid 2702):
Filesystem blocks quota limit grace files quota limit grace
/u 48 50 60 7 60 60
file
The code is as follows:
quota.user
Specify user quotas.
The code is as follows:
quota.group
Specify group limits.
The code is as follows:
/etc/filesystems
Contains the file system name and location.
Thank you for reading, the above is "how to install quota in CentOS system" content, after the study of this article, I believe that we have a deeper understanding of how to install quota in CentOS system, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.