{"id":42674,"date":"2024-10-03T23:07:24","date_gmt":"2024-10-03T15:07:24","guid":{"rendered":"https:\/\/server.hk\/cnblog\/42674\/"},"modified":"2024-10-03T23:07:24","modified_gmt":"2024-10-03T15:07:24","slug":"centos-6-9-%e4%b8%ad%e8%aa%bf%e6%95%b4-tmpfs-%e5%a4%a7%e5%b0%8f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/42674\/","title":{"rendered":"CentOS 6.9 \u4e2d\u8abf\u6574 tmpfs \u5927\u5c0f"},"content":{"rendered":"<h1 id=\"centos-6-9-%e4%b8%ad%e8%aa%bf%e6%95%b4-tmpfs-%e5%a4%a7%e5%b0%8f-tPHRnrHCDk\">CentOS 6.9 \u4e2d\u8abf\u6574 tmpfs \u5927\u5c0f<\/h1>\n<p>\u5728 CentOS 6.9 \u4e2d\uff0ctmpfs \u662f\u4e00\u7a2e\u57fa\u65bc\u5167\u5b58\u7684\u6587\u4ef6\u7cfb\u7d71\uff0c\u901a\u5e38\u7528\u65bc\u5b58\u5132\u81e8\u6642\u6587\u4ef6\u3002\u7531\u65bc\u5176\u901f\u5ea6\u5feb\u4e14\u80fd\u5920\u6e1b\u5c11\u78c1\u789f I\/O\uff0ctmpfs \u5728\u8a31\u591a\u61c9\u7528\u4e2d\u90fd\u975e\u5e38\u6709\u7528\u3002\u7136\u800c\uff0c\u6839\u64da\u7cfb\u7d71\u7684\u9700\u6c42\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u8abf\u6574 tmpfs \u7684\u5927\u5c0f\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 6.9 \u4e2d\u8abf\u6574 tmpfs \u7684\u5927\u5c0f\uff0c\u4e26\u63d0\u4f9b\u76f8\u95dc\u7684\u6b65\u9a5f\u548c\u793a\u4f8b\u3002<\/p>\n<h2 id=\"tmpfs-%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5-tPHRnrHCDk\">tmpfs \u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>tmpfs \u662f\u4e00\u7a2e\u865b\u64ec\u6587\u4ef6\u7cfb\u7d71\uff0c\u5141\u8a31\u7528\u6236\u5728\u5167\u5b58\u4e2d\u5275\u5efa\u6587\u4ef6\u3002\u9019\u610f\u5473\u8457 tmpfs \u7684\u6027\u80fd\u975e\u5e38\u9ad8\uff0c\u56e0\u70ba\u5b83\u4e0d\u9700\u8981\u5f9e\u78c1\u789f\u8b80\u53d6\u6216\u5beb\u5165\u6578\u64da\u3002tmpfs \u7684\u5927\u5c0f\u53ef\u4ee5\u6839\u64da\u7cfb\u7d71\u7684\u53ef\u7528\u5167\u5b58\u9032\u884c\u8abf\u6574\uff0c\u4e26\u4e14\u5728\u7cfb\u7d71\u91cd\u555f\u5f8c\u6703\u81ea\u52d5\u6e05\u7a7a\u3002<\/p>\n<h2 id=\"%e6%aa%a2%e6%9f%a5%e7%95%b6%e5%89%8d-tmpfs-%e8%a8%ad%e7%bd%ae-tPHRnrHCDk\">\u6aa2\u67e5\u7576\u524d tmpfs \u8a2d\u7f6e<\/h2>\n<p>\u5728\u8abf\u6574 tmpfs \u7684\u5927\u5c0f\u4e4b\u524d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u7576\u524d\u7684 tmpfs \u8a2d\u7f6e\uff1a<\/p>\n<pre><code>df -h \/dev\/shm<\/code><\/pre>\n<p>\u9019\u5c07\u986f\u793a tmpfs \u7684\u7576\u524d\u5927\u5c0f\u548c\u4f7f\u7528\u60c5\u6cc1\u3002\u901a\u5e38\uff0ctmpfs \u6703\u88ab\u639b\u8f09\u5728 \/dev\/shm \u76ee\u9304\u4e0b\u3002<\/p>\n<h2 id=\"%e8%aa%bf%e6%95%b4-tmpfs-%e5%a4%a7%e5%b0%8f%e7%9a%84%e6%ad%a5%e9%a9%9f-tPHRnrHCDk\">\u8abf\u6574 tmpfs \u5927\u5c0f\u7684\u6b65\u9a5f<\/h2>\n<p>\u8981\u8abf\u6574 tmpfs \u7684\u5927\u5c0f\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u4fee\u6539 \/etc\/fstab \u6587\u4ef6\u6216\u4f7f\u7528 mount \u547d\u4ee4\u4f86\u5be6\u73fe\u3002\u4ee5\u4e0b\u662f\u5169\u7a2e\u65b9\u6cd5\u7684\u8a73\u7d30\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"%e6%96%b9%e6%b3%95%e4%b8%80%ef%bc%9a%e9%80%9a%e9%81%8e-etc-fstab-%e8%aa%bf%e6%95%b4-tPHRnrHCDk\">\u65b9\u6cd5\u4e00\uff1a\u901a\u904e \/etc\/fstab \u8abf\u6574<\/h3>\n<ol>\n<li>\u4f7f\u7528\u6587\u672c\u7de8\u8f2f\u5668\u6253\u958b \/etc\/fstab \u6587\u4ef6\uff1a<\/li>\n<pre><code>sudo vi \/etc\/fstab<\/code><\/pre>\n<li>\u627e\u5230 tmpfs \u7684\u884c\uff0c\u901a\u5e38\u662f\u985e\u4f3c\u4ee5\u4e0b\u7684\u5167\u5bb9\uff1a<\/li>\n<pre><code>tmpfs   \/dev\/shm    tmpfs   defaults,size=1G   0 0<\/code><\/pre>\n<li>\u5c07 size=1G \u4fee\u6539\u70ba\u60a8\u6240\u9700\u7684\u5927\u5c0f\uff0c\u4f8b\u5982 512M\uff1a<\/li>\n<pre><code>tmpfs   \/dev\/shm    tmpfs   defaults,size=512M   0 0<\/code><\/pre>\n<li>\u4fdd\u5b58\u4e26\u9000\u51fa\u7de8\u8f2f\u5668\u3002<\/li>\n<li>\u91cd\u65b0\u639b\u8f09 tmpfs \u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/li>\n<pre><code>sudo mount -o remount \/dev\/shm<\/code><\/pre>\n<\/ol>\n<h3 id=\"%e6%96%b9%e6%b3%95%e4%ba%8c%ef%bc%9a%e4%bd%bf%e7%94%a8-mount-%e5%91%bd%e4%bb%a4%e8%aa%bf%e6%95%b4-tPHRnrHCDk\">\u65b9\u6cd5\u4e8c\uff1a\u4f7f\u7528 mount \u547d\u4ee4\u8abf\u6574<\/h3>\n<ol>\n<li>\u60a8\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 mount \u547d\u4ee4\u4f86\u8abf\u6574 tmpfs \u7684\u5927\u5c0f\uff0c\u800c\u4e0d\u9700\u8981\u4fee\u6539 \/etc\/fstab\uff1a<\/li>\n<pre><code>sudo mount -o remount,size=512M \/dev\/shm<\/code><\/pre>\n<li>\u9019\u5c07\u7acb\u5373\u5c07 tmpfs \u7684\u5927\u5c0f\u8abf\u6574\u70ba 512M\u3002<\/li>\n<\/ol>\n<h2 id=\"%e6%aa%a2%e6%9f%a5%e8%aa%bf%e6%95%b4%e5%be%8c%e7%9a%84-tmpfs-%e5%a4%a7%e5%b0%8f-tPHRnrHCDk\">\u6aa2\u67e5\u8abf\u6574\u5f8c\u7684 tmpfs \u5927\u5c0f<\/h2>\n<p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9a5f\u5f8c\uff0c\u60a8\u53ef\u4ee5\u518d\u6b21\u4f7f\u7528 df \u547d\u4ee4\u4f86\u6aa2\u67e5 tmpfs \u7684\u5927\u5c0f\u662f\u5426\u5df2\u6210\u529f\u8abf\u6574\uff1a<\/p>\n<pre><code>df -h \/dev\/shm<\/code><\/pre>\n<p>\u9019\u5c07\u986f\u793a\u65b0\u7684 tmpfs \u5927\u5c0f\u548c\u4f7f\u7528\u60c5\u6cc1\u3002<\/p>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-tPHRnrHCDk\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u8abf\u6574 tmpfs \u5927\u5c0f\u6642\uff0c\u8acb\u6ce8\u610f\u4ee5\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ul>\n<li>tmpfs \u7684\u5927\u5c0f\u4e0d\u80fd\u8d85\u904e\u7cfb\u7d71\u7684\u53ef\u7528\u5167\u5b58\u3002<\/li>\n<li>\u904e\u5c0f\u7684 tmpfs \u53ef\u80fd\u6703\u5c0e\u81f4\u61c9\u7528\u7a0b\u5e8f\u6027\u80fd\u4e0b\u964d\uff0c\u56e0\u70ba\u5b83\u5011\u7121\u6cd5\u4f7f\u7528\u8db3\u5920\u7684\u5167\u5b58\u4f86\u5b58\u5132\u81e8\u6642\u6587\u4ef6\u3002<\/li>\n<li>\u904e\u5927\u7684 tmpfs \u53ef\u80fd\u6703\u4f54\u7528\u7cfb\u7d71\u7684\u53ef\u7528\u5167\u5b58\uff0c\u5f71\u97ff\u5176\u4ed6\u61c9\u7528\u7a0b\u5e8f\u7684\u904b\u884c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-tPHRnrHCDk\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS 6.9 \u4e2d\u8abf\u6574 tmpfs \u7684\u5927\u5c0f\u662f\u4e00\u500b\u7c21\u55ae\u7684\u904e\u7a0b\uff0c\u53ef\u4ee5\u901a\u904e\u4fee\u6539 \/etc\/fstab \u6587\u4ef6\u6216\u4f7f\u7528 mount \u547d\u4ee4\u4f86\u5be6\u73fe\u3002\u6839\u64da\u7cfb\u7d71\u7684\u9700\u6c42\uff0c\u9069\u7576\u8abf\u6574 tmpfs \u7684\u5927\u5c0f\u53ef\u4ee5\u63d0\u9ad8\u7cfb\u7d71\u6027\u80fd\u548c\u61c9\u7528\u7a0b\u5e8f\u7684\u6548\u7387\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u591a\u6709\u95dc <a href=\"https:\/\/server.hk\">VPS<\/a> \u548c <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u7684\u8cc7\u8a0a\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u8a73\u7d30\u8cc7\u6599\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to adjust the size of tmpfs in CentOS 6.9 for optimal performance and resource management in your system.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-42674","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=42674"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42674\/revisions"}],"predecessor-version":[{"id":42675,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42674\/revisions\/42675"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=42674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=42674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=42674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}