User disk space limit

xiaoxiao2021-03-06  42

Regardless of how big the disk space is, the disk space is not used, it seems to be a forever fact. Linux provides a means to limit user disk space to make each user reasonably and effectively use space assigned to him. The limitations of the user disk space are in units of file system (partition), regardless of user files in which directory in this file system. 1. Modify the / etc / fstab file. Add a quota option (as follows) in the file system corresponding to the Mount command line. / DEV / HDA7 / Home Ext3 Defaults, USRQUOTA, GRPQUOTA 1 2 2. Reloading Linux partitions, for example: [root @ fileserver root] # mount -o remount / home Continue. 3. Establish aquota.user and aquota.group files in the installation point directory of the file system to add disk limit: [root @ fileserver root] # CD / home (/ home is a single partition / dev / hda7 loading point) [root @FileServer Home] # Touch Aquota.user (setting disk limit for users) [root @ fileserver home] # Touch Aquota.group (setting disk limit for user group) This time generated Aquota.user and Aquota.Group are empty, Does not comply with the system requirements. Please see the next step. 4. Generate the Aquota.user and Aquota.group [root @ fileserver home] # quotacheck / home (generated, generated systemver home] # quotacheck -g / home When the Aquota.group is generated, there is an error prompt. This is not tight. Because the previous Touch is generated is an empty file, it is sure the format is wrong. This is the correct Aquota.user and Aquota.group build.

Continue Next: 5. Set disk space limit for users: [root @ fileserver home] # Edquota [-u] user_name [root @ fileserver home] # edquota -g group_name (for user group) This command opens a VI window, for The user sets the number of disk space and the number of i nodes. The SOFT limit is a temporary limit; the HARD limit is a permanent limit (SOFT limit is slightly greater than the HARD limit), the editing method is identical to the VI, with zz or: WQ Command exit. To give several users USER1, USER2, User3 specify the same disk limit, the following command can be used to give these users with the same limit as protuser: [root @ fileserver home] # Edquota [-u] -p protuser1 user2 User3 [root @ fileserver home] # Edquota -g -p ProtGroup Group1 Group2 Group3 Setting Soft Quota and Hard Quota Time: [Root @ fileserver home] # Edquota -t A vi window: GRACE PERIOD BEFORE Enforcing Soft Limits For Users: Time Units, or Seconds FileSystem Block Grace Period Inode Grace Period / dev / hda7 7days 7Days to set this time. You may need to restart later so that the disk limit takes effect. You can, but pay attention to some problems, please continue to look. 6. Check the consistency of disk space limitations, the system automatically restarts, after checking the hard drive (/etc/rc.sinit), no need to do personally. If the partition is already hung by "reading" mode, you have to be careful, for example: [root @ fileserver root] # Quotacheck / Home Quotacheck: quota for users is enabled on mountpoint / home so quotacheck might Damage the file. Please Turn Quotas At this time, due to some need, or in some case, "have to" run this command: [root @ fileserver home] # quotacheck -mf [-u] / dev / hda7 [ Root @ fileserver home] # Quotacheck -mf -g / dev / hda7 parameter -M [m] means to check the hard disk quota in "Read, Write" mode (have a certain "written" data loss, It should be ensured that there is no process to write this partition. It is recommended to do in single user mode.).

转载请注明原文地址:https://www.9cbs.com/read-55944.html

New Post(0)