In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use the quota command in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The Linux common command quota command is used to display disk quota information for users or workgroups. The output information includes disk usage and quota limits.
Quota shows the space and limits used by the disk
Syntax quota (options) (parameters) option-g: list the group's disk space limits;-Q: concise list, only those that exceed the limit;-u: list the user's disk space limits;-v: display the user or group, the space limit on all storage devices attached to the system;-V: display version information. Parameter user or workgroup: specify the user or workgroup to display.
For example, we can limit the maximum disk quota that can be used by a certain group, and we can also limit the maximum disk quota of a certain user. For example, for a fee-based application, vip can get more space. In addition, in the way of Link, so that mail can be used as a limited quota (change / var/spool/mail this path), no 2, need to re-plan a hard drive! Just use Link to point to / home (or any other quota disk that has already been made). This is usually used in situations where the original planning is not good, but do not want to change the original host architecture!
Requirements: disk quota is mainly carried out in the Linux host for quser1 and quser2 users, and both users are hung in the qgroup group. Each user has a total disk space limit for 50MB (regardless of inode)! And the soft limit is set to 45 MB; and the grace time is set to 1 day, but the extra files must be deleted within one day, otherwise the remaining space cannot be used; the gquota group considers the maximum limit, so it is set to 90 MB! (note that the advantage of this setting is that it is flexible, just like the current mail service, where so many users promise to give each user the maximum space of GB, but it is impossible for everyone to use that much space, so the total space of mail service is definitely not the number of registered customers multiplied by the number of GB, otherwise how big it would be. )
[root@localhost ~] # groupadd qgroup [root@localhost ~] # useradd-m-g qgroup quser1 [root@localhost ~] # useradd-m-g qgroup quser2 [root@localhost ~] # passwd quser1 [root@localhost ~] # passwd quser2 [root@localhost ~] # df = > find a suitable partition to do the experiment Use / disk2 Filesystem 1K-blocks Used Available Use% Mounted on / dev/hda1 5952252 3193292 2451720 57% / / dev/hdb1 28267608 77904 267306041% / disk2 / dev/hda5 9492644 227252 87754123% / disk1 [root@localhost ~] # vi / etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/disk1 / disk1 ext3 defaults 1 2 LABEL=/disk2 / disk2 ext3 defaults Usrquota,grpquota 1 2 / dev/hda3 swap swap defaults 0 0 pay attention to too much usrquota,grpquota There are no spaces between defaults,usrquota,grpquota. Be sure to write correctly. In this way, you can add the quota disk format! However, because the real quota reads the file / etc/mtab when reading, and the file needs to be rebooted before it can be rewritten with the new data of / etc/fstab! So this time you can choose: reboot (reboot).
Re-remount filesystem to drive the set value.
[root@localhost ~] # umount / dev/hdb1 [root@localhost ~] # mount-a [root@localhost ~] # grep'/ disk2' / etc/mtab / dev/hdb1 / disk2 ext3 rw,usrquota,grpquota 00 in fact, you can also take advantage of mount's remount function.
[root@localhost] # mount-o remount / disk2 has successfully added the quota function of filesystem.
Scan disk usage and generate important aquota.group and aquota.user:
[root@localhost] # quotacheck-avug quotacheck: Scanning / dev/hdb1 [/ disk2] done quotacheck: Checked 3 directories and 4 files [root@localhost] # ll / disk2-rw- 1 root root 6144 Sep 6 11:44 aquota.group-rw- 1 root root 6144 Sep 6 11:44 aquota.user can easily output the required data to him using quotacheck! But the strange thing is that in some versions of Linux, you can't start quota with aquota.user (group). It may be because of the old version of quota, so you make another link file button to cheat quota. This action is not necessary. (mainly learning this thinking is very important.)
[root@localhost ~] # cd / disk2 [root@localhost ~] # ln-s aquota.user quota.user [root@localhost ~] # ln-s aquota.group quota.group launch quota quota:
[root@localhost ~] # quotaon-avug / dev/hdb1 [/ disk2]: group quotas turned on / dev/hdb1 [/ disk2]: user quotas turned on = = > seeing turned on is a real success! Edit the user's available space:
[root@localhost] # edquota-u quser1 Disk quotas for user quser1 (uid 502): Filesystem blocks soft hard inodes soft hard / dev/hdb1 0 45000 50000 [root@localhost ~] # edquota-p quser1 quser2 = > copy it directly to quser2 and then set the grace time, or use edquota
[root@localhost ~] # edquota-t Grace period before enforcing soft limits for users: time units may be: days, hours, minutes, or seconds Filesystem Block grace period Inode grace period / dev/hdb1 1days 7days use quota-v to query:
[root@localhost] # quota-vu quser1 quser2 Disk quotas for user quser1 (uid 502): Filesystem blocks quota limit grace files quota limit grace / dev/hdb1 0 45000 50000 Disk quotas for user quser2 (uid 50000): Filesystem blocks quota limit grace files quota limit grace / dev/hdb1 0 45000 50000 000 note Since the user has not exceeded 45 MB, the grace (grace time) will not appear.
Edit the space available to the group:
[root@localhost] # edquota-g qgroup Disk quotas for group qgroup (gid 502): Filesystem blocks soft hard inodes soft hard / dev/hdb1 0 80000 90000 [root@localhost] # quota-vg qgroup Disk quotas for group qgroup (gid 502): Filesystem blocks quota limit grace files quota limit grace / dev/hdb1 This is the end of the article on "how to use quota commands in Linux" for 0 80000 90000. Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
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.