{"id":3789,"date":"2023-09-13T22:06:29","date_gmt":"2023-09-13T14:06:29","guid":{"rendered":"http:\/\/www.chenlianfu.com\/?p=3789"},"modified":"2024-04-10T20:03:41","modified_gmt":"2024-04-10T12:03:41","slug":"rocky-9%e7%b3%bb%e7%bb%9f%e5%af%b9xfs%e7%a3%81%e7%9b%98%e8%bf%9b%e8%a1%8c%e9%85%8d%e9%a2%9d","status":"publish","type":"post","link":"http:\/\/www.chenlianfu.com\/?p=3789","title":{"rendered":"Rocky 9\u7cfb\u7edf\u5bf9XFS\u78c1\u76d8\u8fdb\u884c\u914d\u989d"},"content":{"rendered":"\n<h2>1. \u5b89\u88c5quota\u8f6f\u4ef6<\/h2>\n\n\n\n<p>\u82e5\u6ca1\u6709xfs_quota\u547d\u4ee4\uff0c\u5219\u5b89\u88c5quota\u8f6f\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install quota<\/code><\/pre>\n\n\n\n<h2>2. \u5173\u95edSeLinux\u5b89\u5168\u673a\u5236<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\u4e34\u65f6\u5173\u95ed\nsetenforce 0\n\n\u6c38\u4e45\u5173\u95ed\nperl -p -i -e 's\/SELINUX=enforcing\/SELINUX=disabled\/' \/etc\/selinux\/config<\/code><\/pre>\n\n\n\n<h2>3. \u6302\u8f7d\u78c1\u76d8\u65f6\u6dfb\u52a0\u914d\u989d\u53c2\u6570<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>mount -o remount,usrquota,prjquota \/dev\/sdb1 \/home<\/code><\/pre>\n\n\n\n<p>\u6216\u4fee\u6539 \/etc\/fstab \u6587\u4ef6\u6c38\u4e45\u751f\u6548\uff08\u9700\u8981\u91cd\u65b0\u6302\u8f7d\u76ee\u6807\u5206\u533a\u624d\u80fd\u751f\u6548\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/dev\/sdb1 \/home xfs defaults,usrquota,prjquota 0 0\n# \u6ce8\u610f\u67093\u79cdquota\u65b9\u5f0f\uff0cusrquota\u7ed9\u7528\u6237\u9650\u989d\uff0cgrpquota\u7ed9\u7528\u6237\u7ec4\u9650\u989d\uff0cprjquota\u7ed9\u6587\u4ef6\u5939\u9650\u989d\u3002\u6ce8\u610f\u540e\u4e24\u8005\u662f\u4e92\u65a5\u7684\uff0c\u53ea\u80fd\u9009\u4e00\u79cd\uff0c\u5f53\u4fee\u6539\u78c1\u76d8\u914d\u989d\u65b9\u5f0f\u540e\uff0c\u91cd\u542f\u670d\u52a1\u5668\u670d\u52a1\u5668\u624d\u80fd\u751f\u6548\uff0c\u800c\u91cd\u65b0\u6302\u8f7d\u5206\u533a\u662f\u4e0d\u884c\u7684\u3002<\/pre>\n\n\n\n<p>\u7136\u540e\u4f7f\u7528mount\u547d\u4ee4\u67e5\u770b\u6302\u8f7d\u5206\u533a\u662f\u5426\u652f\u6301\u78c1\u76d8\u914d\u989d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mount | grep home\n\/dev\/sdb1 on \/home type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)<\/code><\/pre>\n\n\n\n<h2>4. \u5f00\u673a\u65f6\u8bbe\u7f6e\u914d\u989d\u53c2\u6570<\/h2>\n\n\n\n<p>\u867d\u7136\u6dfb\u52a0\u4e86\u6302\u8f7d\u53c2\u6570\uff0c\u4f7f\u7528mount\u547d\u4ee4\u68c0\u6d4b\u65f6\uff0c\u5176\u6302\u8f7d\u65b9\u5f0f\u4f9d\u7136\u662fnoquota\u3002\u5728\u4f7f\u7528xfs_quota\u8fdb\u884c\u914d\u989d\u65f6\u4f1a\u5931\u8d25\uff0c\u63d0\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">xfs_quota: cannot set limits: Function not implemented<\/pre>\n\n\n\n<p>\u6b64\u65f6\uff0c\u9700\u8981\u8fdb\u884c\u5f00\u673a\u7684\u914d\u7f6e\u8bbe\u7f6e\uff0c\u4fee\u6539\u542f\u52a8\u914d\u7f6e\u6587\u4ef6\/etc\/default\/grub\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">GRUB_CMDLINE_LINUX=\"crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rhgb quiet&nbsp;<strong>rootflags=uquota,pquota<\/strong>\"\n\u4e3b\u8981\u6dfb\u52a0\u4e86<strong>rootflags=uquota,pquota<\/strong>\u53c2\u6570\u3002<\/pre>\n\n\n\n<p>\u7136\u540e\uff0c\u91cd\u65b0\u751f\u6210\u542f\u52a8\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5bf9\u4e8eLegacy\u542f\u52a8\ncp \/boot\/grub2\/grub.cfg \/boot\/grub2\/grub.cfg.orig &amp;&amp; grub2-mkconfig -o \/boot\/grub2\/grub.cfg\n\n\u5bf9\u4e8eUEFI\u542f\u52a8\ncp \/boot\/efi\/EFI\/rocky\/grub.cfg \/boot\/efi\/EFI\/rocky\/grub.cfg.orig &amp;&amp; grub2-mkconfig -o \/boot\/efi\/EFI\/rocky\/grub.cfg<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u91cd\u542f\u540e\uff0c\u518d\u68c0\u6d4bmount\u53c2\u6570\u3002<\/p>\n\n\n\n<h2>5. \u4f7f\u7528xfs_quota\u547d\u4ee4\u5bf9\u5206\u533a\u8fdb\u884c\u914d\u989d<\/h2>\n\n\n\n<p>\u5bf9user01\u7528\u6237\u7684\/home\u5206\u533a\u8fdb\u884c\u914d\u989d\u3002\u8f6f\u9650\u5236\u4e3a3G\uff0c\u786c\u9650\u5236\u4e3a3.5G\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xfs_quota -x -c 'limit bsoft=3000m bhard=3500m user01' \/home\nxfs_quota -x -c report \/home\n\n-x \u5141\u8bb8\u6267\u884c\u7ba1\u7406\u5458\u6307\u4ee4\n-c \u8f93\u5165\u6267\u884c\u7684\u6307\u4ee4<\/code><\/pre>\n\n\n\n<h2>6. \u4f7f\u7528xfs_quota\u547d\u4ee4\u5bf9\u76ee\u5f55\u8fdb\u884c\u914d\u989d<\/h2>\n\n\n\n<p>\u5bf9user01\u3001user02\u3001user03\u7b49\u591a\u4e2a\u7528\u6237\u7684\u5bb6\u76ee\u5f55\u8fdb\u884c\u914d\u989d\u3002\u8f6f\u9650\u5236\u4e3a3G\uff0c\u786c\u9650\u5236\u4e3a3.5G\u3002\u6309\u5982\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u7b2c\u4e00\u6b65\uff0c\u751f\u6210\/etc\/projects\u6587\u4ef6\necho \"1000:\/home\/user01\n1000:\/home\/user02\n1002:\/home\/user03\" &gt; \/etc\/projects\n\u4ee5\u4e0a\/etc\/projects\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u4e86\u4e24\u4e2aproject\u7f16\u53f7\u3002project\u7f16\u53f7\u662f\u4e00\u4e2a\u6570\u5b57\uff0c\u53ef\u4ee5\u968f\u4fbf\u7ed9\u4e00\u4e2a\u3002\u5176\u4e2d1000\u5bf9\u5e94\u4e24\u4e2a\u6587\u4ef6\u5939\uff0c1002\u5bf9\u5e94\u4e00\u4e2a\u6587\u4ef6\u5939\u3002\u540e\u7eed\u8bbe\u7f6e\u597d\u540e\uff0c\u8fd91000\u5bf9\u5e94\u7684\u4e24\u4e2a\u6587\u4ef6\u5939\u4e00\u8d77\u5171\u4eab\u4e00\u4e2a\u914d\u989d\uff0c\u800c1002\u5bf9\u5e94\u7684\u6587\u4ef6\u5939\u72ec\u4eab\u4e00\u4e2a\u914d\u989d\u3002\n\n\u7b2c\u4e8c\u6b65\uff0c\u751f\u6210\/etc\/projid\u6587\u4ef6\necho \"user01_3G:1000\nuser03_3G:1002\" &gt; \/etc\/projid\n\u8be5\/etc\/projid\u6587\u4ef6\u8bbe\u7f6e\u4e00\u4e2a\u597d\u8bb0\u7684project\u540d\u79f0\uff08\u968f\u4fbf\u53d6\u540d\uff0c\u63a8\u8350\u53d6\u5f97\u6709\u610f\u4e49\u4e9b\uff09\uff0c\u5bf9\u5e94\u8fd9project\u7f16\u53f7\u3002\n\n\u7b2c\u4e09\u6b65\uff0c\u8ba9project\u540d\u79f0\u751f\u6548\nxfs_quota -x -c 'project -s user01_3G' \/home\nxfs_quota -x -c 'project -s user03_3G' \/home\n\u547d\u4ee4\u884cproject\u7684\u53c2\u6570-s\u8868\u793a\u8bfb\u53d6\/etc\/projects\u6587\u4ef6\u5185\u5bb9\uff0c\u6807\u8bb0\u76ee\u6807\u6587\u4ef6\u5939\u8fdb\u884c\u914d\u989d\u3002\u6bcf\u5f53\u5bf9\/etc\/projects\u6587\u4ef6\u5185\u5bb9\u8fdb\u884c\u4fee\u6539\u540e\uff0c\u5219\u9700\u8981\u91cd\u65b0\u8fd0\u884c\u76f8\u5e94\u7684\u547d\u4ee4\uff0c\u4f7f\u4fee\u6539\u751f\u6548\u3002\n\n\u7b2c\u56db\u6b65\uff0c\u8bbe\u7f6eproject\u540d\u79f0\u5bf9\u5e94\u7684\u78c1\u76d8\u914d\u989d\u3002\nxfs_quota -x -c 'limit -p bsoft=3000m bhard=3500m user01_3G' \/home\nxfs_quota -x -c 'limit -p bsoft=3000m bhard=3500m user03_3G' \/home\n\u547d\u4ee4\u884climit\u7684\u53c2\u6570-p\u8868\u793a\u4f7f\u7528project\u65b9\u5f0f\u8fdb\u884c\u914d\u989d\u3002\u82e5\u914d\u989d\u9650\u5236\u4e3a0\uff0c\u5219\u8868\u793a\u4e0d\u8fdb\u884c\u914d\u989d\u9650\u5236\u3002<\/code><\/pre>\n\n\n\n<h2>7. \u67e5\u770b\u914d\u989d\u4fe1\u606f<\/h2>\n\n\n\n<p>\u67e5\u770b\u78c1\u76d8\u914d\u989d\u53ca\u4f7f\u7528\u91cf\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xfs_quota -x -c report \/home<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u78c1\u76d8\u5206\u533a\u548c\u76ee\u5f55\u662f\u5426\u6709quota\u8bbe\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xfs_quota -x -c print<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u78c1\u76d8\u914d\u989d\u7684\u4f7f\u7528\u91cf\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xfs_quota -x -c \"df -h\"<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. \u5b89\u88c5quota\u8f6f\u4ef6 \u82e5\u6ca1\u6709xfs_quota\u547d\u4ee4\uff0c\u5219\u5b89\u88c5quota\u8f6f\u4ef6\uff1a  &hellip; <a href=\"http:\/\/www.chenlianfu.com\/?p=3789\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[10,86],"_links":{"self":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3789"}],"collection":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3789"}],"version-history":[{"count":5,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3789\/revisions"}],"predecessor-version":[{"id":3857,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3789\/revisions\/3857"}],"wp:attachment":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3789"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}