{"id":4331,"date":"2021-02-02T13:25:13","date_gmt":"2021-02-02T05:25:13","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=4331"},"modified":"2021-05-08T09:26:16","modified_gmt":"2021-05-08T01:26:16","slug":"ext4%e6%8c%82%e8%bd%bdmount%e5%8f%82%e6%95%b0%e5%88%86%e6%9e%90%e5%92%8c%e5%bb%ba%e8%ae%ae","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/4331","title":{"rendered":"EXT4\u6302\u8f7dMount\u53c2\u6570\u5206\u6790\u548c\u5efa\u8bae"},"content":{"rendered":"<p>\u672c\u6587\u6839\u636e\u5404\u79cd\u6d4b\u8bd5\u7ed3\u679c\u548c\u5b9e\u9645\u5de5\u7a0b\u7ecf\u9a8c\uff0c\u5bf9Ext4\u548cXFS\u7684\u6302\u8f7d\u53c2\u6570(mount)\u7ed9\u51fa\u53c2\u6570\u5206\u6790\u548c\u5efa\u8bae\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2b245e3c9cd\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2b245e3c9cd\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#%E6%80%BB%E7%BB%93\" >Summary<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#noatime\" >noatime<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#nodiratime\" >nodiratime<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#relatime\" >relatime<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#nobarrier\" >nobarrier<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#datajournal\" >data=journal<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#datawriteback\" >data=writeback&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#defaults\" >defaults<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#delalloc\" >delalloc<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#nodelalloc\" >nodelalloc<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#discard\" >discard<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.gbase8.cn\/en\/4331\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u4e0b\u53c2\u6570\u662f\u5927\u6570\u636e\u73af\u5883\u4e0b\u63a8\u8350\u4f7f\u7528\u7684\u3002<\/p>\n\n\n\n<p>noatime,nodelalloc<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"noatime\"><\/span>noatime<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4e0d\u66f4\u65b0\u6587\u4ef6\u7cfb\u7edf\u4e0a inode \u8bbf\u95ee\u8bb0\u5f55\uff0c\u53ef\u4ee5\u63d0\u5347\u6027\u80fd\u3002<\/p>\n\n\n\n<p>&nbsp;Linux \u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f7f\u7528<code>atime<\/code>\u9009\u9879\uff0c\u6bcf\u6b21\u5728\u78c1\u76d8\u4e0a\u8bfb\u53d6\uff08\u6216\u5199\u5165\uff09\u6570\u636e\u65f6\u90fd\u4f1a\u4ea7\u751f\u4e00\u4e2a\u8bb0\u5f55\u3002\u9ed8\u8ba4\u7684<code>atime<\/code>&nbsp;\u9009\u9879\u6700\u5927\u7684\u95ee\u9898\u5728\u4e8e\u5373\u4f7f\u4ece\u9875\u9762\u7f13\u5b58\u8bfb\u53d6\u6587\u4ef6(\u4ece\u5185\u5b58\u800c\u4e0d\u662f\u78c1\u76d8\u8bfb\u53d6)\uff0c\u4e5f\u4f1a\u4ea7\u751f\u78c1\u76d8\u5199\u64cd\u4f5c\uff01<\/p>\n\n\n\n<p>\u4f7f\u7528&nbsp;<code>noatime<\/code>&nbsp;\u9009\u9879\u963b\u6b62\u4e86\u8bfb\u6587\u4ef6\u65f6\u7684\u5199\u64cd\u4f5c\u3002\u5927\u90e8\u5206\u5e94\u7528\u7a0b\u5e8f\u90fd\u80fd\u5f88\u597d\u5de5\u4f5c\u3002\u53ea\u6709\u5c11\u6570\u7a0b\u5e8f\u5982 Mutt \u9700\u8981\u8fd9\u4e9b\u4fe1\u606f\u3002Mutt \u7684\u7528\u6237\u5e94\u8be5\u4f7f\u7528<code>relatime<\/code>&nbsp;\u9009\u9879\u3002\u4f7f\u7528&nbsp;<code>relatime<\/code>&nbsp;\u9009\u9879\u540e\uff0c\u53ea\u6709\u6587\u4ef6\u88ab\u4fee\u6539\u65f6\u624d\u4f1a\u4ea7\u751f\u6587\u4ef6\u8bbf\u95ee\u65f6\u95f4\u5199\u64cd\u4f5c\u3002<code>nodiratime<\/code>&nbsp;\u9009\u9879\u4ec5\u5bf9\u76ee\u5f55\u7981\u7528\u4e86\u6587\u4ef6\u8bbf\u95ee\u65f6\u95f4\u3002<code>relatime<\/code>&nbsp;\u662f\u6bd4\u8f83\u597d\u7684\u6298\u8877\uff0cMutt \u7b49\u7a0b\u5e8f\u8fd8\u80fd\u5de5\u4f5c\uff0c\u4f46\u662f\u4ecd\u7136\u80fd\u591f\u901a\u8fc7\u51cf\u5c11\u8bbf\u95ee\u65f6\u95f4\u66f4\u65b0\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u3002<\/p>\n\n\n\n<p><strong>\u6ce8\u610f:&nbsp;<\/strong><code>noatime<\/code>&nbsp;\u5df2\u7ecf\u5305\u542b\u4e86&nbsp;<code>nodiratime<\/code>\u3002\u4e0d\u9700\u8981\u540c\u65f6\u6307\u5b9a\u3002<\/p>\n\n\n\n<p>Do not update inode access times on this filesystem (e.g., for faster access on the  news spool to speed up news servers).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"nodiratime\"><\/span>nodiratime<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4e0d\u66f4\u65b0\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\u76ee\u5f55 inode \u8bbf\u95ee\u8bb0\u5f55\uff0c\u53ef\u4ee5\u63d0\u5347\u6027\u80fd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"relatime\"><\/span>relatime<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5b9e\u65f6\u66f4\u65b0 inode access \u8bb0\u5f55\u3002\u53ea\u6709\u5728\u8bb0\u5f55\u4e2d\u7684\u8bbf\u95ee\u65f6\u95f4\u65e9\u4e8e\u5f53\u524d\u8bbf\u95ee\u624d\u4f1a\u88ab\u66f4\u65b0\u3002\uff08\u4e0e noatime \u76f8\u4f3c\uff0c\u4f46\u4e0d\u4f1a\u6253\u65ad\u5982 mutt \u6216\u5176\u5b83\u7a0b\u5e8f\u63a2\u6d4b\u6587\u4ef6\u5728\u4e0a\u6b21\u8bbf\u95ee\u540e\u662f\u5426\u88ab\u4fee\u6539\u7684\u8fdb\u7a0b\u3002\uff09\uff0c\u53ef\u4ee5\u63d0\u5347\u6027\u80fd\u3002<\/p>\n\n\n\n<p>Update inode access times relative to modify or change time. Access time is only updated if the previous access time was earlier than the current modify or change time. (Similar to noatime, but doesn\u2019t break mutt or other applications that need to know if a file has been read since the last time it was modified.)<\/p>\n\n\n\n<p>Since Linux 2.6.30, the kernel defaults to the behavior provided by this option (unless noatime was specified), and the strictatime option is required to obtain traditional semantics. In addition, since Linux 2.6.30, the file\u2019s last access time is always updated if it is more than 1 day old.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"nobarrier\"><\/span>nobarrier<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This disables the use of write barriers in the jbd code. This also requires an IO stack which can support barriers, and if jbd gets an error on a barrier write, it will disable again with a warning. Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty. If your disks are battery-backed in one way or another, disabling barriers may safely improve performance. The mount options \"barrier\" and \"nobarrier\" can also be used to enable or disable barriers, for consistency with other ext4 mount options.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"datajournal\"><\/span>data=journal<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>All data are committed into the journal prior to being written into the main file system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"datawriteback\"><\/span>data=writeback&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Data ordering is not preserved, data may be written into the main file system after its metadata has been committed to the journal.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"defaults\"><\/span>defaults<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Use default options: rw, suid, dev, exec, auto, nouser, and async.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"delalloc\"><\/span>delalloc<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>&nbsp;(*)&nbsp;Defer block allocation until just before ext4 writes out the block(s) in question.&nbsp; This allows ext4 to better allocation decisions more efficiently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"nodelalloc\"><\/span>nodelalloc<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Disable delayed allocation. Blocks are allocated when the data is copied from userspace to the page cache, either via the write(2) system call or when an mmap'ed page which was previously unallocated is written for the first time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"discard\"><\/span>discard<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>SSD\u78c1\u76d8\uff0c\u4e0d\u8981\u6dfb\u52a0discard\u53c2\u6570\u3002Ext4\u9ed8\u8ba4\u662fnodiscard\u3002<\/p>\n\n\n\n<p>Controls whether ext4 should issue discard\/TRIM commands to the underlying block device when blocks are freed. This is useful for SSD devices and sparse\/thinly-provisioned LUNs, but it is off by default until sufficient testing has been done.<\/p>\n\n\n\n<p>IMPORTANT: Do not discard blocks in filesystem usage.<br>Be sure to turn off the discard option when making your Linux filesystem. You want to allow the SSD manage<br>blocks and its activity between the NVM (non-volatile memory) and host with more advanced and consistent<br>approaches in the SSD Controller.<br>Core Filesystems:<br>\u2022 ext4 \u2013 the default extended option is not to discard blocks at filesystem make time, retain this, and do not<br>add the \u201cdiscard\u201d extended option as some information will tell you to do.<br>\u2022 xfs \u2013 with mkfs.xfs, add the \u2013K option so that you do not discard blocks.<br>If you are going to use a software RAID, it is recommended to use a chunk size of 128k as starting point, depending<br>on the workload you are going to run. You must always test your workload.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.intel.com\/content\/dam\/support\/us\/en\/documents\/ssdc\/data-center-ssds\/Intel_Linux_NVMe_Guide_330602-002.pdf\">https:\/\/www.intel.com\/content\/dam\/support\/us\/en\/documents\/ssdc\/data-center-ssds\/Intel_Linux_NVMe_Guide_330602-002.pdf<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u6839\u636e\u5404\u79cd\u6d4b\u8bd5\u7ed3\u679c\u548c\u5b9e\u9645\u5de5\u7a0b\u7ecf\u9a8c\uff0c\u5bf9Ext4\u548cXFS\u7684\u6302\u8f7d\u53c2\u6570(mount)\u7ed9\u51fa\u53c2\u6570\u5206\u6790\u548c\u5efa\u8bae\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[72],"class_list":["post-4331","post","type-post","status-publish","format-standard","hentry","category-1","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/4331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=4331"}],"version-history":[{"count":32,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/4331\/revisions"}],"predecessor-version":[{"id":5874,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/4331\/revisions\/5874"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=4331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=4331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=4331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}