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 set the linux disk quota size

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

Share

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

This article mainly introduces "how to set linux disk quota size". In daily operation, I believe many people have doubts about how to set linux disk quota size. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to set linux disk quota size". Next, please follow the editor to study!

1. Check whether the system supports disk quotas (2.4 and later kernels support disk quotas by default):

[root@rhel ~] # grep CONFIG_QUOTA / boot/config- [TAB key completion]

CONFIG_QUOTA=y

CONFIG_QUOTACTL=y # this means that disk quotas are supported; 2. Modify / etc/fstab:

/ dev/sda3 / mnt/samba ext3 defaults,usrquota,grpquota 1 2 3. Read information from / etc/fstab and mount all partitions:

[root@rhel ~] # mount-a 4. Generate a basic quota file with the quotacheck command:

[root@rhel] # quotacheck-avug quotacheck: Can't find filesystem to check or filesystem not mounted with quota option. # Don't be nervous, this is a normal phenomenon ~ because you have not enabled the parameters of quota!

The quotacheck command checks the file systems with quotas enabled and establishes a table for each file system for the current disk. This table will be used to update the disk usage file of the operating system. In addition, the disk quota files for the file system are also updated.

-a means that all mounted non-NFS file systems in / etc/mtab are checked to determine if quotas are enabled.

-u aquota.user will be created for users to scan files and directories

-g aquota.group will be established for the use of group scan files and directories

-v displays information about the scanning process

-M "forces" quotacheck scanning. 5. Check whether the aquota.user and aquota.group files have been created successfully:

[root@rhel ~] # ll / mnt/samba 6. Use the edquota command to allocate disk quotas:

[root@rhel ~] # edquota-u user [assign disk quotas to system users]

[root@rhel ~] # edquota-u group [assign disk quotas to system user groups]

Filesystem = > File system for quota control.

Blocks = > number of blocks already used (in 1KB) [does not need to be modified]

Soft = > "soft" limit on the number of block used

Hard = > "rigid" limit on the number of block used

Inode = > number of inode already used [no modification required]

Soft = > "soft" limit on the number of inode used

Hard = > the "hard" limit on the number of inode used.

Block limits is a limit on the use of disk space, in KB units, soft refers to the soft limit, hard refers to the hard limit, for example, soft limit is 5MB hard limit is 8MB, when the user user01 use space exceeds 5MB, the system will prompt, but can continue to use space, and when the user user01 use space reaches 8MB, it will restrict the user user01 to continue to use / tmp space.

File limits is a limit for users to create files. Soft and hard are soft limits and hard limits, which are 50 and 80, respectively. When the user user02 creates more than 50 files, the system will prompt, but you can continue to create files. When the user user02 creates more than 80 files, it will restrict the user user02 to continue to create files, but note that the consumer user02 has imposed a disk quota limit in the / tmp directory. So the / tmp directory counts as a file, so user02 can only create a maximum of 79 files. 7. Make a time limit:

[root@rhel ~] # edquota-t

You can set the value of timeleft, here we all set to 2 minutes, repeat the above example, the user user02 creates 60 files, there will be a prompt for quota, but you can still create files, but when we wait 2 minutes, you will find that user02 can no longer create files, here is the role of timeleft, that is, when you exceed the soft limit, set the valid time. 8. Enable disk quota:

[root@rhel ~] # quotaon / mnt/samba

Or

[root@rhel ~] # quotaon-avug 9. Check the disk quota of users and groups:

[root@rhel] # quota-u user

[root@rhel ~] # quota-u group 10. Disable disk quota:

[root@rhel ~] # quotaoff / mnt/samba

Or

[root@rhel ~] # quotaoff-avug other related commands:

# repquota overload quota settings

# quota-v View quota settings

# quota on/off quota on / off

# edquota-p username1 username2 quota cloning

# quotastats to view quota startup

At this point, the study on "how to set the linux disk quota size" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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