天天看點

xfs_quota: cannot set limits: Function not implemented 解決辦法

ENV:

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

正在學習linux系統的quota磁盤配額,但是在操作時出現錯誤Function not implemented:

[[email protected] 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
           

和操作的一樣啊,怎麼會不能實作的呢??

最後找了百度,排在前幾個的老外遇到的也是一樣的情況,但是看到最後也是沒有得到解決,最後還是在國人的部落格找到解決方法:

[[email protected] ~]# vim /etc/fstab

/dev/sdb1 /mnt/newFS xfs defaults,usrquota,grpquota 0 0  
                    //就是在這行預設配置中加上usrquota,grpquota

           

設定完後mount -a    再執行,怎麼還不行呢???沒辦法,直接重新開機:

[[email protected] ~]# shutdown -r now
           

啟動完後,再執行一次吧:

[[email protected] ~]# xfs_quota -x -c 'limit bsoft=3m bhard=6m isoft=3 ihard=6 test' /mnt/newFS
[[email protected] ~]# 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 [--------]

[[email protected] ~]# 
           

這次可以了。

在最後還要感謝下面兩位的解決方法,因兩個的内容一樣,就都貼出來一起感謝了。

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

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

繼續閱讀