Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make correct CentOS disk quota

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to carry out the correct CentOS disk quota, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.

Correct CentOS disk quota can make CentOS disk work normally, so how to carry out CentOS disk quota?

CentOS disk quota under Linux:

1. Modify the/etc/fstab file. Add usrquota and grpquota to the mount script that mounts the root partition.

Example: #vi /etc/fatab will LABEL =/ / ext3 defaults 1 1 read LABEL =/ / ext3 defaults,usrquota,grpquota 1 1

2. Restart the computer to remount the system so that the modified files take effect. (Restart using init 6 or reboot command)

Example: #init 6 or #reboot

3. Enable CentOS disk quotas, which turns on quotas and sets quotas for that partition.

The command used is quotacheck -cmug / "/"

Partition for which CentOS disk quotas need to be set. Quota then checks all subdirectories and creates two files:quota.user, quota.group

Example: Quotas will be set for the root partition.

#quotacheck -cmug /

4. Set CentOS disk quota values for users or groups.

to the user #edquota -u user1 pair group #edquota -g group1 After entering the above command, the following configuration interface will appear: Filesystem blocks soft hard inodes Detailed source reference: www.itqun.net/content-detail/76119.html soft hard /dev/sha3 100 0 0 13 0 0

quota option explanation: blocks indicates the disk space occupied by existing files,soft indicates the size soft limit hard indicates the size hard limit inodes indicates the number of existing files soft indicates the number soft limit hard indicates the number hard limit.

For example, user1 has a soft limit of 20 files and a hard limit of 30 files. #edquota -u user1 Settings:/dev/sha3 100 0 0 13 20 30

Set detailed CentOS disk quota limits for users and groups. We can use the edquota command to set disk quotas.

edquota command format: edquota -u User name edquota -g group name For example, configure disk quota limit for user zhangsan, execute edquota command, and open user quota configuration file edquota -u zhangsan

5. Modify CentOS Disk Quota Grace Time

Command: #edquota -t where block grace period indicates grace time in disk size. inode grace period indicates the grace period for the number of files. Units are: days Days, hours Hours, minutes, seconds The default in RHEL4 is seven days.

6. Make quota settings for accounts that have CentOS disk quotas set. (Quota can be set in batches)

Command:#quota -p user1 user2 …. user is the user whose quota has been set, and the latter is the user who needs to be set.

Other Notes:

Quotaon is used to turn on quota calculations; quotaoff is used to turn them off. They are performed at system startup and shutdown.

Quota : Displays the user's disk usage and caps.

Description of parameters

-g Displays the group quota for the user's group

-u Display user quota

-v Shows file system conditions with no space allocation

-q Displays brief information about usage exceeding quota

7. Execute quotaoff -av

Detailed source reference: www.itqun.net/content-detail/76119_2.html

After that, execute quotaon -av to make the disk quota set effective

Turn off disk quota quotaoff -zv (quotaoff -av followed by quotaon -av to make the set disk quota effective) Command: quotaon -augv Directory Name Parameters: -a Open the space limit for partitions with quota settings in the/ect/fstab file. -g Turn on disk space limits for groups. -u Turn on disk space limits for users. -v Display instruction instruction execution process.

8. View CentOS disk quota usage repquota -a

9. note

If the enterprise has a large number of employees, then configuring CentOS disk quotas for each employee individually like this will increase the difficulty of our management ~ Here we can create a simple script to scientifically limit the CentOS disk space of all users to 200MB.

Create a quota.sh disk quota script file in/etc/mail/directory vim /etc/mail/quota.sh [root@dns ~]# vim /etc/mail/quota.sh #!/ bin/bash for i in zhangsan lisi wangwu honglin1 honglin2 do setquota -u $i 0 200000 0 0 /var Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report