{"id":2539,"date":"2020-12-22T11:28:44","date_gmt":"2020-12-22T03:28:44","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=2539"},"modified":"2021-01-08T11:07:39","modified_gmt":"2021-01-08T03:07:39","slug":"linux-%e9%80%9a%e8%bf%87debugfs%e6%9f%a5%e7%9c%8b%e6%96%87%e4%bb%b6%e7%9a%84%e7%9c%9f%e6%ad%a3%e5%88%9b%e5%bb%ba%e6%97%b6%e9%97%b4%ef%bc%8c%e4%b8%8d%e6%98%afstat%e9%87%8c%e9%9d%a2%e7%9a%84accessmodif","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/2539","title":{"rendered":"Linux \u901a\u8fc7debugfs\u67e5\u770b\u6587\u4ef6\u7684\u771f\u6b63\u521b\u5efa\u65f6\u95f4\uff0c\u4e0d\u662fstat\u91cc\u9762\u7684access,modify\u548cchange\u65f6\u95f4\uff0c\u800c\u662fcrtime"},"content":{"rendered":"<p>stat\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u5230\u8bbf\u95ee\u65f6\u95f4\uff0c\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u5c5e\u6027\u53d8\u52a8\u7684\u6539\u52a8\u65f6\u95f4\uff0c\u4f46\u770b\u4e0d\u5230\u521b\u5efa\u65f6\u95f4\u3002 \u672c\u6587\u4ecb\u7ecd\u7528\u8fc7debugfs\u6765\u83b7\u53d6\u6587\u4ef6\u771f\u662f\u7684\u521b\u5efa\u65f6\u95f4\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-6a2b1ef41d3c3\" 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-6a2b1ef41d3c3\"  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\/2539\/#stat%E7%9A%84%E8%BE%93%E5%87%BA\" >stat\u7684\u8f93\u51fa<\/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\/2539\/#debugfs%E5%91%BD%E4%BB%A4\" >debugfs\u547d\u4ee4<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/2539\/#%E8%8E%B7%E5%BE%97inode%E7%9A%84%E6%96%B9%E6%B3%95\" >\u83b7\u5f97inode\u7684\u65b9\u6cd5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/2539\/#debugfs%E8%8E%B7%E5%BE%97inode%E4%BF%A1%E6%81%AF\" >debugfs\u83b7\u5f97inode\u4fe1\u606f<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/2539\/#%E6%96%B9%E6%B3%951%EF%BC%8C_%E7%94%A8inode%E5%8F%B7\" >\u65b9\u6cd51\uff0c \u7528inode\u53f7<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/2539\/#%E6%96%B9%E6%B3%952%EF%BC%8C%E7%9B%B4%E6%8E%A5%E7%94%A8%E8%B7%AF%E5%BE%84\" >\u65b9\u6cd52\uff0c\u76f4\u63a5\u7528\u8def\u5f84<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/2539\/#%E5%8A%A0%E4%B8%8Agrep%E8%BF%87%E6%BB%A4crtime\" >\u52a0\u4e0agrep\u8fc7\u6ee4crtime<\/a><\/li><\/ul><\/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\/2539\/#%E6%80%BB%E7%BB%93\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"stat%E7%9A%84%E8%BE%93%E5%87%BA\"><\/span>stat\u7684\u8f93\u51fa<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# stat \/opt\/gnode\/userdata\/gbase\/gctmpdb\/metadata\n  File: `\/opt\/gnode\/userdata\/gbase\/gctmpdb\/metadata'\n  Size: 4096            Blocks: 8          IO Block: 4096   directory\nDevice: 802h\/2050d      Inode: 1465051     Links: 2\nAccess: (0700\/drwx------)  Uid: (  500\/   gbase)   Gid: (  500\/   gbase)\nAccess: 2020-12-22 09:15:11.470000001 +0800\nModify: 2020-12-22 09:56:36.025000002 +0800\nChange: 2020-12-22 09:56:36.025000002 +0800\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"debugfs%E5%91%BD%E4%BB%A4\"><\/span>debugfs\u547d\u4ee4<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u539f\u7406\u662f\u6839\u636e\u6587\u4ef6\u7684inode\uff0c\u83b7\u5f97\u5176\u521b\u5efa\u65f6\u95f4\uff0c\u9664\u975e\u6587\u4ef6\u6216\u76ee\u5f55\u88ab\u91cd\u5efa\u4e14inode\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u5426\u5219inode\u7684\u65f6\u95f4\u5c31\u662f\u5bf9\u5e94\u7684\u521b\u5efa\u65f6\u95f4\u3002<\/p>\n\n\n\n<p>\u8f93\u51fa\u5185\u5bb9\u4e2d\u7684 crtime \u5c31\u662f\u521b\u5efa\u65f6\u95f4\u3002<\/p>\n\n\n\n<p>\u53e6\u5916\uff0c ctime\u662f\u6700\u540e\u5c5e\u6027\u6539\u53d8\u65f6\u95f4\uff0c\u7b49\u540c\u4e8eChange time\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%8E%B7%E5%BE%97inode%E7%9A%84%E6%96%B9%E6%B3%95\"><\/span>\u83b7\u5f97inode\u7684\u65b9\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>ls \u7528 -i\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# ls -id \/opt\/gnode\/userdata\/gbase\/gctmpdb\/metadata\n1465051 \/opt\/gnode\/userdata\/gbase\/gctmpdb\/metadata\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"debugfs%E8%8E%B7%E5%BE%97inode%E4%BF%A1%E6%81%AF\"><\/span>debugfs\u83b7\u5f97inode\u4fe1\u606f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u547d\u4ee4\u6837\u5f0f\u5982\u4e0b<\/p>\n\n\n\n<p>debugfs -R 'stat XXXXX' \/dev\/sdX<\/p>\n\n\n\n<p>\u5176\u4e2d\u540e\u9762\u7684\/dev\/sda2\u662f\u6587\u4ef6\u5bf9\u5e94\u7684\u8bbe\u5907\u7f16\u53f7\uff0c\u53ef\u4ee5\u4ecedf\u8f93\u51fa\u91cc\u770b\u5230\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# df\nFilesystem           1K-blocks      Used Available Use% Mounted on\n\/dev\/sda2             28898428   5742124  21688352  21% \/\ntmpfs                  4095964     44208   4051756   2% \/dev\/shm\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%96%B9%E6%B3%951%EF%BC%8C_%E7%94%A8inode%E5%8F%B7\"><\/span>\u65b9\u6cd51\uff0c \u7528inode\u53f7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u7528stat &lt;inode&gt; \u4f5c\u4e3a\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# debugfs -R 'stat &lt;1465051&gt;' \/dev\/sda2\ndebugfs 1.41.12 (17-May-2010)\nInode: 1465051   Type: directory    Mode:  0700   Flags: 0x80000\nGeneration: 1377903021    Version: 0x00000000:0002eb62\nUser:   500   Group:   500   Size: 4096\nFile ACL: 0    Directory ACL: 0\nLinks: 2   Blockcount: 8\nFragment:  Address: 0    Number: 0    Size: 0\n ctime: 0x5fe15254:05f5e108 -- Tue Dec 22 09:56:36 2020\n atime: 0x5fe1663b:c7516b34 -- Tue Dec 22 11:21:31 2020\n mtime: 0x5fe15254:05f5e108 -- Tue Dec 22 09:56:36 2020\ncrtime: 0x5f976f18:3bd7d2d4 -- Tue Oct 27 08:51:36 2020\nSize of extra inode fields: 28\nEXTENTS:\n(0): 5777189\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%96%B9%E6%B3%952%EF%BC%8C%E7%9B%B4%E6%8E%A5%E7%94%A8%E8%B7%AF%E5%BE%84\"><\/span>\u65b9\u6cd52\uff0c\u76f4\u63a5\u7528\u8def\u5f84<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u7528\u76ee\u5f55\u4f5c\u4e3astat\u7684\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# debugfs -R 'stat \/opt\/gnode\/userdata\/gbase\/gctmpdb\/metadata' \/dev\/sda2\ndebugfs 1.41.12 (17-May-2010)\nInode: 1465051   Type: directory    Mode:  0700   Flags: 0x80000\nGeneration: 1377903021    Version: 0x00000000:0002eb62\nUser:   500   Group:   500   Size: 4096\nFile ACL: 0    Directory ACL: 0\nLinks: 2   Blockcount: 8\nFragment:  Address: 0    Number: 0    Size: 0\n ctime: 0x5fe15254:05f5e108 -- Tue Dec 22 09:56:36 2020\n atime: 0x5fe1489f:700e8604 -- Tue Dec 22 09:15:11 2020\n mtime: 0x5fe15254:05f5e108 -- Tue Dec 22 09:56:36 2020\ncrtime: 0x5f976f18:3bd7d2d4 -- Tue Oct 27 08:51:36 2020\nSize of extra inode fields: 28\nEXTENTS:\n(0): 5777189\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8A%A0%E4%B8%8Agrep%E8%BF%87%E6%BB%A4crtime\"><\/span>\u52a0\u4e0agrep\u8fc7\u6ee4crtime<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# debugfs -R 'stat \/opt\/gnode\/userdata\/gbase\/gctmpdb\/metadata' \/dev\/sda2 | grep crtime\ndebugfs 1.41.12 (17-May-2010)\ncrtime: 0x5f976f18:3bd7d2d4 -- Tue Oct 27 08:51:36 2020\n&#91;root@rh6-1 ~]# debugfs -R 'stat \/opt\/gnode\/userdata\/gbase\/gctmpdb\/sys_tablespace' \/dev\/sda2 | grep crtime\ndebugfs 1.41.12 (17-May-2010)\ncrtime: 0x5f976f18:3bd7d2d4 -- Tue Oct 27 08:51:36 2020\n&#91;root@rh6-1 ~]#\n<\/code><\/pre>\n\n\n\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>\u8981\u662finode\u7684create\u65f6\u95f4\u662f\u6211\u4eec\u5b89\u88c5\u65f6\u95f4\uff0c\u90a3\u5c31\u4e0d\u662f\u5e94\u7528\u7684\u4f7f\u7528\u95ee\u9898\uff0c\u800c\u662f\u6587\u4ef6\u7cfb\u7edf\u6545\u969c\u3002 \u5982\u679c\u662f\u6700\u8fd1\u7684\u5176\u5b83\u65f6\u95f4\uff0c\u53ef\u4ee5\u67e5\u770b\u5bf9\u5e94\u90a3\u4e2a\u65f6\u95f4\u70b9\u5230\u5e95\u51fa\u4e86\u5565\u4e8b\u60c5\uff0c\u6bd4\u5982\u91cd\u5efa\u4e86\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>stat\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u5230\u8bbf\u95ee\u65f6\u95f4\uff0c\u4fee\u6539\u65f6\u95f4\u4ee5\u53ca\u5c5e\u6027\u53d8\u52a8\u7684\u6539\u52a8\u65f6\u95f4\uff0c\u4f46\u770b\u4e0d\u5230\u521b\u5efa\u65f6\u95f4\u3002 \u672c\u6587\u4ecb\u7ecd\u7528\u8fc7debugfs\u6765\u83b7\u53d6\u6587\u4ef6\u771f\u662f\u7684\u521b\u5efa\u65f6\u95f4\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":[],"class_list":["post-2539","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2539","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=2539"}],"version-history":[{"count":7,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2539\/revisions"}],"predecessor-version":[{"id":3202,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2539\/revisions\/3202"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=2539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=2539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=2539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}