XFS_Quota - 群组问题

问题描述 投票:0回答:2

我将 xfs_quota 限制设置为组 ID。但硬/软限制不生效。只有当我为用户设置配额限制时它才有效。

群组名称:itshare

用户名:测试用户

“testuser”映射到组“itshare”

如果您看到以下步骤,我已将 itshare 组的软限制设置为 3MB,硬限制设置为 4MB。

但是用户“testuser”可以上传超过指定限制的文件。

[root@srv1 ~]#xfs_quota -x -c 'limit -g bsoft=3m bhard=4m itshare'  /home

[root@srv1 ~]# xfs_quota -x -c 'report -h ' /home
User quota on /home (/dev/mapper/centos-home)
                        Blocks              
User ID      Used   Soft   Hard Warn/Grace   
---------- --------------------------------- 
root       391.8M      0      0  00 [------]
testuser       5.7M     0     0  00 [-none-]


Group quota on /home (/dev/mapper/centos-home)
                        Blocks              
Group ID     Used   Soft   Hard Warn/Grace   
---------- --------------------------------- 
root       391.8M      0      0  00 [------]
testuser       5.7M      0      0  00 [------]
itshare         0     3M     4M  00 [------]
[root@srv1 ~]#

[root@srv1 ~]# id testuser
uid=1000(testuser) gid=1000(testuser) groups=1000(testuser),1003(itshare)
[root@srv1 ~]# 
linux centos quota xfs
2个回答
0
投票

文件是否可能是使用“testuser”组而不是“itshare”写入的,因此 xfs 配额不适用于“该组使用的空间”? 只是猜测。


0
投票

不幸的是

xfs_quota
仅对初级组有效。它不适用于次要组(在您的案例组中:
itshare
)。

您需要项目配额作为解决方法。

  1. 使用

    prjquota
    选项安装磁盘/分区:

    # mount -o rw,remount,prjquota /home
    # mount | grep home
    

    确保显示

    prjquota
    选项。

  2. 创建

    itshare
    目录:

    # mkdir /home/itshare
    # chown -R testuser:itshare /home/itshare
    # chmod -R g+rwx /home/itshare
    
  3. 创建项目ID(可以是任何数值)

    # echo "11:/home/itshare" >> /etc/projects
    # echo "itshare:11" >> /etc/projid
    
  4. 初始化项目目录

    # xfs_quota -x -c 'project -s itshare' /home
    
  5. 为具有初始化目录的项目配置配额:

    # xfs_quota -x -c 'limit -p bsoft=3m bhard=4m itshare' /home
    
  6. 测试

参考:

[1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_file_systems/ assembly_limiting-storage-space-usage-on-xfs-with-quotas_managing-file-systems

© www.soinside.com 2019 - 2024. All rights reserved.