Skip to content

Instantly share code, notes, and snippets.

@ibreathebsb
Created September 12, 2018 13:47
Show Gist options
  • Save ibreathebsb/2f5fd3ea4bdea1fa2b1acb25d35cd334 to your computer and use it in GitHub Desktop.
Save ibreathebsb/2f5fd3ea4bdea1fa2b1acb25d35cd334 to your computer and use it in GitHub Desktop.

quota

磁盘配额工具,针对不同的用户,群组设置不同的配额,quota支队文件系统有效,可以按照inode数量或者总的block容量来限制,支持soft和hard两个配额,当用户的磁盘配额 超过soft容量时,系统给予警告,超出hard配额时,多余的无法写入

  1. 将文件系统挂载为支持quota: mount -o remount,usrquota,grpquota /mountpoint
  2. 初始化quota配置,quotacheck -ugv -f/mountpoint 其中u和v分别代表检查用户配额和群组配额
  3. 启用或者禁用quota quotaon -ug /mountpoint quotaoff -ug /file-system
  4. 配置用户或者群组的限额edquota -u user edquota -g group 也可以复制某个用户/群组的配置edquota -p source -u target 或者使用直接配置命令setquota user/group blocksoft blockhard inodesoft inodehard /mountpoint
# 不要修改blocks和inodes 系统自动计算的
[root@www ~]# edquota -u myquota1
Disk quotas for user myquota1 (uid 710):
Filesystem    blocks  soft   hard  inodes  soft  hard
/dev/hda3         80     0      0      10     0     0

  
  1. 查看单个用户/群组quota quota -u user quota -g group
  2. 查看某个文件系统的用户/群组quota repquota -u /mountpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment