xfs_quota: cannot set limits: Function not implemented 解决办法

ENV:

[root@centos7 ~]# uname -r
3.10.0-514.el7.x86_64
[root@centos7 ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core)
[root@centos7 ~]# xfs_quota -V
xfs_quota version 4.5.0

正在学习linux系统的quota磁盘配额,但是在操作时出现错误Function not implemented:

[root@centos7 newFS]# xfs_quota -x -c 'limit bsoft=3m bhard=6m isoft=3 ihard=6 test' /mnt/newFS/  
xfs_quota: cannot set limits: Function not implemented

哪里出现错误了??找了man xfs_quota 文档,其中的例子:

EXAMPLES
       Enabling quota enforcement on an XFS filesystem (restrict a user  to  a
       set amount of space).

            # mount -o uquota /dev/xvm/home /home
            # xfs_quota -x -c 'limit bsoft=500m bhard=550m tanya' /home
            # xfs_quota -x -c report /home

       Enabling project quota on an XFS filesystem (restrict files in log file
       directories to only using 1 gigabyte of space).

            # mount -o prjquota /dev/xvm/var /var
            # echo 42:/var/log >> /etc/projects
            # echo logfiles:42 >> /etc/projid
            # xfs_quota -x -c 'project -s logfiles' /var
            # xfs_quota -x -c 'limit -p bhard=1g logfiles' /var

和操作的一样啊,怎么会不能实现的呢??

最后找了百度,排在前几个的老外遇到的也是一样的情况,但是看到最后也是没有得到解决,最后还是在国人的博客找到解决方法:

[root@centos7 ~]# vim /etc/fstab

/dev/sdb1 /mnt/newFS xfs defaults,usrquota,grpquota 0 0  
                    //就是在这行默认配置中加上usrquota,grpquota

设置完后mount -a    再执行,怎么还不行呢???没办法,直接重启:

[root@centos7 ~]# shutdown -r now

启动完后,再执行一次吧:

[root@centos7 ~]# xfs_quota -x -c 'limit bsoft=3m bhard=6m isoft=3 ihard=6 test' /mnt/newFS
[root@centos7 ~]# xfs_quota -x -c report /mnt/newFS/
User quota on /mnt/newFS (/dev/sdb1)
                               Blocks                     
User ID          Used       Soft       Hard    Warn/Grace     
---------- -------------------------------------------------- 
root            36512          0          0     00 [--------]
test                0       3072       6144     00 [--------]

Group quota on /mnt/newFS (/dev/sdb1)
                               Blocks                     
Group ID         Used       Soft       Hard    Warn/Grace     
---------- -------------------------------------------------- 
root            36512          0          0     00 [--------]

[root@centos7 ~]# 

这次可以了。

在最后还要感谢下面两位的解决方法,因两个的内容一样,就都贴出来一起感谢了。

http://www.mamicode.com/info-detail-1131485.html

https://blog.51cto.com/yangzhiming/1717745

你可能感兴趣的:(Linux)