{"id":115302,"date":"2026-10-11T20:25:36","date_gmt":"2026-10-11T12:25:36","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115302.html"},"modified":"2026-10-11T20:25:36","modified_gmt":"2026-10-11T12:25:36","slug":"%e3%80%90linux-%e7%b3%bb%e7%bb%9f%e7%af%87%e4%ba%8c%e5%8d%81%e5%85%ab%e3%80%91%e6%96%87%e4%bb%b6%e4%ba%94%ef%bc%9aext-%e7%b3%bb%e5%88%97%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f%ef%bc%88%e4%b8%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115302.html","title":{"rendered":"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122531-6acb803b29d5e.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"300\" \/><\/p>\n<p>  \u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230 huangjin007_ \u7684\u535a\u5ba2<br \/>\n  \u2b50<br \/>\n \u4e2a\u4eba\u4e3b\u9875&#xff1a;huangjin007_<br \/>\n  &#x1f525;<br \/>\n \u6587\u7ae0\u6536\u5f55\u4e13\u680f&#xff1a;Linux \u5185\u529f\u4fee\u70bc\u624b\u518c(\u7cfb\u7edf\u7bc7)  <\/p>\n<p> <font color=\"#d97706\"><b>\u603b\u4f1a\u6709\u4e00\u4e9b\u575a\u6301\u80fd\u4ece\u51b0\u5c01\u7684\u571f\u5730\u91cc\u57f9\u80b2\u51fa\u5341\u4e07\u6735\u6012\u653e\u7684\u8537\u8587<\/b><\/font> <\/p>\n<hr \/>\n<h2>Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406<\/h2>\n<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406<\/li>\n<li>\n<ul>\n<li>1. Ext2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8f\u89c2\u8ba4\u8bc6<\/li>\n<li>2. \u6df1\u5165\u7406\u89e3Block Group&#xff08;\u5757\u7ec4&#xff09;\u4e0e\u5185\u90e8\u6784\u6210<\/li>\n<li>\n<ul>\n<li>2.1 \u64e6\u9664\u4e0e\u8986\u76d6&#xff1a;\u5757\u4f4d\u56fe&#xff08;Block Bitmap&#xff09;\u7684\u8bde\u751f<\/li>\n<li>2.2 \u627e\u56de\u6587\u4ef6\u7684\u56f0\u96be&#xff1a;inode\u4e0einode\u8868&#xff08;Inode Table&#xff09;\u7684\u8bde\u751f<\/li>\n<li>2.3 \u518d\u6b21\u4f18\u5316&#xff1a;inode\u4f4d\u56fe&#xff08;Inode Bitmap&#xff09;\u7684\u8bde\u751f<\/li>\n<li>2.4 \u8bb0\u5f55\u7ba1\u7406\u8005\u7684\u5f52\u5c5e&#xff1a;\u5757\u7ec4\u63cf\u8ff0\u7b26&#xff08;GDT&#xff09;\u7684\u8bde\u751f<\/li>\n<li>2.5 \u7edf\u7b79\u5168\u5c40&#xff1a;\u8d85\u7ea7\u5757&#xff08;Super Block&#xff09;\u7684\u8bde\u751f<\/li>\n<li>2.6 \u68b3\u7406\u6838\u5fc3\u6d41\u7a0b&#xff1a;\u4e00\u4e2a\u6587\u4ef6\u7684\u5b8c\u6574\u5199\u5165\u751f\u547d\u5468\u671f<\/li>\n<li>2.7 Data Block \u6570\u636e\u533a<\/li>\n<\/ul>\n<\/li>\n<li>3. \u6838\u5fc3\u673a\u5236&#xff1a;inode\u4e0eData Block\u7684\u6620\u5c04<\/li>\n<li>\n<ul>\n<li>3.1 \u521d\u6b65\u5c1d\u8bd5&#xff1a;\u76f4\u63a5\u8bb0\u5f55&#xff08;12\u4e2a\u76f4\u63a5\u5757\u6307\u9488&#xff09;<\/li>\n<li>3.2 \u9047\u5230\u95ee\u9898&#xff1a;\u5982\u4f55\u5bb9\u7eb3\u5927\u6587\u4ef6&#xff1f;&#xff08;\u591a\u7ea7\u95f4\u63a5\u5757\u6307\u9488\u7684\u8bde\u751f&#xff09;<\/li>\n<li>3.3 \u878d\u4f1a\u8d2f\u901a&#xff1a;\u6e90\u7801\u4e2d\u7684inode\u7ed3\u6784\u4f53<\/li>\n<li>3.4 \u601d\u8003&#xff1a;\u77e5\u9053inode\u53f7&#xff0c;\u7a76\u7adf\u610f\u5473\u7740\u4ec0\u4e48&#xff1f;<\/li>\n<\/ul>\n<\/li>\n<li>4. \u76ee\u5f55\u4e0e\u6587\u4ef6\u540d&#xff1a;\u6253\u7834\u201c\u76ee\u5f55\u201d\u7684\u8ba4\u77e5\u58c1\u5792<\/li>\n<li>5. \u8def\u5f84\u89e3\u6790\u4e0e\u8def\u5f84\u7f13\u5b58&#xff08;dentry&#xff09;<\/li>\n<li>\n<ul>\n<li>5.1 \u8def\u5f84\u89e3\u6790<\/li>\n<li>5.2 \u95ee\u9898&#xff1a;\u6781\u5ea6\u9891\u7e41\u7684\u78c1\u76d8IO<\/li>\n<li>5.3 \u5185\u5b58\u91cc\u7684\u76ee\u5f55\u6811&#xff1a;dentry\u7ed3\u6784\u4f53<\/li>\n<li>5.4 \u6838\u5fc3\u603b\u7ed3<\/li>\n<\/ul>\n<\/li>\n<li>6. \u6302\u8f7d\u5206\u533a&#xff08;Mount&#xff09;<\/li>\n<li>\n<ul>\n<li>6.1 \u5b9e\u64cd\u6f14\u793amount\u6302\u8f7d\u955c\u50cf\u6587\u4ef6<\/li>\n<li>6.2 \u6302\u8f7d\u6838\u5fc3\u7ed3\u8bba<\/li>\n<\/ul>\n<\/li>\n<li>7. \u8f6f\u786c\u8fde\u63a5<\/li>\n<li>\n<ul>\n<li>7.1 \u786c\u94fe\u63a5&#xff08;Hard Link&#xff09;<\/li>\n<li>7.2 \u6df1\u5165\u4e86\u89e3&#xff1a;\u76ee\u5f55\u4e5f\u6709\u786c\u94fe\u63a5\u5417&#xff1f;<\/li>\n<li>7.3 \u4e3a\u4ec0\u4e48\u7981\u6b62\u7528\u6237\u7ed9\u76ee\u5f55\u5efa\u786c\u94fe\u63a5&#xff1f;&#xff08;\u73af\u8def\u95ee\u9898&#xff09;<\/li>\n<li>7.4 \u8f6f\u94fe\u63a5&#xff08;Symbolic Link&#xff09;<\/li>\n<li>7.5 \u6587\u4ef6\u4e09\u4e2a\u65f6\u95f4\u6233<\/li>\n<li>7.6 \u6838\u5fc3\u5bf9\u6bd4\u4e0e\u603b\u7ed3<\/li>\n<\/ul>\n<\/li>\n<li>\u7ed3\u8bed&#xff1a;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<p>\u4e0a\u7bc7\u6587\u7ae0\u94fe\u63a5&#xff1a;\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u4e03)\u3011\u6587\u4ef6(\u56db)&#xff1a;Ext \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf&#xff08;\u4e0a&#xff09;&#xff1a;\u4ece\u7269\u7406\u78c1\u76d8\u5230\u903b\u8f91\u62bd\u8c61<\/p>\n<hr \/>\n<h3>1. Ext2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8f\u89c2\u8ba4\u8bc6<\/h3>\n<p>\u2003\u2003\u5982\u679c\u6211\u4eec\u60f3\u5728\u786c\u76d8\u4e2d\u5b58\u50a8\u6587\u4ef6&#xff0c;\u4e0d\u80fd\u76f4\u63a5\u5f80\u88f8\u78c1\u76d8\u91cc\u5199\u6570\u636e&#xff0c;\u5fc5\u987b\u5148\u628a\u78c1\u76d8\u5206\u533a\u683c\u5f0f\u5316\u4e3a\u67d0\u4e00\u79cd\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u4e4b\u540e\u64cd\u4f5c\u7cfb\u7edf\u624d\u77e5\u9053\u5982\u4f55\u7ec4\u7ec7\u3001\u7ba1\u7406\u78c1\u76d8\u4e0a\u7684\u6587\u4ef6\u3002\u6587\u4ef6\u7cfb\u7edf\u672c\u8d28\u7684\u76ee\u6807&#xff0c;\u5c31\u662f\u5e2e\u6211\u4eec\u628a\u6742\u4e71\u7684\u78c1\u76d8\u6247\u533a&#xff0c;\u6709\u5e8f\u7ba1\u7406\u8d77\u6765&#xff0c;\u5b58\u653e\u6587\u4ef6\u5185\u5bb9\u3001\u6587\u4ef6\u5c5e\u6027\u3002<\/p>\n<p>\u2003\u2003\u5728Linux \u7cfb\u7edf\u4e2d&#xff0c;\u6700\u5e38\u89c1\u7684\u662f ext2 \u7cfb\u5217\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u5176\u65e9\u671f\u7248\u672c\u4e3a ext2&#xff0c;\u540e\u6765\u53c8\u53d1\u5c55\u51fa ext3 \u548c ext4\u3002ext3 \u548c ext4 \u867d\u7136\u5bf9 ext2 \u8fdb\u884c\u4e86\u589e\u5f3a&#xff0c;\u4f46\u662f\u5176\u6838\u5fc3\u8bbe\u8ba1\u5e76\u6ca1\u6709\u53d1\u751f\u53d8\u5316&#xff0c;\u6211\u4eec\u4ecd\u662f\u4ee5\u8f83\u8001\u7684 ext2 \u4f5c\u4e3a\u8bb2\u89e3\u5bf9\u8c61\u3002<\/p>\n<p>\u2003\u2003ext2\u4f1a\u628a\u4e00\u4e2a\u78c1\u76d8\u5206\u533a&#xff0c;\u5207\u5206\u6210\u82e5\u5e72\u4e2a\u5927\u5c0f\u5b8c\u5168\u76f8\u540c\u7684\u5757\u7ec4&#xff08;Block Group&#xff09;\u3002\u53ea\u8981\u80fd\u7ba1\u7406\u4e00\u4e2a\u5206\u533a\u5c31\u80fd\u7ba1\u7406\u6240\u6709\u5206\u533a&#xff0c;\u4e5f\u5c31\u80fd\u7ba1\u7406\u6240\u6709\u78c1\u76d8\u6587\u4ef6\u3002\u53ea\u8981\u5f04\u61c2\u5355\u4e2a\u5757\u7ec4\u5982\u4f55\u7ba1\u7406&#xff0c;\u5c31\u80fd\u7406\u89e3\u6574\u4e2a\u5206\u533a&#xff0c;\u8fdb\u800c\u7406\u89e3\u6574\u5757\u78c1\u76d8\u7684\u6587\u4ef6\u7ba1\u7406\u903b\u8f91\u3002<\/p>\n<p>\u8fd9\u91cc\u8981\u5355\u72ec\u63d0\u542f\u52a8\u5757&#xff08;Boot Block \/ Boot Sector&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\u5927\u5c0f\u56fa\u5b9a\u4e3a1KB&#xff0c;\u662fPC\u786c\u4ef6\u6807\u51c6\u89c4\u5b9a\u7684\u3002<\/li>\n<li>\u5b58\u653e\u5206\u533a\u5f15\u5bfc\u3001\u542f\u52a8\u76f8\u5173\u4fe1\u606f&#xff0c;\u4efb\u4f55\u6587\u4ef6\u7cfb\u7edf\u90fd\u4e0d\u80fd\u4fee\u6539\u542f\u52a8\u5757\u3002<\/li>\n<li>\u542f\u52a8\u5757\u4e4b\u540e\u7684\u7a7a\u95f4&#xff0c;\u624d\u662fext2\u6587\u4ef6\u7cfb\u7edf\u771f\u6b63\u5f00\u59cb\u7684\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122532-6acb803c38a67.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"600\" \/><\/p>\n<p>\u7c7b\u6bd4\u7406\u89e3&#xff1a;\u628a\u78c1\u76d8\u5206\u533a\u60f3\u8c61\u6210\u4e00\u5ea7\u5927\u578b\u5199\u5b57\u697c&#xff0c;\u542f\u52a8\u5757\u5c31\u662f\u5927\u697c\u5927\u95e8\u7684\u95e8\u7981\u3002\u5927\u697c\u5185\u90e8\u88ab\u5212\u5206\u6210\u4e00\u4e2a\u4e2a\u72ec\u7acb\u7684\u5355\u5143\u623f\u95f4&#xff0c;\u6bcf\u4e00\u4e2a\u5355\u5143\u623f\u95f4\u5c31\u662f\u4e00\u4e2aBlock Group&#xff0c;\u6bcf\u4e2a\u5355\u5143\u5185\u90e8\u90fd\u914d\u5907\u4e00\u5957\u5b8c\u6574\u7684\u7ba1\u7406\u53f0\u8d26&#xff0c;\u72ec\u7acb\u7ba1\u7406\u81ea\u5df1\u5185\u90e8\u8d44\u6e90\u3002<\/p>\n<hr \/>\n<h3>2. \u6df1\u5165\u7406\u89e3Block Group&#xff08;\u5757\u7ec4&#xff09;\u4e0e\u5185\u90e8\u6784\u6210<\/h3>\n<p>\u2003\u2003\u6211\u4eec\u5df2\u7ecf\u77e5\u9053\u4e86\u5206\u533a\u683c\u5f0f\u5316\u540e\u4f1a\u88ab\u5212\u5206\u4e3a\u4e00\u4e2a\u4e2a\u56fa\u5b9a\u5927\u5c0f\u7684\u5757&#xff08;Block&#xff09;&#xff0c;\u6240\u6709\u7684\u78c1\u76d8\u8bfb\u5199\u90fd\u4ee5\u5757\u4e3a\u5355\u4f4d\u3002\u73b0\u5728&#xff0c;\u6211\u4eec\u629b\u5f00\u90a3\u4e9b\u751f\u6da9\u7684\u6982\u5ff5&#xff0c;\u987a\u7740\u201c\u53d1\u73b0\u95ee\u9898\u3001\u89e3\u51b3\u95ee\u9898\u201d\u7684\u601d\u8def&#xff0c;\u4e00\u6b65\u6b65\u63a8\u5bfc\u51faEXT2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u7269\u7406\u5e03\u5c40\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122532-6acb803caf739.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"600\" \/><\/p>\n<h4>2.1 \u64e6\u9664\u4e0e\u8986\u76d6&#xff1a;\u5757\u4f4d\u56fe&#xff08;Block Bitmap&#xff09;\u7684\u8bde\u751f<\/h4>\n<p>\u2003\u2003\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u5757\u521a\u683c\u5f0f\u5316\u597d\u7684\u7a7a\u767d\u78c1\u76d8&#xff0c;\u91cc\u9762\u88ab\u5212\u5206\u6210\u4e86\u65e0\u6570\u4e2a\u5927\u5c0f\u76f8\u540c\u7684\u5757\u3002\u73b0\u5728\u6211\u4eec\u8981\u5b58\u5165\u4e00\u4e2a\u6587\u4ef6\u3002\u5982\u679c\u968f\u610f\u5206\u914d\u7a7a\u95f4&#xff0c;\u628a\u6587\u4ef6\u7684\u6570\u636e\u5199\u8fdb\u4e86\u4e00\u4e2a\u4e4b\u524d\u5df2\u5b58\u6709\u5176\u4ed6\u6587\u4ef6\u7684\u5757\u4e2d&#xff0c;\u5c31\u4f1a\u53d1\u751f\u8986\u76d6&#xff0c;\u5bfc\u81f4\u539f\u6587\u4ef6\u635f\u574f\u3002\u6240\u4ee5&#xff0c;\u6211\u4eec\u5f97\u6709\u4e00\u4e2a\u201c\u8d26\u672c\u201d&#xff0c;\u8bb0\u5f55\u6bcf\u4e2a\u5757\u6709\u6ca1\u6709\u88ab\u4f7f\u7528\u3002<\/p>\n<p>\u2003\u2003\u4e3a\u4e86\u8282\u7701\u7a7a\u95f4&#xff0c;\u8fd9\u4e2a\u201c\u8d26\u672c\u201d\u6781\u5176\u7cbe\u7b80&#xff0c;\u5b83\u5c31\u662f\u5757\u4f4d\u56fe&#xff08;Block Bitmap&#xff09;&#xff1a;\u672c\u8d28\u662f\u4e00\u4e32\u4e8c\u8fdb\u5236bit&#xff0c;\u4e00\u4e2abit\u5bf9\u5e94\u4e00\u4e2aData Block\u3002bit&#061;0\u4ee3\u8868\u7a7a\u95f2&#xff0c;bit&#061;1\u4ee3\u8868\u5360\u7528\u3002\u65b0\u5efa\u6587\u4ef6\u9700\u8981\u78c1\u76d8\u7a7a\u95f4\u65f6&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u626b\u63cf\u5757\u4f4d\u56fe\u5bfb\u627e\u503c\u4e3a0\u7684bit&#xff0c;\u5206\u914d\u5bf9\u5e94block\u5e76\u6807\u8bb0\u4e3a1&#xff1b;\u5220\u9664\u6587\u4ef6\u91ca\u653e\u7a7a\u95f4&#xff0c;\u628a\u5bf9\u5e94bit\u91cd\u65b0\u7f6e0\u3002\u4f4d\u56fe\u672c\u8eab\u4e5f\u5360\u7528\u78c1\u76d8block&#xff0c;\u4e14\u53ea\u7ba1\u7406\u5f53\u524d\u5757\u7ec4\u5185\u7684\u6570\u636e\u5757\u3002<\/p>\n<h4>2.2 \u627e\u56de\u6587\u4ef6\u7684\u56f0\u96be&#xff1a;inode\u4e0einode\u8868&#xff08;Inode Table&#xff09;\u7684\u8bde\u751f<\/h4>\n<p>\u2003\u2003\u6570\u636e\u6210\u529f\u5199\u5165\u540e&#xff0c;\u6211\u4eec\u5c1d\u8bd5\u53bb\u8bfb\u53d6\u521a\u624d\u7684\u6587\u4ef6\u3002\u6b64\u65f6\u9047\u5230\u4e86\u5927\u95ee\u9898&#xff1a;\u6211\u4eec\u600e\u4e48\u77e5\u9053\u6587\u4ef6\u88ab\u5b58\u5230\u4e86\u54ea\u4e9b\u5757\u91cc&#xff1f;\u6211\u4eec\u4e0d\u4ec5\u9700\u8981\u77e5\u9053\u6587\u4ef6\u5360\u7528\u4e86\u54ea\u4e9b\u5757&#xff0c;\u8fd8\u9700\u8981\u77e5\u9053\u6587\u4ef6\u7684\u5927\u5c0f\u3001\u521b\u5efa\u65f6\u95f4\u3001\u6743\u9650\u7b49\u5c5e\u6027\u3002\u56e0\u6b64&#xff0c;\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u4e13\u95e8\u7684\u7ed3\u6784\u4f53\u6765\u8bb0\u5f55\u8fd9\u4e9b\u4fe1\u606f&#xff0c;\u8fd9\u5c31\u662finode&#xff08;\u7d22\u5f15\u8282\u70b9&#xff09;\u3002<\/p>\n<p>\u2003\u2003\u6211\u4eec\u5c06\u78c1\u76d8\u4e0a\u6240\u6709\u7684inode\u96c6\u4e2d\u8d77\u6765\u5b58\u653e&#xff0c;\u5c31\u5f62\u6210\u4e86inode\u8868&#xff08;Inode Table&#xff09;\u3002\u6bcf\u4e00\u4e2a\u6587\u4ef6&#xff08;\u666e\u901a\u6587\u4ef6\u3001\u76ee\u5f55\u3001\u8f6f\u94fe\u63a5&#xff09;\u90fd\u4f1a\u72ec\u5360\u4e00\u4e2ainode\u3002\u90a3\u4e48\u6211\u4eec\u600e\u4e48\u7528\u4ee3\u7801\u6765\u63cf\u8ff0\u8fd9\u4e2ainode\u5462&#xff1f;\u5728\u78c1\u76d8\u4e0a&#xff0c;\u5b83\u5bf9\u5e94\u7684\u662f ext2_inode \u7ed3\u6784\u4f53&#xff1a;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">ext2_inode<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    __le16 i_mode<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/* \u6587\u4ef6\u7c7b\u578b&#043;\u6743\u9650 *\/<\/span><br \/>\n    __le32 i_size<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/* \u6587\u4ef6\u5b57\u8282\u5927\u5c0f *\/<\/span><br \/>\n    __le32 i_atime<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u6700\u540e\u8bbf\u95ee\u65f6\u95f4 *\/<\/span><br \/>\n    __le32 i_mtime<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u6587\u4ef6\u5185\u5bb9\u4fee\u6539\u65f6\u95f4 *\/<\/span><br \/>\n    __le16 i_links_count<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/* \u786c\u94fe\u63a5\u8ba1\u6570 *\/<\/span><br \/>\n    __le32 i_block<span class=\"token punctuation\">[<\/span>EXT2_N_BLOCKS<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* 15\u4e2a\u5757\u6307\u9488&#xff0c;\u6838\u5fc3&#xff01; *\/<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230; \u5176\u4ed6\u65f6\u95f4\u6233\u3001UID\u3001GID\u7b49\u5b57\u6bb5<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u5728\u8fd9\u4e2a\u7ed3\u6784\u4f53\u4e2d&#xff0c;\u8bb0\u5f55\u6587\u4ef6\u5927\u5c0f\u3001\u65f6\u95f4\u7b49\u5c5e\u6027\u4e00\u76ee\u4e86\u7136\u3002\u91cd\u70b9\u63d0\u9192&#xff1a;inode\u7f16\u53f7\u662f\u4ee5\u5206\u533a\u4e3a\u5355\u4f4d\u8fdb\u884c\u5168\u5c40\u7f16\u53f7\u7684&#xff0c;inode\u4e0d\u53ef\u4ee5\u8de8\u5206\u533a\u3002ext2\u7684inode\u5927\u5c0f\u4e00\u822c\u662f128\u5b57\u8282\u6216256\u5b57\u8282\u3002<\/p>\n<h4>2.3 \u518d\u6b21\u4f18\u5316&#xff1a;inode\u4f4d\u56fe&#xff08;Inode Bitmap&#xff09;\u7684\u8bde\u751f<\/h4>\n<p>\u2003\u2003\u65e2\u7136\u6570\u636e\u5757\u7684\u5206\u914d\u9700\u8981\u5757\u4f4d\u56fe\u6765\u7ba1\u7406&#xff0c;\u90a3\u4e48inode\u672c\u8eab\u4e5f\u662f\u6709\u9650\u7684\u78c1\u76d8\u8d44\u6e90&#xff0c;\u5206\u914d\u548c\u56de\u6536\u540c\u6837\u9700\u8981\u7ba1\u7406\u3002\u7c7b\u6bd4\u5757\u4f4d\u56fe\u7684\u8bbe\u8ba1&#xff0c;\u6211\u4eec\u5f15\u5165inode\u4f4d\u56fe&#xff08;Inode Bitmap&#xff09;\u3002\u5b83\u7684\u903b\u8f91\u5b8c\u5168\u4e00\u81f4&#xff1a;1\u4e2abit\u5bf9\u5e941\u4e2ainode&#xff0c;0\u4ee3\u8868\u7a7a\u95f2&#xff0c;1\u4ee3\u8868\u5df2\u5360\u7528\u3002\u65b0\u5efa\u6587\u4ef6\u65f6&#xff0c;\u5148\u5728inode\u4f4d\u56fe\u4e2d\u627e\u7a7a\u95f2bit\u5206\u914dinode\u3002<\/p>\n<h4>2.4 \u8bb0\u5f55\u7ba1\u7406\u8005\u7684\u5f52\u5c5e&#xff1a;\u5757\u7ec4\u63cf\u8ff0\u7b26&#xff08;GDT&#xff09;\u7684\u8bde\u751f<\/h4>\n<p>\u2003\u2003\u6b64\u65f6\u6211\u4eec\u56de\u5934\u770b\u4e00\u4e0b&#xff1a;\u5757\u4f4d\u56fe\u3001inode\u4f4d\u56fe\u3001inode\u8868&#xff0c;\u5b83\u4eec\u672c\u8d28\u4e0a\u4e5f\u662f\u6570\u636e&#xff0c;\u4e5f\u9700\u8981\u5360\u7528\u78c1\u76d8\u5757&#xff01;\u6211\u4eec\u600e\u4e48\u77e5\u9053\u5b83\u4eec\u5206\u522b\u88ab\u653e\u5728\u4e86\u54ea\u51e0\u4e2a\u5757\u91cc&#xff1f;<\/p>\n<p>\u2003\u2003\u8fd9\u65f6\u5c31\u9700\u8981\u4e00\u4e2a\u201c\u4e0a\u5c42\u9886\u5bfc\u201d\u6765\u8bb0\u5f55\u8fd9\u4e9b\u5143\u6570\u636e\u7684\u4f4d\u7f6e&#xff0c;\u8fd9\u5c31\u662fGDT&#xff08;Group Descriptor Table&#xff0c;\u5757\u7ec4\u63cf\u8ff0\u7b26\u8868&#xff09;\u3002\u6bcf\u4e00\u4e2aext2_group_desc\u7ed3\u6784\u4f53\u63cf\u8ff0\u4e00\u4e2a\u5757\u7ec4&#xff0c;\u6211\u4eec\u6765\u770b\u770b\u5b83\u7684\u6e90\u7801&#xff1a;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">ext2_group_desc<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n    __le32 bg_block_bitmap<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/* \u5757\u4f4d\u56fe\u6240\u5728block\u7f16\u53f7 *\/<\/span><br \/>\n    __le32 bg_inode_bitmap<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/* inode\u4f4d\u56fe\u6240\u5728block\u7f16\u53f7 *\/<\/span><br \/>\n    __le32 bg_inode_table<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/* inode\u8868\u8d77\u59cbblock\u7f16\u53f7 *\/<\/span><br \/>\n    __le16 bg_free_blocks_count<span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/* \u5f53\u524d\u5757\u7ec4\u7a7a\u95f2block\u6570\u76ee *\/<\/span><br \/>\n    __le16 bg_free_inodes_count<span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/* \u5f53\u524d\u5757\u7ec4\u7a7a\u95f2inode\u6570\u76ee *\/<\/span><br \/>\n    __le16 bg_used_dirs_count<span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">\/* \u5f53\u524d\u5757\u7ec4\u91cc\u9762\u76ee\u5f55\u6587\u4ef6\u603b\u6570 *\/<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230; \u9884\u7559\u586b\u5145<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u901a\u8fc7\u8fd9\u4e2a\u7ed3\u6784\u4f53&#xff0c;\u6211\u4eec\u5b8c\u7f8e\u5730\u8bb0\u5f55\u4e86\u201c\u5757\u4f4d\u56fe\u653e\u5728\u54ea\u4e2a\u5757\u3001inode\u4f4d\u56fe\u5728\u54ea\u3001inode\u8868\u4ece\u54ea\u4e2a\u5757\u5f00\u59cb\u201d\u8fd9\u4e9b\u5173\u952e\u4fe1\u606f&#xff0c;\u540c\u6837&#xff0c;GDT\u4fe1\u606f\u4e5f\u4f1a\u5728\u591a\u4e2a\u5757\u7ec4\u505a\u5907\u4efd&#xff0c;\u9632\u6b62\u5143\u6570\u636e\u635f\u574f\u3002<\/p>\n<h4>2.5 \u7edf\u7b79\u5168\u5c40&#xff1a;\u8d85\u7ea7\u5757&#xff08;Super Block&#xff09;\u7684\u8bde\u751f<\/h4>\n<p>\u2003\u2003\u73b0\u5728&#xff0c;\u5355\u4e2a\u5757\u7ec4\u7684\u5143\u6570\u636e\u7ba1\u7406\u5df2\u7ecf\u95ed\u73af\u4e86\u3002\u4f46\u968f\u7740\u5206\u533a\u5bb9\u91cf\u7684\u589e\u5927&#xff0c;\u5206\u533a\u4f1a\u88ab\u5212\u5206\u6210\u591a\u4e2a\u5757\u7ec4\u3002\u4e3a\u4e86\u5fae\u8c03\u6027\u80fd&#xff0c;\u6211\u4eec\u8fd8\u9700\u8981\u4e00\u4e2a\u5168\u5c40\u7684\u89c6\u89d2\u6765\u628a\u63a7\u6574\u4e2a\u5206\u533a&#xff1a;\u6bd4\u5982\u6574\u4e2a\u5206\u533a\u4e00\u5171\u591a\u5c11\u4e2a\u5757\u3001\u591a\u5c11\u4e2ainode&#xff1f;\u5168\u5c40\u8fd8\u6709\u591a\u5c11\u7a7a\u95f2\u8d44\u6e90&#xff1f;\u6700\u8fd1\u4e00\u6b21\u6302\u8f7d\u548c\u5199\u5165\u662f\u4ec0\u4e48\u65f6\u5019&#xff1f;<\/p>\n<p>\u2003\u2003\u4e8e\u662f&#xff0c;\u6211\u4eec\u5728\u6bcf\u4e2a\u5757\u7ec4\u7684\u5f00\u5934&#xff0c;\u5f15\u5165\u4e86\u8d85\u7ea7\u5757&#xff08;Super Block&#xff09;\u3002\u5b83\u5b58\u653e\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u5168\u5c40\u7684\u63cf\u8ff0\u4fe1\u606f&#xff0c;\u5bf9\u5e94\u7684\u6e90\u7801\u7ed3\u6784\u4f53\u975e\u5e38\u5e9e\u5927&#xff0c;\u4f46\u6838\u5fc3\u5b57\u6bb5\u5f88\u6e05\u6670&#xff1a;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">ext2_super_block<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    __le32 s_inodes_count<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/* Inodes\u603b\u6570 *\/<\/span><br \/>\n    __le32 s_blocks_count<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/* Blocks\u603b\u6570 *\/<\/span><br \/>\n    __le32 s_free_blocks_count<span class=\"token punctuation\">;<\/span>    <span class=\"token comment\">\/* \u5f53\u524d\u7a7a\u95f2block\u6570\u91cf *\/<\/span><br \/>\n    __le32 s_free_inodes_count<span class=\"token punctuation\">;<\/span>    <span class=\"token comment\">\/* \u5f53\u524d\u7a7a\u95f2inode\u6570\u91cf *\/<\/span><br \/>\n    __le32 s_log_block_size<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* block\u5927\u5c0f&#xff0c;\u4ee52\u7684\u5e42\u8868\u793a *\/<\/span><br \/>\n    __le32 s_mtime<span class=\"token punctuation\">;<\/span>                <span class=\"token comment\">\/* \u6700\u8fd1\u6302\u8f7d\u65f6\u95f4 *\/<\/span><br \/>\n    __le32 s_wtime<span class=\"token punctuation\">;<\/span>                <span class=\"token comment\">\/* \u6700\u8fd1\u5199\u5165\u65f6\u95f4 *\/<\/span><br \/>\n    __le16 s_magic<span class=\"token punctuation\">;<\/span>                <span class=\"token comment\">\/* \u9b54\u6570&#xff0c;\u7528\u6765\u8bc6\u522b\u662f\u4e0d\u662fext2\u6587\u4ef6\u7cfb\u7edf *\/<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230; \u5176\u4ed6\u5168\u5c40\u63cf\u8ff0\u5b57\u6bb5<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8003\u70b9&#xff1a;\u6ce8\u610f\u91cc\u9762\u7684 s_magic \u9b54\u6570\u3002\u64cd\u4f5c\u7cfb\u7edf\u6302\u8f7d\u5206\u533a\u65f6\u8bfb\u53d6\u9b54\u6570&#xff0c;\u5224\u65ad\u8fd9\u4e2a\u5206\u533a\u662f\u54ea\u79cd\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u5185\u6838\u4e0d\u8bc6\u522b\u5219\u4e0d\u517c\u5bb9\u3002<\/p>\n<p>\u2003\u2003\u6838\u5fc3\u5907\u4efd\u673a\u5236&#xff1a;\u8d85\u7ea7\u5757\u6570\u636e\u635f\u574f&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u5c06\u65e0\u6cd5\u8bc6\u522b\u8fd9\u4e2a\u5206\u533a\u7684\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u5206\u533a\u5185\u6240\u6709\u6587\u4ef6\u90fd\u65e0\u6cd5\u8bbf\u95ee\u3002\u4e3a\u4e86\u9632\u6b62\u78c1\u76d8\u5c40\u90e8\u6247\u533a\u635f\u574f\u5bfc\u81f4\u6587\u4ef6\u7cfb\u7edf\u76f4\u63a5\u62a5\u5e9f&#xff0c;\u8d85\u7ea7\u5757\u4f1a\u5728\u591a\u4e2a\u5757\u7ec4\u5934\u90e8\u4fdd\u7559\u5907\u4efd\u3002\u7b2c\u4e00\u4e2a\u5757\u7ec4\u5fc5\u987b\u5b58\u5728\u8d85\u7ea7\u5757&#xff0c;\u5176\u4f59\u5757\u7ec4\u53ef\u9009\u62e9\u5907\u4efd&#xff0c;\u6240\u6709\u526f\u672c\u5185\u5bb9\u540c\u6b65\u4e00\u81f4\u3002<\/p>\n<h4>2.6 \u68b3\u7406\u6838\u5fc3\u6d41\u7a0b&#xff1a;\u4e00\u4e2a\u6587\u4ef6\u7684\u5b8c\u6574\u5199\u5165\u751f\u547d\u5468\u671f<\/h4>\n<p>\u2003\u2003\u73b0\u5728&#xff0c;\u6211\u4eec\u987a\u7740\u521a\u624d\u7684\u81ea\u4e0b\u800c\u4e0a\u7684\u8bbe\u8ba1&#xff0c;\u5b8c\u6574\u68b3\u7406\u4e00\u904d\u4e00\u4e2a\u6587\u4ef6\u5199\u5165\u7684\u5b8c\u6574\u6d41\u7a0b&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122532-6acb803ccd37b.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"600\" \/><\/p>\n<li>\u67e5\u5168\u5c40&#xff1a;\u7cfb\u7edf\u5148\u67e5\u770b\u8d85\u7ea7\u5757&#xff0c;\u770b\u91cc\u9762\u6709\u6ca1\u6709\u7a7a\u95f2\u7684inode\u548c\u7a7a\u95f2\u7684\u6570\u636e\u5757\u3002\u53d1\u73b0\u6709&#xff0c;\u53ef\u4ee5\u8fdb\u884c\u5206\u914d\u3002<\/li>\n<li>\u5b9a\u4f4d\u5143\u6570\u636e&#xff1a;\u6839\u636e\u8d85\u7ea7\u5757\u7684\u4fe1\u606f&#xff0c;\u53bbGDT&#xff08;\u5757\u7ec4\u63cf\u8ff0\u7b26\u8868&#xff09; \u4e2d\u627e\u5230\u5bf9\u5e94\u5757\u7ec4\u7684\u5143\u6570\u636e\u4fe1\u606f&#xff08;\u6bd4\u5982\u4f4d\u56fe\u3001inode\u8868\u5177\u4f53\u5728\u54ea\u4e2a\u5757&#xff09;\u3002<\/li>\n<li>\u5206\u914dinode&#xff1a;\u53bbinode\u4f4d\u56fe\u4e2d\u627e\u5230\u4e00\u4e2a\u7a7a\u95f2\u7684\u8868\u9879&#xff08;\u5982263466&#xff09;&#xff0c;\u628a\u6587\u4ef6\u7684\u57fa\u672c\u5c5e\u6027&#xff08;\u7c7b\u578b\u3001\u6743\u9650\u3001\u65f6\u95f4\u7b49&#xff09;\u586b\u597d\u3002\u6ce8\u610f&#xff1a;\u6b64\u65f6\u6587\u4ef6\u5927\u5c0f\u548c\u6570\u636e\u6240\u5728\u5757\u7684\u4fe1\u606f\u5148\u7a7a\u7740\u3002<\/li>\n<li>\u5206\u914d\u6570\u636e\u5757&#xff1a;\u53bb\u5757\u4f4d\u56fe\u4e2d\u627e\u5230\u7a7a\u95f2\u5757&#xff08;\u6bd4\u5982300\u3001500\u3001800&#xff09;&#xff0c;\u5c06\u7528\u6237\u7f13\u51b2\u533a\u7684\u6570\u636e\u5199\u5165\u8fd9\u4e09\u5757\u78c1\u76d8\u3002<\/li>\n<li>\u56de\u586binode&#xff1a;\u5199\u5b8c\u6570\u636e\u540e&#xff0c;\u56de\u5230inode\u8868\u4e2d&#xff0c;\u628a\u6587\u4ef6\u5927\u5c0f\u4ee5\u53ca\u6570\u636e\u5757\u7684\u4f4d\u7f6e&#xff08;300, 500, 800&#xff09;\u586b\u5165 i_block \u6570\u7ec4\u3002<\/li>\n<li>\u66f4\u65b0\u5143\u4fe1\u606f&#xff1a;\u540c\u6b65\u66f4\u65b0inode\u4f4d\u56fe&#xff08;\u6807\u8bb0\u8be5inode\u5df2\u4f7f\u7528&#xff09;\u3001\u5757\u4f4d\u56fe&#xff08;\u6807\u8bb0\u6570\u636e\u5757\u5df2\u5206\u914d&#xff09;\u3002<\/li>\n<li>\u66f4\u65b0\u5168\u5c40&#xff1a;\u66f4\u65b0\u8d85\u7ea7\u5757&#xff0c;\u5c06\u7a7a\u95f2inode\u6570\u548c\u7a7a\u95f2\u5757\u6570\u51cf1\u3002<\/li>\n<li>\u6dfb\u52a0\u76ee\u5f55\u5165\u53e3&#xff1a;\u5f53\u524d\u76ee\u5f55\u672c\u8eab\u4e5f\u662f\u4e00\u4e2a\u76ee\u5f55\u6587\u4ef6&#xff0c;\u5185\u6838\u5f80\u5f53\u524d\u76ee\u5f55\u7684\u6570\u636e\u5757\u91cc\u65b0\u589e\u4e00\u6761\u8bb0\u5f55&#xff1a;263466, abc&#xff0c;\u628a\u6587\u4ef6\u540dabc\u548cinode\u53f7\u7ed1\u5b9a\u5728\u4e00\u8d77\u3002<\/li>\n<p>\u2003\u2003\u5173\u952e\u70b9&#xff1a;\u6587\u4ef6\u540d\u4e0d\u5728inode\u91cc&#xff01;\u6587\u4ef6\u540d\u4fdd\u5b58\u5728\u76ee\u5f55\u7684\u6570\u636e\u5757\u4e2d&#xff0c;inode\u91cc\u9762\u6ca1\u6709\u6587\u4ef6\u540d\u3002\u62ff\u5230inode\u7f16\u53f7&#xff0c;\u6587\u4ef6\u7684\u5168\u90e8\u5c5e\u6027\u4ee5\u53ca\u6587\u4ef6\u5185\u5bb9\u6240\u5728\u6570\u636e\u5757\u7f16\u53f7\u5168\u90e8\u83b7\u53d6&#xff0c;\u5c31\u53ef\u4ee5\u5b8c\u6210\u6587\u4ef6\u8bfb\u5199\u3002<\/p>\n<h4>2.7 Data Block \u6570\u636e\u533a<\/h4>\n<p>\u2003\u2003\u6700\u540e&#xff0c;\u6211\u4eec\u6765\u770b\u771f\u6b63\u5b58\u653e\u6587\u4ef6\u5185\u5bb9\u7684Data Block&#xff08;\u6570\u636e\u533a&#xff09;\u3002\u6839\u636e\u6587\u4ef6\u7c7b\u578b&#xff0c;\u5b58\u50a8\u5185\u5bb9\u60c5\u51b5&#xff1a;<\/p>\n<li>\u666e\u901a\u6587\u4ef6&#xff1a;\u6587\u4ef6\u7684\u6587\u672c\u3001\u4e8c\u8fdb\u5236\u6570\u636e&#xff0c;\u5168\u90e8\u5b58\u5728Data Block\u4e2d\u3002<\/li>\n<li>\u76ee\u5f55\u6587\u4ef6&#xff1a;\u76ee\u5f55\u4e5f\u662f\u6587\u4ef6&#xff01;\u76ee\u5f55\u7684\u6570\u636e\u5757\u91cc\u9762\u5b58\u653e\u4e00\u6761\u6761 \u6587\u4ef6\u540d &lt;&#8211;&gt; inode\u53f7 \u7684\u6620\u5c04\u6761\u76ee\u3002ls -l\u770b\u5230\u7684\u6743\u9650\u3001\u5927\u5c0f\u3001\u6240\u6709\u8005&#xff0c;\u4fdd\u5b58\u5728\u5bf9\u5e94\u6587\u4ef6\u81ea\u5df1\u7684inode\u91cc\u9762&#xff1b;\u76ee\u5f55\u91cc\u9762\u4ec5\u4ec5\u4fdd\u5b58\u540d\u5b57\u548cinode\u7684\u6620\u5c04\u3002<\/li>\n<p>\u2003\u2003\u81f3\u6b64&#xff0c;EXT2\u5757\u7ec4\u7684\u5168\u90e8\u7269\u7406\u6784\u6210\u4e0e\u6838\u5fc3\u8fd0\u8f6c\u903b\u8f91&#xff0c;\u5c31\u5728\u6211\u4eec\u4e00\u6b65\u6b65\u7684\u63a8\u5bfc\u4e2d\u5b8c\u7f8e\u95ed\u73af\u4e86\u3002<\/p>\n<hr \/>\n<h3>3. \u6838\u5fc3\u673a\u5236&#xff1a;inode\u4e0eData Block\u7684\u6620\u5c04<\/h3>\n<p>\u2003\u2003\u5728\u4e0a\u4e00\u8282&#xff0c;\u6211\u4eec\u901a\u8fc7\u5c42\u5c42\u9012\u8fdb&#xff0c;\u77e5\u9053\u4e86inode\u662f\u6587\u4ef6\u7684\u201c\u8eab\u4efd\u8bc1\u201d&#xff0c;\u8d1f\u8d23\u8bb0\u5f55\u5c5e\u6027\u548c\u6570\u636e\u5757\u4f4d\u7f6e\u3002\u4f46\u73b0\u5728\u4e00\u4e2a\u5f88\u73b0\u5b9e\u7684\u95ee\u9898\u6446\u5728\u6211\u4eec\u9762\u524d&#xff1a;\u6587\u4ef6\u6709\u5927\u6709\u5c0f&#xff0c;inode\u91cc\u7684\u7a7a\u95f4\u662f\u6709\u9650\u7684&#xff0c;\u5b83\u5230\u5e95\u662f\u600e\u4e48\u628a\u6210\u767e\u4e0a\u5343\u4e2a\u6570\u636e\u5757\u7ed9\u7edf\u9886\u8d77\u6765\u7684&#xff1f;<\/p>\n<h4>3.1 \u521d\u6b65\u5c1d\u8bd5&#xff1a;\u76f4\u63a5\u8bb0\u5f55&#xff08;12\u4e2a\u76f4\u63a5\u5757\u6307\u9488&#xff09;<\/h4>\n<p>\u2003\u2003\u5047\u8bbe\u6211\u4eec\u521a\u521a\u5199\u5165\u4e86\u4e00\u4e2a\u5c0f\u6587\u4ef6&#xff0c;\u5b83\u53ea\u5360\u7528\u4e86\u51e0\u4e2a\u6570\u636e\u5757\u3002\u6700\u7b80\u5355\u3001\u6700\u76f4\u89c2\u7684\u8bbe\u8ba1\u5c31\u662f&#xff1a;\u76f4\u63a5\u5728inode\u91cc\u9762\u7559\u51fa\u4f4d\u7f6e&#xff0c;\u628a\u5b58\u653e\u6587\u4ef6\u5185\u5bb9\u7684\u6570\u636e\u5757\u7f16\u53f7\u76f4\u63a5\u8bb0\u4e0b\u6765\u3002<\/p>\n<p>\u2003\u2003\u5728EXT2\u4e2d&#xff0c;inode\u7ed3\u6784\u4f53\u91cc\u6709\u4e00\u4e2ai_block\u6570\u7ec4&#xff0c;\u5b83\u7684\u524d12\u4e2a\u5143\u7d20\u5c31\u662f\u5e72\u8fd9\u4e2a\u7684&#xff0c;\u88ab\u79f0\u4e3a12\u4e2a\u76f4\u63a5\u5757\u6307\u9488\u3002\u5bf9\u4e8e\u5c0f\u6587\u4ef6\u6765\u8bf4&#xff0c;\u76f4\u63a5\u901a\u8fc7\u8fd912\u4e2a\u6307\u9488\u5c31\u80fd\u5b9a\u4f4d\u5230\u6240\u6709\u6570\u636e\u5757&#xff0c;\u4e0d\u9700\u8981\u4efb\u4f55\u4e2d\u95f4\u8df3\u8f6c&#xff0c;\u8bbf\u95ee\u901f\u5ea6\u6700\u5feb\u3002<\/p>\n<h4>3.2 \u9047\u5230\u95ee\u9898&#xff1a;\u5982\u4f55\u5bb9\u7eb3\u5927\u6587\u4ef6&#xff1f;&#xff08;\u591a\u7ea7\u95f4\u63a5\u5757\u6307\u9488\u7684\u8bde\u751f&#xff09;<\/h4>\n<p>\u2003\u2003\u4f46\u95ee\u9898\u662f&#xff0c;\u6587\u4ef6\u4e0d\u53ef\u80fd\u6c38\u8fdc\u8fd9\u4e48\u5c0f\u3002\u5982\u679c\u6587\u4ef6\u5f88\u5927&#xff0c;\u8d85\u8fc7\u4e8612\u4e2a\u6570\u636e\u5757\u600e\u4e48\u529e&#xff1f;\u5982\u679c\u6211\u4eec\u4e3a\u4e86\u5bb9\u7eb3\u66f4\u591a\u7684\u5757\u53f7&#xff0c;\u5c31\u628ainode\u7ed3\u6784\u4f53\u65e0\u9650\u6269\u5bb9&#xff0c;\u90a3inode\u672c\u8eab\u5c31\u4f1a\u53d8\u5f97\u6781\u5176\u5e9e\u5927&#xff0c;\u8fd9\u5bf9\u78c1\u76d8\u7a7a\u95f4\u548c\u8bfb\u53d6\u6548\u7387\u90fd\u662f\u707e\u96be\u3002<\/p>\n<p>\u2003\u2003\u65e2\u7136\u4e0d\u80fd\u8ba9inode\u81ea\u5df1\u53d8\u5927&#xff0c;\u6211\u4eec\u5c31\u5f97\u6362\u4e2a\u601d\u8def&#xff1a;\u62ff\u4e00\u4e2a\u6570\u636e\u5757\u51fa\u6765&#xff0c;\u4e0d\u5b58\u6587\u4ef6\u5185\u5bb9&#xff0c;\u4e13\u95e8\u5b58\u5176\u4ed6\u6570\u636e\u5757\u7684\u7f16\u53f7&#xff0c;\u628a\u5b83\u53d8\u6210\u4e00\u4e2a\u201c\u7d22\u5f15\u5757\u201d\u3002<\/p>\n<p>\u2003\u2003\u4e8e\u662f&#xff0c;i_block\u6570\u7ec4\u7684\u7b2c13\u4e2a\u6307\u9488\u6d3e\u4e0a\u4e86\u7528\u573a&#xff0c;\u5b83\u6307\u5411\u4e00\u4e2a\u7d22\u5f15\u5757&#xff0c;\u7d22\u5f15\u5757\u91cc\u5168\u662f\u4e00\u4e2a\u4e2a\u6570\u636e\u5757\u7684\u7f16\u53f7\u3002\u8fd9\u5c31\u662f1\u4e2a\u4e00\u7ea7\u95f4\u63a5\u5757\u6307\u9488\u3002\u6709\u4e86\u5b83&#xff0c;\u5bfb\u5740\u80fd\u529b\u77ac\u95f4\u63d0\u5347\u4e86\u51e0\u5341\u500d\u3002<\/p>\n<p>\u90a3\u5982\u679c\u6587\u4ef6\u66f4\u5927\u5462&#xff1f;\u5f88\u7b80\u5355&#xff0c;\u5957\u5a03\u3002<\/p>\n<ul>\n<li>\u7b2c14\u4e2a\u6307\u9488\u6307\u5411\u4e00\u4e2a\u7d22\u5f15\u5757&#xff0c;\u8fd9\u4e2a\u7d22\u5f15\u5757\u91cc\u5b58\u7684\u6307\u9488\u53c8\u6307\u5411\u4e0b\u4e00\u4e2a\u7d22\u5f15\u5757&#xff0c;\u76f4\u5230\u627e\u5230\u6700\u7ec8\u7684\u6570\u636e\u5757\u3002\u8fd9\u5c31\u662f1\u4e2a\u4e8c\u7ea7\u95f4\u63a5\u5757\u6307\u9488\u3002<\/li>\n<li>\u7b2c15\u4e2a\u6307\u9488\u66f4\u662f\u91cd\u91cf\u7ea7&#xff0c;\u5c42\u5c42\u5d4c\u5957&#xff0c;\u8fd9\u5c31\u662f1\u4e2a\u4e09\u7ea7\u95f4\u63a5\u5757\u6307\u9488&#xff0c;\u8db3\u4ee5\u652f\u6491\u8d85\u5927\u6587\u4ef6\u7684\u5b58\u50a8\u3002<\/li>\n<\/ul>\n<p>\u2003\u2003\u901a\u8fc7\u8fd9\u201c12\u4e2a\u76f4\u63a5\u6307\u9488 &#043; 1\u4e2a\u4e00\u7ea7\u95f4\u63a5 &#043; 1\u4e2a\u4e8c\u7ea7\u95f4\u63a5 &#043; 1\u4e2a\u4e09\u7ea7\u95f4\u63a5\u201d\u7684\u5de7\u5999\u8bbe\u8ba1&#xff0c;\u5185\u6838\u5b8c\u7f8e\u517c\u987e\u4e86\u201c\u5c0f\u6587\u4ef6\u8bfb\u5199\u6781\u5feb\u201d\u548c\u201c\u652f\u6301\u8d85\u5927\u6587\u4ef6\u201d\u4e24\u4e2a\u9700\u6c42\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122533-6acb803d1806f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"600\" \/><\/p>\n<h4>3.3 \u878d\u4f1a\u8d2f\u901a&#xff1a;\u6e90\u7801\u4e2d\u7684inode\u7ed3\u6784\u4f53<\/h4>\n<p>\u2003\u2003\u6b63\u662f\u57fa\u4e8e\u8fd9\u5957\u6620\u5c04\u903b\u8f91&#xff0c;\u5185\u6838\u8bbe\u8ba1\u4e86ext2_inode\u7ed3\u6784\u4f53\u3002\u6211\u4eec\u6765\u770b\u770b\u5b83\u7684\u771f\u9762\u76ee&#xff1a;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">ext2_inode<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    __le16 i_mode<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/* \u6587\u4ef6\u7c7b\u578b&#043;\u6743\u9650 *\/<\/span><br \/>\n    __le16 i_uid<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/* \u5c5e\u4e3bUID\u4f4e16\u4f4d *\/<\/span><br \/>\n    __le32 i_size<span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/* \u6587\u4ef6\u5b57\u8282\u5927\u5c0f *\/<\/span><br \/>\n    __le32 i_atime<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u6700\u540e\u8bbf\u95ee\u65f6\u95f4 *\/<\/span><br \/>\n    __le32 i_ctime<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u521b\u5efa\/\u5c5e\u6027\u4fee\u6539\u65f6\u95f4 *\/<\/span><br \/>\n    __le32 i_mtime<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u6587\u4ef6\u5185\u5bb9\u4fee\u6539\u65f6\u95f4 *\/<\/span><br \/>\n    __le32 i_dtime<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u6587\u4ef6\u5220\u9664\u65f6\u95f4 *\/<\/span><br \/>\n    __le16 i_gid<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/* \u5c5e\u7ec4GID\u4f4e16\u4f4d *\/<\/span><br \/>\n    __le16 i_links_count<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/* \u786c\u94fe\u63a5\u8ba1\u6570 *\/<\/span><br \/>\n    __le32 i_blocks<span class=\"token punctuation\">;<\/span>      <span class=\"token comment\">\/* \u6587\u4ef6\u5360\u7528block\u6570\u91cf *\/<\/span><br \/>\n    __le32 i_flags<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u6587\u4ef6\u6807\u5fd7\u4f4d *\/<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230; \u64cd\u4f5c\u7cfb\u7edf\u76f8\u5173\u5b57\u6bb5<\/span><br \/>\n    __le32 i_block<span class=\"token punctuation\">[<\/span>EXT2_N_BLOCKS<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* 15\u4e2a\u5757\u6307\u9488&#xff0c;\u6838\u5fc3&#xff01; *\/<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230; \u5176\u4ed6\u5b57\u6bb5<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u603b\u7ed3&#xff1a;inode\u8bb0\u5f55\u6587\u4ef6\u5c5e\u6027&#xff0c;i_block\u6570\u7ec4\u627e\u5230\u6587\u4ef6\u6240\u6709\u6570\u636e\u5757\u3002\u6587\u4ef6 &#061; \u5c5e\u6027(inode) &#043; \u5185\u5bb9(datablock)\u3002<\/p>\n<h4>3.4 \u601d\u8003&#xff1a;\u77e5\u9053inode\u53f7&#xff0c;\u7a76\u7adf\u610f\u5473\u7740\u4ec0\u4e48&#xff1f;<\/h4>\n<p>\u2003\u2003\u77e5\u9053inode\u53f7\u7684\u60c5\u51b5\u4e0b&#xff0c;\u5bf9\u6587\u4ef6\u8fdb\u884c\u589e\u3001\u5220\u3001\u67e5\u3001\u6539\u662f\u5728\u505a\u4ec0\u4e48&#xff1f;<\/p>\n<p>\u2003\u2003\u5f53\u6211\u4eec\u5f7b\u5e95\u7406\u987a\u4e86\u78c1\u76d8\u5e03\u5c40\u548c\u6620\u5c04\u673a\u5236&#xff0c;\u8fd9\u4e2a\u95ee\u9898\u7684\u7b54\u6848\u5c31\u8dc3\u7136\u7eb8\u4e0a\u4e86&#xff1a;<\/p>\n<li>\u683c\u5f0f\u5316\u5206\u533a\u7684\u672c\u8d28&#xff1a;\u5bf9\u5206\u533a\u5212\u5206\u5757\u7ec4&#xff0c;\u5728\u6bcf\u4e2a\u5757\u7ec4\u5199\u5165\u8d85\u7ea7\u5757\u3001GDT\u3001\u4f4d\u56fe\u3001inode\u8868\u7b49\u5143\u6570\u636e\u3002\u8fd9\u4e00\u5806\u7ba1\u7406\u4fe1\u606f&#xff0c;\u5408\u8d77\u6765\u5c31\u662f\u6587\u4ef6\u7cfb\u7edf\u3002<\/li>\n<li>\u62ff\u5230inode\u7f16\u53f7&#xff1a;\u5c31\u53ef\u4ee5\u5728\u5f53\u524d\u5206\u533a&#xff0c;\u7b97\u51fa\u8fd9\u4e2ainode\u5c5e\u4e8e\u54ea\u4e00\u4e2a\u5757\u7ec4&#xff0c;\u518d\u5b9a\u4f4d\u5230inode table\u91cc\u9762\u5bf9\u5e94\u7684inode\u6761\u76ee\u3002<\/li>\n<li>\u4e00\u65e6\u62ff\u5230inode&#xff1a;\u6587\u4ef6\u7684\u5168\u90e8\u5c5e\u6027&#xff0c;\u4ee5\u53ca\u6587\u4ef6\u5185\u5bb9\u6240\u5728\u6570\u636e\u5757\u7f16\u53f7\u5168\u90e8\u83b7\u53d6&#xff0c;\u76f4\u63a5\u5b8c\u6210\u6587\u4ef6\u8bfb\u5199\u3002<\/li>\n<hr \/>\n<h3>4. \u76ee\u5f55\u4e0e\u6587\u4ef6\u540d&#xff1a;\u6253\u7834\u201c\u76ee\u5f55\u201d\u7684\u8ba4\u77e5\u58c1\u5792<\/h3>\n<p>\u2003\u2003\u95ee\u9898&#xff1a;\u6211\u4eec\u64cd\u4f5c\u6587\u4ef6&#xff0c;\u8f93\u5165\u7684\u6c38\u8fdc\u662f\u6587\u4ef6\u540d&#xff0c;\u4ece\u6765\u4e0d\u4f1a\u8f93\u5165inode\u53f7&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u600e\u4e48\u901a\u8fc7\u6587\u4ef6\u540d\u627e\u5230inode&#xff1f; \u2003\u2003\u6838\u5fc3\u7b54\u6848&#xff1a;\u76ee\u5f55\u672c\u8eab\u4e5f\u662f\u6587\u4ef6&#xff0c;\u78c1\u76d8\u4e0a\u4e0d\u5b58\u5728\u5355\u72ec\u7684\u201c\u76ee\u5f55\u5bf9\u8c61\u201d&#xff0c;\u78c1\u76d8\u53ea\u5b58\u50a8\u6587\u4ef6&#xff1a;\u5c5e\u6027 &#043; \u5185\u5bb9\u3002\u76ee\u5f55\u6587\u4ef6\u7684\u5185\u5bb9&#xff0c;\u5c31\u662f\u4e00\u5f20\u8868&#xff0c;\u6bcf\u4e00\u6761\u8bb0\u5f55&#xff1a;\u6587\u4ef6\u540d &#043; \u5bf9\u5e94inode\u7f16\u53f7\u3002<\/p>\n<p>\u2003\u2003\u5f53\u6267\u884c ls \u547d\u4ee4\u8bfb\u53d6\u76ee\u5f55&#xff0c;\u672c\u8d28\u5c31\u662f\u8bfb\u53d6\u76ee\u5f55\u6587\u4ef6\u7684\u6570\u636e\u5757&#xff0c;\u904d\u5386\u91cc\u9762\u4e00\u6761\u6761\u6620\u5c04\u3002\u6211\u4eec\u5199\u4e00\u6bb5C\u8bed\u8a00\u4ee3\u7801&#xff0c;\u8c03\u7528\u7cfb\u7edf\u8c03\u7528readdir&#xff0c;\u81ea\u5df1\u8bfb\u53d6\u76ee\u5f55\u6761\u76ee&#xff0c;\u9a8c\u8bc1\u8fd9\u4e2a\u539f\u7406&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ readdir.c<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;string.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdlib.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;dirent.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;sys\/types.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;unistd.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> argc<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>argv<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>argc <span class=\"token operator\">!&#061;<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token function\">exit<\/span><span class=\"token punctuation\">(<\/span>EXIT_FAILURE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n    DIR <span class=\"token operator\">*<\/span>dir <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">opendir<\/span><span class=\"token punctuation\">(<\/span>argv<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>dir<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token function\">perror<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;opendir&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token function\">exit<\/span><span class=\"token punctuation\">(<\/span>EXIT_FAILURE<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">dirent<\/span> <span class=\"token operator\">*<\/span>entry<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>entry <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">readdir<\/span><span class=\"token punctuation\">(<\/span>dir<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">!&#061;<\/span> <span class=\"token constant\">NULL<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">strcmp<\/span><span class=\"token punctuation\">(<\/span>entry<span class=\"token operator\">-&gt;<\/span>d_name<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;.&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">||<\/span> <span class=\"token function\">strcmp<\/span><span class=\"token punctuation\">(<\/span>entry<span class=\"token operator\">-&gt;<\/span>d_name<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;..&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">continue<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Filename: %s, Inode: %lu\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> entry<span class=\"token operator\">-&gt;<\/span>d_name<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span><span class=\"token punctuation\">)<\/span>entry<span class=\"token operator\">-&gt;<\/span>d_ino<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token function\">closedir<\/span><span class=\"token punctuation\">(<\/span>dir<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122533-6acb803d8749a.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"500\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122533-6acb803dbf775.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"500\" \/><\/p>\n<p>\u2003\u2003\u8fd0\u884c\u7ed3\u679c\u548c ls -li \/ \u7684\u7ed3\u679c\u5b8c\u5168\u5bf9\u5e94\u3002\u7531\u6b64\u5f97\u5230\u6838\u5fc3\u7ed3\u8bba&#xff1a;\u8bbf\u95ee\u6587\u4ef6\u7684\u6d41\u7a0b&#xff0c;\u662f\u6253\u5f00\u76ee\u6807\u6240\u5728\u76ee\u5f55\u6587\u4ef6&#xff0c;\u8bfb\u53d6\u76ee\u5f55\u5185\u7684\u6620\u5c04\u8868&#xff0c;\u901a\u8fc7\u6587\u4ef6\u540d\u62ff\u5230inode\u53f7&#xff0c;\u518d\u62ff\u7740inode\u53bb\u8bfb\u53d6\u6587\u4ef6\u672c\u8eab\u7684\u5c5e\u6027\u548c\u6570\u636e\u5757\u3002<\/p>\n<hr \/>\n<h3>5. \u8def\u5f84\u89e3\u6790\u4e0e\u8def\u5f84\u7f13\u5b58&#xff08;dentry&#xff09;<\/h3>\n<p>\u2003\u2003\u6211\u4eec\u77e5\u9053\u8bbf\u95ee\u6587\u4ef6\u5fc5\u987b\u62ff\u5230\u5b83\u7684inode&#xff0c;\u800c\u6587\u4ef6\u540d\u548cinode\u7684\u6620\u5c04\u5173\u7cfb\u4fdd\u5b58\u5728\u76ee\u5f55\u7684\u6570\u636e\u5757\u91cc\u3002\u90a3\u4e48&#xff0c;\u5982\u679c\u6211\u4eec\u8981\u8bbf\u95ee\u4e00\u4e2a\u5f88\u6df1\u7684\u8def\u5f84&#xff0c;\u6bd4\u5982 \/home\/wjy\/code\/test\/test.c&#xff0c;\u7cfb\u7edf\u662f\u600e\u4e48\u4e00\u6b65\u6b65\u627e\u5230\u5b83\u7684inode\u7684\u5462&#xff1f;<\/p>\n<h4>5.1 \u8def\u5f84\u89e3\u6790<\/h4>\n<p>\u2003\u2003\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u5b8c\u6574\u7684\u7edd\u5bf9\u8def\u5f84 \/home\/wjy\/code\/test\/test.c\u3002\u7cfb\u7edf\u4f1a\u4ece\u6700\u5de6\u4fa7\u5f00\u59cb&#xff0c;\u9010\u5c42\u5411\u53f3\u89e3\u6790&#xff1a;<\/p>\n<li>\u4ece\u6839\u76ee\u5f55 \/ \u5f00\u59cb&#xff1a;\u6839\u76ee\u5f55\u7684inode\u662f\u7cfb\u7edf\u5f00\u673a\u65f6\u5c31\u56fa\u5b9a\u5df2\u77e5\u7684&#xff0c;\u4e0d\u9700\u8981\u67e5\u627e&#xff0c;\u76f4\u63a5\u62ff\u5230\u3002<\/li>\n<li>\u8bfb\u53d6\u6839\u76ee\u5f55\u5185\u5bb9&#xff1a;\u5728\u6839\u76ee\u5f55\u7684\u6570\u636e\u5757\u4e2d\u627e\u5230 home \u5bf9\u5e94\u7684inode\u3002<\/li>\n<li>\u6253\u5f00 home \u76ee\u5f55&#xff1a;\u8bfb\u53d6 home \u76ee\u5f55\u7684\u6570\u636e\u5757&#xff0c;\u627e\u5230 wjy \u5bf9\u5e94\u7684inode\u3002<\/li>\n<li>\u6253\u5f00 wjy \u76ee\u5f55&#xff1a;\u627e\u5230 code\u2026<\/li>\n<li>\u6253\u5f00 test \u76ee\u5f55&#xff1a;\u6700\u7ec8\u627e\u5230 test.c&#xff0c;\u62ff\u5230\u5b83\u7684inode&#xff0c;\u5b8c\u6210\u8def\u5f84\u89e3\u6790\u3002<\/li>\n<p>\u2003\u2003\u8fd9\u4e2a\u8fc7\u7a0b\u672c\u8d28\u4e0a\u662f\u4e00\u4e2a\u9012\u5f52&#xff1a;\u60f3\u8981\u6253\u5f00\u4e00\u4e2a\u76ee\u5f55&#xff0c;\u5c31\u5fc5\u987b\u77e5\u9053\u5b83\u7684\u4e0a\u7ea7\u76ee\u5f55&#xff0c;\u4e00\u76f4\u8ffd\u6eaf\u5230\u6839\u76ee\u5f55 \/\u3002\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48 \u8bbf\u95ee\u6587\u4ef6\u5fc5\u987b\u8981\u6709\u8def\u5f84&#xff08;\u76ee\u5f55&#043;\u6587\u4ef6\u540d&#xff09; \u7684\u6839\u672c\u539f\u56e0\u3002<\/p>\n<p>\u601d\u8003&#xff1a;\u8def\u5f84\u7a76\u7adf\u662f\u8c01\u63d0\u4f9b\u7684&#xff1f; \u2003\u2003\u5176\u5b9e&#xff0c;\u4f60\u8f93\u5165\u7684\u6307\u4ee4&#xff08;\u5982 ls\u3001cat&#xff09;\u672c\u8d28\u662f\u8fdb\u7a0b\u5728\u8bbf\u95ee\u6587\u4ef6&#xff0c;\u800c\u8fdb\u7a0b\u6709\u81ea\u5df1\u7684CWD&#xff08;\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55&#xff09;\u3002\u8fdb\u7a0b\u63d0\u4f9b\u8def\u5f84\u5b57\u7b26\u4e32\u4ea4\u7ed9\u5185\u6838&#xff0c;\u6839\u76ee\u5f55\u56fa\u5b9a\u5df2\u77e5&#xff0c;\u6574\u4e2aLinux\u6811\u72b6\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u5c31\u662f\u64cd\u4f5c\u7cfb\u7edf\u4e0e\u7528\u6237\u4e00\u8d77\u6784\u5efa\u51fa\u6765\u7684\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122534-6acb803e2f69f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"600\" \/><\/p>\n<h4>5.2 \u95ee\u9898&#xff1a;\u6781\u5ea6\u9891\u7e41\u7684\u78c1\u76d8IO<\/h4>\n<p>\u2003\u2003\u867d\u7136\u903b\u8f91\u4e0a\u5b8c\u7f8e\u95ed\u73af\u4e86&#xff0c;\u4f46\u6211\u4eec\u5728\u5b9e\u9645\u4f53\u9a8c\u4e2d\u4f1a\u53d1\u73b0&#xff1a;\u5982\u679c\u6bcf\u6b21\u8bbf\u95ee\u4e00\u4e2a\u6df1\u5c42\u6587\u4ef6&#xff0c;\u90fd\u8981\u4ece\u6839\u76ee\u5f55\u5f00\u59cb\u4e00\u5c42\u5c42\u8bfb\u53d6\u78c1\u76d8\u4e0a\u7684\u76ee\u5f55\u6587\u4ef6&#xff0c;\u90a3\u5c06\u4ea7\u751f\u5927\u91cf\u7684\u78c1\u76d8I\/O&#xff0c;\u6027\u80fd\u6781\u5176\u4f4e\u4e0b\u3002\u5c24\u5176\u662f\u5f53\u6211\u4eec\u5728\u4ee3\u7801\u91cc\u53cd\u590d\u8bfb\u5199\u540c\u4e00\u4e2a\u6587\u4ef6\u65f6&#xff0c;\u8fd9\u79cd\u5f00\u9500\u662f\u707e\u96be\u6027\u7684\u3002<\/p>\n<p>\u2003\u2003\u65e2\u7136\u78c1\u76d8\u8bfb\u53d6\u8fd9\u4e48\u6162&#xff0c;\u6211\u4eec\u80fd\u4e0d\u80fd\u628a\u89e3\u6790\u8fc7\u7684\u8def\u5f84\u8bb0\u5728\u5185\u5b58\u91cc&#xff1f; \u5f53\u7136\u53ef\u4ee5&#xff01;Linux\u5185\u6838\u5f15\u5165\u4e86dentry&#xff08;\u76ee\u5f55\u9879\u7f13\u5b58&#xff09;&#xff0c;\u5728\u5185\u5b58\u4e2d\u7ef4\u62a4\u4e00\u68f5\u76ee\u5f55\u6811&#xff0c;\u628a\u66fe\u7ecf\u89e3\u6790\u8fc7\u7684\u76ee\u5f55\u6761\u76ee\u7f13\u5b58\u8d77\u6765&#xff0c;\u51cf\u5c11\u78c1\u76d8\u8bbf\u95ee\u3002<\/p>\n<h4>5.3 \u5185\u5b58\u91cc\u7684\u76ee\u5f55\u6811&#xff1a;dentry\u7ed3\u6784\u4f53<\/h4>\n<p>\u2003\u2003\u65e2\u7136\u8981\u5728\u5185\u5b58\u91cc\u5efa\u6811&#xff0c;\u6211\u4eec\u5c31\u5f97\u5b9a\u4e49\u4e00\u4e2a\u7ed3\u6784\u4f53\u6765\u63cf\u8ff0\u6811\u7684\u8282\u70b9&#xff0c;\u8fd9\u5c31\u662f struct dentry\u3002<\/p>\n<p>\u2003\u2003\u4e3a\u4e86\u89e3\u51b3\u201c\u600e\u4e48\u5efa\u6811\u201d\u3001\u201c\u600e\u4e48\u5feb\u901f\u627e\u201d\u3001\u201c\u600e\u4e48\u56de\u6536\u5185\u5b58\u201d\u3001\u201c\u600e\u4e48\u6307\u5411\u771f\u5b9e\u6587\u4ef6\u201d\u7b49\u4e00\u7cfb\u5217\u95ee\u9898&#xff0c;\u5185\u6838\u5de5\u7a0b\u5e08\u4eec\u8bbe\u8ba1\u4e86\u6781\u5176\u7cbe\u5999\u7684\u5b57\u6bb5\u3002<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">dentry<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">atomic_t<\/span> d_count<span class=\"token punctuation\">;<\/span>                 <span class=\"token comment\">\/* \u5f15\u7528\u8ba1\u6570 *\/<\/span><br \/>\n    <span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">int<\/span> d_flags<span class=\"token punctuation\">;<\/span>             <span class=\"token comment\">\/* \u6807\u5fd7\u4f4d *\/<\/span><br \/>\n    <span class=\"token class-name\">spinlock_t<\/span> d_lock<span class=\"token punctuation\">;<\/span>                <span class=\"token comment\">\/* \u81ea\u65cb\u9501&#xff0c;\u4fdd\u62a4dentry *\/<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">inode<\/span> <span class=\"token operator\">*<\/span>d_inode<span class=\"token punctuation\">;<\/span>            <span class=\"token comment\">\/* \u6307\u5411\u8fd9\u4e2a\u76ee\u5f55\u9879\u5bf9\u5e94\u7684inode&#xff0c;NULL\u4ee3\u8868\u8d1f\u7f13\u5b58 *\/<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">hlist_node<\/span> d_hash<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/* \u54c8\u5e0c\u94fe\u8868&#xff0c;\u5feb\u901f\u67e5\u627edentry *\/<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">dentry<\/span> <span class=\"token operator\">*<\/span>d_parent<span class=\"token punctuation\">;<\/span>          <span class=\"token comment\">\/* \u7236\u76ee\u5f55\u7684dentry&#xff0c;\u6307\u5411\u6811\u7684\u4e0a\u4e00\u5c42 *\/<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">qstr<\/span> d_name<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">\/* \u76ee\u5f55\u9879\u540d\u5b57 *\/<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span> d_lru<span class=\"token punctuation\">;<\/span>           <span class=\"token comment\">\/* LRU\u94fe\u8868&#xff0c;\u7528\u4e8e\u6dd8\u6c70\u957f\u671f\u4e0d\u7528\u7684\u7f13\u5b58 *\/<\/span><br \/>\n    <span class=\"token keyword\">union<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span> d_child<span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">\/* \u5b50\u76ee\u5f55\u94fe\u8868&#xff0c;\u6302\u5728\u7236\u76ee\u5f55\u7684d_subdirs\u4e0b *\/<\/span><br \/>\n        <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">rcu_head<\/span> d_rcu<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span> d_u<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span> d_subdirs<span class=\"token punctuation\">;<\/span>       <span class=\"token comment\">\/* \u5b50\u76ee\u5f55\u96c6\u5408&#xff0c;\u6307\u5411\u6811\u7684\u6240\u6709\u4e0b\u5c42\u8282\u70b9 *\/<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span> d_alias<span class=\"token punctuation\">;<\/span>         <span class=\"token comment\">\/* inode\u522b\u540d\u94fe\u8868 *\/<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230; \u5176\u4ed6\u5b57\u6bb5<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> d_mounted<span class=\"token punctuation\">;<\/span>                    <span class=\"token comment\">\/* \u662f\u5426\u6302\u8f7d\u70b9 *\/<\/span><br \/>\n    <span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">char<\/span> d_iname<span class=\"token punctuation\">[<\/span>DNAME_INLINE_LEN_MIN<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/* \u77ed\u540d\u5b57\u76f4\u63a5\u5b58\u7ed3\u6784\u4f53\u5185\u90e8 *\/<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u4ed4\u7ec6\u770b\u4e0a\u9762\u8fd9\u6bb5\u6e90\u7801&#xff0c;\u5b83\u5b8c\u7f8e\u89e3\u7b54\u4e86\u6211\u4eec\u5728\u5185\u5b58\u4e2d\u5efa\u6811\u9047\u5230\u7684\u56db\u5927\u96be\u9898&#xff1a;<\/p>\n<li>\u600e\u4e48\u5efa\u6811&#xff1f; \u9760 d_parent&#xff08;\u6307\u5411\u7236\u8282\u70b9&#xff09;\u548c d_subdirs&#xff08;\u6307\u5411\u5b50\u8282\u70b9\u94fe\u8868&#xff09;&#xff0c;\u8fd9\u5c31\u4e32\u8d77\u4e86\u4e00\u68f5\u53cc\u5411\u7684\u5185\u5b58\u76ee\u5f55\u6811\u3002<\/li>\n<li>\u600e\u4e48\u5feb\u901f\u5b9a\u4f4d&#xff1f; \u9760 d_hash&#xff08;\u54c8\u5e0c\u94fe\u8868&#xff09;&#xff0c;\u628adentry\u6302\u5728\u54c8\u5e0c\u8868\u91cc&#xff0c;\u5b9e\u73b0O(1)\u7ea7\u67e5\u627e\u3002<\/li>\n<li>\u5185\u5b58\u4e0d\u591f\u600e\u4e48\u529e&#xff1f; \u9760 d_lru&#xff08;\u6700\u8fd1\u6700\u5c11\u4f7f\u7528\u94fe\u8868&#xff09;&#xff0c;\u5f53\u5185\u5b58\u7d27\u5f20\u65f6&#xff0c;LRU\u7b97\u6cd5\u6dd8\u6c70\u6389\u90a3\u4e9b\u5f88\u4e45\u6ca1\u7528\u7684dentry\u7f13\u5b58\u3002<\/li>\n<li>\u600e\u4e48\u627e\u5230\u771f\u5b9e\u6570\u636e&#xff1f; \u9760 d_inode&#xff0c;\u76f4\u63a5\u6307\u5411\u8be5\u6587\u4ef6\u5728\u78c1\u76d8\u4e0a\u7684inode&#xff08;\u5982\u679c\u662f\u8d1f\u7f13\u5b58\u5219\u6307\u5411NULL&#xff0c;\u8868\u793a\u6587\u4ef6\u4e0d\u5b58\u5728&#xff09;\u3002<\/li>\n<h4>5.4 \u6838\u5fc3\u603b\u7ed3<\/h4>\n<p>\u2003\u2003\u6709\u4e86 dentry \u7f13\u5b58&#xff0c;\u6253\u5f00\u6587\u4ef6\u65f6&#xff0c;\u5185\u6838\u4f18\u5148\u5728 dentry \u7f13\u5b58\u6811\u91cc\u68c0\u7d22\u8def\u5f84&#xff0c;\u627e\u5230\u76f4\u63a5\u62ff\u5230 inode&#xff1b;\u7f13\u5b58\u4e0d\u5b58\u5728&#xff0c;\u624d\u53bb\u78c1\u76d8\u8bfb\u53d6\u76ee\u5f55&#xff0c;\u751f\u6210\u65b0 dentry \u52a0\u5165\u7f13\u5b58\u3002<\/p>\n<p>\u8003\u70b9&#xff1a;<\/p>\n<ul>\n<li>Q&#xff1a;\u78c1\u76d8\u4e0a\u6709\u6ca1\u6709\u771f\u5b9e\u7684\u201c\u76ee\u5f55\u6811\u201d&#xff1f;\n<ul>\n<li>A&#xff1a;\u6ca1\u6709\u3002\u78c1\u76d8\u53ea\u4fdd\u5b58\u4e00\u4e2a\u4e2a\u72ec\u7acb\u6587\u4ef6&#xff08;\u5c5e\u6027&#043;\u6570\u636e&#xff09;&#xff0c;\u76ee\u5f55\u6811\u662f\u5185\u6838\u5728\u5185\u5b58\u91cc\u9762&#xff0c;\u901a\u8fc7dentry\u7ed3\u6784\u4f53\u6784\u5efa\u51fa\u6765\u7684\u903b\u8f91\u6811\u3002<\/li>\n<\/ul>\n<\/li>\n<li>Q&#xff1a;\u6bcf\u6b21\u6253\u5f00\u6587\u4ef6&#xff0c;\u90fd\u8981\u4ece\u6839\u76ee\u5f55\u5f00\u59cb\u8bfb\u78c1\u76d8\u89e3\u6790\u8def\u5f84\u5417&#xff1f;\n<ul>\n<li>A&#xff1a;\u903b\u8f91\u4e0a\u662f\u4ece\u6839\u76ee\u5f55\u89e3\u6790&#xff0c;\u4f46\u5185\u6838\u4f1a\u7f13\u5b58\u5df2\u7ecf\u8bbf\u95ee\u8fc7\u7684\u76ee\u5f55\u9879&#xff08;dentry&#xff09;&#xff0c;\u4f18\u5148\u5728\u5185\u5b58\u7f13\u5b58\u67e5\u627e&#xff0c;\u7f13\u5b58\u547d\u4e2d\u5c31\u4e0d\u7528\u8bfb\u78c1\u76d8\u3002<\/li>\n<\/ul>\n<\/li>\n<li>Q&#xff1a;dentry\u7f13\u5b58\u4f1a\u6301\u4e45\u5316\u5230\u78c1\u76d8\u5417&#xff1f;\n<ul>\n<li>A&#xff1a;\u7edd\u5bf9\u4e0d\u4f1a&#xff01;dentry\u53ea\u662f\u5185\u5b58\u7f13\u5b58&#xff0c;\u91cd\u542f\u4e4b\u540e\u7f13\u5b58\u5168\u90e8\u6d88\u5931&#xff0c;\u78c1\u76d8\u4e0a\u4e0d\u4f1a\u4fdd\u5b58dentry\u3002\u5b83\u7684\u751f\u547d\u5468\u671f\u5b8c\u5168\u7531\u5185\u5b58\u7ba1\u7406\u548c\u7cfb\u7edf\u8fd0\u884c\u72b6\u6001\u51b3\u5b9a\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>6. \u6302\u8f7d\u5206\u533a&#xff08;Mount&#xff09;<\/h3>\n<p>\u2003\u2003\u6211\u4eec\u5df2\u7ecf\u638c\u63e1&#xff1a;\u5728\u5355\u4e2a\u5206\u533a\u5185\u90e8&#xff0c;\u53ef\u4ee5\u901a\u8fc7inode\u627e\u5230\u6587\u4ef6&#xff0c;\u901a\u8fc7\u76ee\u5f55\u6587\u4ef6\u89e3\u6790\u6587\u4ef6\u540d\u3002\u4f46\u662f\u4e00\u53f0Linux\u53ef\u4ee5\u6709\u591a\u4e2a\u78c1\u76d8\u5206\u533a&#xff0c;\u800cinode\u7f16\u53f7\u4e0d\u80fd\u8de8\u5206\u533a&#xff0c;\u4e0d\u540c\u5206\u533ainode\u53ef\u4ee5\u91cd\u590d\u3002\u5185\u6838\u5982\u4f55\u533a\u5206\u5f53\u524d\u8def\u5f84\u5c5e\u4e8e\u54ea\u4e00\u4e2a\u5206\u533a&#xff1f;\u7b54\u6848\u5c31\u662f\u6302\u8f7d&#xff08;mount&#xff09;\u3002<\/p>\n<h4>6.1 \u5b9e\u64cd\u6f14\u793amount\u6302\u8f7d\u955c\u50cf\u6587\u4ef6<\/h4>\n<p>\u2003\u2003\u6211\u4eec\u7528dd\u521b\u5efa\u865a\u62df\u78c1\u76d8\u955c\u50cf&#xff0c;\u6a21\u62df\u5206\u533a&#xff0c;\u5b8c\u6210\u683c\u5f0f\u5316\u3001\u6302\u8f7d\u3001\u5378\u8f7d\u3002<\/p>\n<p><span class=\"token comment\"># 1. \u751f\u62105M\u5927\u5c0f\u955c\u50cf\u6587\u4ef6&#xff0c;\u6a21\u62df\u4e00\u5757\u78c1\u76d8\u5206\u533a<\/span><br \/>\n$ <span class=\"token function\">dd<\/span> <span class=\"token assign-left variable\">if<\/span><span class=\"token operator\">&#061;<\/span>\/dev\/zero <span class=\"token assign-left variable\">of<\/span><span class=\"token operator\">&#061;<\/span>.\/disk.img <span class=\"token assign-left variable\">bs<\/span><span class=\"token operator\">&#061;<\/span>1M <span class=\"token assign-left variable\">count<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">5<\/span><br \/>\n<span class=\"token comment\"># 2. \u628a\u955c\u50cf\u683c\u5f0f\u5316\u4e3aext4\u6587\u4ef6\u7cfb\u7edf&#xff08;\u539f\u7406\u548cext2\u4e00\u81f4&#xff09;<\/span><br \/>\n$ mkfs.ext4 disk.img<br \/>\n<span class=\"token comment\"># 3. \u521b\u5efa\u7a7a\u76ee\u5f55&#xff0c;\u4f5c\u4e3a\u6302\u8f7d\u70b9<\/span><br \/>\n$ <span class=\"token function\">mkdir<\/span> \/mnt\/mydisk<br \/>\n<span class=\"token comment\"># 4. \u6302\u8f7d\u955c\u50cf\u5230\/mnt\/mydisk<\/span><br \/>\n$ <span class=\"token function\">sudo<\/span> <span class=\"token function\">mount<\/span> <span class=\"token parameter variable\">-t<\/span> ext4 .\/disk.img \/mnt\/mydisk\/<br \/>\n<span class=\"token comment\"># 5. \u67e5\u770b\u6302\u8f7d\u4fe1\u606f&#xff0c;\u6b64\u65f6\u80fd\u770b\u5230 \/dev\/loop0 \u6302\u8f7d\u5728 \/mnt\/mydisk<\/span><br \/>\n$ <span class=\"token function\">df<\/span> <span class=\"token parameter variable\">-h<\/span><br \/>\n\/dev\/loop0 <span class=\"token number\">4<\/span>.7M 24K <span class=\"token number\">4<\/span>.4M <span class=\"token number\">1<\/span>% \/mnt\/mydisk<br \/>\n<span class=\"token comment\"># 6. \u5378\u8f7d\u5206\u533a<\/span><br \/>\n$ <span class=\"token function\">sudo<\/span> <span class=\"token function\">umount<\/span> \/mnt\/mydisk<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122534-6acb803e7d2c1.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"500\" \/> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122534-6acb803eb83fa.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"500\" \/><\/p>\n<p>\u2003\u2003\u8fd9\u91cc\u51fa\u73b0 \/dev\/loop0&#xff0c;\u662floop\u56de\u73af\u8bbe\u5907&#xff1a;loop\u8bbe\u5907\u662f\u4f2a\u5757\u8bbe\u5907&#xff0c;\u53ef\u4ee5\u628a\u666e\u901a\u6587\u4ef6\u5f53\u505a\u4e00\u5757\u78c1\u76d8\u5757\u8bbe\u5907\u4f7f\u7528\u3002\u6211\u4eec\u7684disk.img\u53ea\u662f\u666e\u901a\u6587\u4ef6&#xff0c;\u901a\u8fc7loop\u8bbe\u5907&#xff0c;\u5185\u6838\u53ef\u4ee5\u50cf\u64cd\u4f5c\u7269\u7406\u786c\u76d8\u5206\u533a\u4e00\u6837\u8bfb\u5199\u8fd9\u4e2a\u955c\u50cf&#xff0c;ISO\u955c\u50cf\u6302\u8f7d\u4e5f\u662f\u540c\u6837\u539f\u7406\u3002<\/p>\n<h4>6.2 \u6302\u8f7d\u6838\u5fc3\u7ed3\u8bba<\/h4>\n<li>\u5206\u533a\u5199\u5165\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528&#xff0c;\u5fc5\u987b\u548c\u76ee\u5f55\u505a\u5173\u8054&#xff0c;\u4e5f\u5c31\u662f\u6302\u8f7d\u3002<\/li>\n<li>\u5185\u6838\u89e3\u6790\u8def\u5f84\u7684\u65f6\u5019&#xff0c;\u6839\u636e\u8def\u5f84\u524d\u7f00\u5224\u65ad\u8fd9\u4e2a\u8def\u5f84\u5c5e\u4e8e\u54ea\u4e2a\u6302\u8f7d\u70b9&#xff0c;\u5c31\u77e5\u9053\u5f53\u524d\u8bbf\u95ee\u7684\u662f\u54ea\u4e00\u4e2a\u5206\u533a&#xff0c;\u8fd9\u6837\u5c31\u53ef\u4ee5\u533a\u5206\u4e0d\u540c\u5206\u533a\u7684inode&#xff0c;\u89e3\u51b3inode\u8de8\u5206\u533a\u51b2\u7a81\u7684\u95ee\u9898\u3002<\/li>\n<p>\u7406\u89e3&#xff1a;\u628a\u72ec\u7acb\u7684\u5206\u533a\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u5ac1\u63a5\u5728\u6839\u76ee\u5f55\u6811\u7684\u67d0\u4e2a\u7a7a\u8282\u70b9\u4e0a&#xff0c;\u8ba9\u591a\u4e2a\u78c1\u76d8\u5206\u533a\u5408\u5e76\u6210\u4e00\u68f5\u7edf\u4e00\u7684\u76ee\u5f55\u6811&#xff0c;\u7ed9\u7528\u6237\u4f7f\u7528\u3002<\/p>\n<hr \/>\n<h3>7. \u8f6f\u786c\u8fde\u63a5<\/h3>\n<p>\u2003\u2003\u78c1\u76d8\u5b9a\u4f4d\u6587\u4ef6\u9760\u7684\u662finode&#xff0c;\u6587\u4ef6\u540d\u53ea\u662f\u76ee\u5f55\u6570\u636e\u5757\u91cc\u7684\u4e00\u4e2a\u6620\u5c04\u6761\u76ee\u3002\u65e2\u7136\u8fd9\u6837&#xff0c;\u6211\u4eec\u80fd\u4e0d\u80fd\u8ba9\u591a\u4e2a\u6587\u4ef6\u540d&#xff0c;\u6620\u5c04\u5230\u540c\u4e00\u4e2ainode\u4e0a\u5462&#xff1f;\u6216\u8005&#xff0c;\u6211\u4eec\u80fd\u4e0d\u80fd\u7ed9\u4e00\u4e2a\u6587\u4ef6\u8d77\u4e2a\u522b\u540d&#xff1f;\u57fa\u4e8e\u8fd9\u4e2a\u601d\u8003&#xff0c;Linux\u5f15\u5165\u4e86\u8f6f\u94fe\u63a5\u548c\u786c\u94fe\u63a5\u7684\u673a\u5236\u3002<\/p>\n<h4>7.1 \u786c\u94fe\u63a5&#xff08;Hard Link&#xff09;<\/h4>\n<p>\u2003\u2003\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u6587\u4ef6 abc&#xff0c;\u60f3\u8981\u518d\u7ed9\u5b83\u8d77\u4e2a\u540d\u5b57\u53eb def&#xff0c;\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 ln abc def \u547d\u4ee4\u3002<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;localhost linux<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ln abc def<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;localhost linux<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ls -li abc def<\/span><br \/>\n<span class=\"token number\">263466<\/span> abc<br \/>\n<span class=\"token number\">263466<\/span> def<\/p>\n<p>\u2003\u2003\u6211\u4eec\u53d1\u73b0&#xff0c;abc \u548c def \u7684 inode \u7f16\u53f7\u7adf\u7136\u5b8c\u5168\u4e00\u6837&#xff01;\u8fd9\u8bf4\u660e&#xff0c;\u786c\u94fe\u63a5\u672c\u8d28\u4e0a\u5e76\u4e0d\u662f\u4e00\u4e2a\u65b0\u6587\u4ef6&#xff0c;\u5b83\u53ea\u662f\u5f53\u524d\u76ee\u5f55\u7684\u6570\u636e\u5757\u91cc&#xff0c;\u65b0\u589e\u4e86\u4e00\u6761\u201c\u522b\u540d -&gt; \u76ee\u6807inode\u201d\u7684\u6620\u5c04\u5173\u7cfb\u3002\u5b83\u4eec\u5171\u4eab\u4e86\u540c\u4e00\u4e2ainode\u548c\u6570\u636e\u5757\u3002<\/p>\n<p>\u2003\u2003\u8fd9\u5c31\u5e26\u6765\u4e86\u4e00\u4e2a\u95ee\u9898&#xff1a;\u5982\u679c\u5220\u9664\u5176\u4e2d\u4e00\u4e2a\u540d\u5b57&#xff0c;\u6587\u4ef6\u6570\u636e\u4f1a\u88ab\u5220\u6389\u5417&#xff1f;\u7b54\u6848\u662f\u4e0d\u4f1a\u3002\u56e0\u4e3a\u5185\u6838\u5728inode\u7ed3\u6784\u4f53\u91cc&#xff0c;\u4e13\u95e8\u8bbe\u8ba1\u4e86\u4e00\u4e2a\u8ba1\u6570\u5668 i_links_count \u6765\u8bb0\u5f55\u8fd9\u4e2ainode\u88ab\u591a\u5c11\u4e2a\u6587\u4ef6\u540d\u5173\u8054\u7740\u3002<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">ext2_inode<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230;<\/span><br \/>\n    __le16 i_links_count<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/* \u786c\u94fe\u63a5\u8ba1\u6570&#xff0c;\u6838\u5fc3&#xff01; *\/<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2003\u2003\u5f53\u6211\u4eec\u6267\u884c rm \u5220\u9664\u6587\u4ef6\u65f6&#xff0c;\u5e95\u5c42\u7ecf\u5386\u4e86\u4e09\u4e2a\u4e25\u8c28\u7684\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u5728\u76ee\u5f55\u6587\u4ef6\u4e2d&#xff0c;\u5220\u9664\u8fd9\u6761\u201c\u6587\u4ef6\u540d-inode\u201d\u7684\u6620\u5c04\u6761\u76ee\u3002<\/li>\n<li>\u5c06\u8be5inode\u7684\u786c\u94fe\u63a5\u8ba1\u6570 i_links_count -&#061; 1\u3002<\/li>\n<li>\u53ea\u6709\u5f53\u51cf\u5b8c\u7684\u94fe\u63a5\u8ba1\u6570\u7b49\u4e8e0\u65f6&#xff0c;\u5185\u6838\u624d\u4f1a\u771f\u6b63\u91ca\u653einode\u548c\u5bf9\u5e94\u7684\u6570\u636e\u5757&#xff0c;\u78c1\u76d8\u7a7a\u95f4\u624d\u4f1a\u771f\u6b63\u56de\u6536\u3002<\/li>\n<h4>7.2 \u6df1\u5165\u4e86\u89e3&#xff1a;\u76ee\u5f55\u4e5f\u6709\u786c\u94fe\u63a5\u5417&#xff1f;<\/h4>\n<p>\u2003\u2003\u65e2\u7136\u786c\u94fe\u63a5\u8fd9\u4e48\u597d\u7528&#xff0c;\u6211\u4eec\u80fd\u4e0d\u80fd\u7ed9\u76ee\u5f55\u4e5f\u521b\u5efa\u4e00\u4e2a\u786c\u94fe\u63a5\u5462&#xff1f;\u6211\u4eec\u5c1d\u8bd5\u6267\u884c ln dir hard&#xff0c;\u7cfb\u7edf\u76f4\u63a5\u62a5\u9519&#xff1a;hard link not allowed for directory\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8&#xff1f; \u2003\u2003\u6211\u4eec\u4e0d\u59a8\u5148\u770b\u770b\u7cfb\u7edf\u81ea\u5df1\u662f\u600e\u4e48\u505a\u7684\u3002\u5b9e\u9645\u4e0a&#xff0c;\u7cfb\u7edf\u5728\u521b\u5efa\u76ee\u5f55\u65f6&#xff0c;\u5c31\u5df2\u7ecf\u9ed8\u8ba4\u5e94\u7528\u4e86\u786c\u94fe\u63a5\u673a\u5236\u3002\u5f53\u6211\u4eec\u6267\u884c mkdir dir&#xff0c;\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;\u8fd9\u4e2a\u7a7a\u76ee\u5f55\u7684\u786c\u94fe\u63a5\u6570\u5c31\u662f 2\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122535-6acb803f02bf0.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"500\" \/><\/p>\n<p>\u4e3a\u4ec0\u4e48\u662f2&#xff1f;\u56e0\u4e3a&#xff1a;<\/p>\n<li>\u7236\u76ee\u5f55\u91cc\u6709\u4e00\u4e2a\u540d\u5b57 dir&#xff0c;\u6307\u5411inode 398078\u3002<\/li>\n<li>\u8fdb\u5165 dir \u540e&#xff0c;\u91cc\u9762\u9ed8\u8ba4\u751f\u6210\u7684\u9690\u85cf\u76ee\u5f55 .&#xff08;\u5f53\u524d\u76ee\u5f55&#xff09;&#xff0c;\u4e5f\u6307\u5411inode 398078\u3002 \u6240\u4ee5&#xff0c;\u4efb\u4f55\u4e00\u4e2a\u76ee\u5f55\u5185\u90e8\u7684 .&#xff0c;\u672c\u8d28\u4e0a\u90fd\u662f\u5bf9\u5f53\u524d\u76ee\u5f55\u7684\u786c\u94fe\u63a5\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122535-6acb803f1ba0c.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"500\" \/><\/li>\n<p>\u2003\u2003\u5982\u679c\u6211\u4eec\u5728 dir \u4e0b\u518d\u65b0\u5efa\u4e00\u4e2a\u5b50\u76ee\u5f55 hello&#xff0c;\u7236\u76ee\u5f55 dir \u7684\u786c\u94fe\u63a5\u6570\u4f1a\u53d8\u6210 3\u3002 \u2003\u2003\u56e0\u4e3a\u8fdb\u5165\u65b0\u5efa\u7acb\u7684\u5b50\u76ee\u5f55 hello \u540e&#xff0c;\u9ed8\u8ba4\u751f\u6210\u7684\u9690\u85cf\u76ee\u5f55 ..&#xff08;\u4e0a\u4e00\u7ea7\u76ee\u5f55&#xff09;&#xff0c;\u4f1a\u81ea\u52a8\u6307\u5411\u7236\u76ee\u5f55 dir \u7684inode\u3002\u56e0\u6b64&#xff0c;\u4e00\u4e2a\u76ee\u5f55\u7684\u786c\u94fe\u63a5\u6570 &#061; 2 &#043; \u8be5\u76ee\u5f55\u4e0b\u7684\u5b50\u76ee\u5f55\u4e2a\u6570\u3002<\/p>\n<h4>7.3 \u4e3a\u4ec0\u4e48\u7981\u6b62\u7528\u6237\u7ed9\u76ee\u5f55\u5efa\u786c\u94fe\u63a5&#xff1f;&#xff08;\u73af\u8def\u95ee\u9898&#xff09;<\/h4>\n<p>\u2003\u2003\u867d\u7136\u7cfb\u7edf\u81ea\u5df1\u7528\u4e86 . \u548c ..&#xff0c;\u4f46\u4e3a\u4ec0\u4e48\u4e25\u7981\u666e\u901a\u7528\u6237\u7ed9\u76ee\u5f55\u5efa\u786c\u94fe\u63a5&#xff1f;\u56e0\u4e3aLinux\u7684\u6587\u4ef6\u7cfb\u7edf\u7ed3\u6784\u662f\u4e00\u68f5\u591a\u53c9\u6811\u3002\u5982\u679c\u5141\u8bb8\u7528\u6237\u7ed9\u76ee\u5f55\u5efa\u7acb\u786c\u94fe\u63a5&#xff0c;\u5c31\u4f1a\u5728\u76ee\u5f55\u7ed3\u6784\u4e2d\u5f62\u6210\u73af\u8def&#xff08;Loop&#xff09;\u3002<\/p>\n<p>\u2003\u2003\u5982\u679cA\u76ee\u5f55\u786c\u94fe\u63a5\u5230B\u76ee\u5f55&#xff0c;B\u76ee\u5f55\u53c8\u786c\u94fe\u63a5\u56deA\u76ee\u5f55&#xff0c;\u5f53\u7cfb\u7edf\u6267\u884c\u8def\u5f84\u67e5\u627e\u3001\u8ba1\u7b97\u76ee\u5f55\u5927\u5c0f&#xff0c;\u6216\u8005\u6267\u884cBFS\/DFS&#xff08;\u5e7f\u5ea6\/\u6df1\u5ea6\u4f18\u5148\u641c\u7d22&#xff09;\u904d\u5386\u65f6&#xff0c;\u5c31\u4f1a\u9677\u5165\u6b7b\u5faa\u73af&#xff0c;\u5bfc\u81f4\u7cfb\u7edf\u5d29\u6e83\u3002<\/p>\n<p>\u2003\u2003\u800c . \u548c .. \u867d\u7136\u662f\u786c\u94fe\u63a5&#xff0c;\u4f46\u5b83\u4eec\u662f\u7cfb\u7edf\u5b9a\u6b7b\u7684\u3001\u5185\u6838\u5c42\u7ea7\u6709\u7279\u6b8a\u8c41\u514d\u673a\u5236\u7684\u5b58\u5728\u3002\u5e95\u5c42\u904d\u5386\u7b97\u6cd5\u9047\u5230\u5b83\u4eec\u4f1a\u81ea\u52a8\u8df3\u8fc7&#xff0c;\u56e0\u6b64\u4e0d\u4f1a\u5f15\u53d1\u73af\u8def\u95ee\u9898\u3002\u666e\u901a\u7528\u6237\u4e00\u65e6\u624b\u52a8\u521b\u5efa&#xff0c;\u7cfb\u7edf\u5c31\u4f1a\u76f4\u63a5\u62e6\u622a\u3002<\/p>\n<h4>7.4 \u8f6f\u94fe\u63a5&#xff08;Symbolic Link&#xff09;<\/h4>\n<p>\u2003\u2003\u65e2\u7136\u786c\u94fe\u63a5\u4e0d\u80fd\u7ed9\u76ee\u5f55\u7528&#xff0c;\u8de8\u5206\u533a\u4e5f\u4e0d\u80fd\u7528&#xff0c;\u90a3\u6211\u60f3\u5728\u684c\u9762\u4e0a\u653e\u4e00\u4e2a\u6df1\u5c42\u76ee\u5f55\u7684\u201c\u5feb\u6377\u65b9\u5f0f\u201d\u600e\u4e48\u529e&#xff1f;Linux\u7ed9\u51fa\u4e86\u8f6f\u94fe\u63a5&#xff08;\u7b26\u53f7\u94fe\u63a5&#xff09;\u65b9\u6848\u3002<\/p>\n<p>\u2003\u2003\u4f7f\u7528 ln -s abc abc.s&#xff0c;\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u8f6f\u94fe\u63a5\u3002\u7528 ls -li \u89c2\u5bdf&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122535-6acb803f3e912.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" width=\"500\" \/><\/p>\n<p>\u2003\u2003abc.s \u7684inode\u53f7\u662f\u5168\u65b0\u7684&#xff0c;\u6743\u9650\u4f4d\u4ee5 l \u5f00\u5934&#xff0c;\u8868\u793a\u5b83\u662f\u72ec\u7acb\u7684\u65b0\u6587\u4ef6\u3002\u5b83\u7684\u6570\u636e\u5757\u91cc\u4fdd\u5b58\u7684\u4e0d\u662f\u6587\u4ef6\u5185\u5bb9&#xff0c;\u800c\u662f\u76ee\u6807\u6587\u4ef6\u7684\u8def\u5f84\u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u2003\u2003\u8fd9\u5c31\u5b8c\u7f8e\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u8f6f\u94fe\u63a5\u53ef\u4ee5\u6307\u5411\u76ee\u5f55&#xff1a;\u5f53\u7cfb\u7edf\u7b97\u6cd5\u5728\u8fdb\u884cDFS\u904d\u5386\u65f6&#xff0c;\u78b0\u5230\u8f6f\u94fe\u63a5&#xff0c;\u53ea\u4f1a\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u666e\u901a\u7684\u201c\u5feb\u6377\u65b9\u5f0f\u201d\u6587\u4ef6\u5904\u7406&#xff0c;\u5b83\u4e0d\u4f1a\u81ea\u52a8\u6df1\u5165\u53bb\u904d\u5386\u8f6f\u94fe\u63a5\u6240\u6307\u5411\u7684\u76ee\u6807\u76ee\u5f55\u3002<\/p>\n<p>\u2003\u2003\u5f53\u7136&#xff0c;\u8f6f\u94fe\u63a5\u4e5f\u6709\u5b83\u7684\u4ee3\u4ef7&#xff1a;\u5982\u679c\u5220\u9664\u4e86\u6e90\u6587\u4ef6 abc&#xff0c;\u8f6f\u94fe\u63a5 abc.s \u4f9d\u7136\u5b58\u5728&#xff0c;\u4f46\u6307\u5411\u4e86\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u8def\u5f84&#xff0c;\u53d8\u6210\u4e86\u5931\u6548\u7684\u60ac\u7a7a\u94fe\u63a5\u3002<\/p>\n<h4>7.5 \u6587\u4ef6\u4e09\u4e2a\u65f6\u95f4\u6233<\/h4>\n<p>\u5728\u68b3\u7406\u8f6f\u786c\u94fe\u63a5\u65f6&#xff0c;\u5fc5\u987b\u641e\u6e05\u695a\u6587\u4ef6\u7684\u4e09\u4e2a\u65f6\u95f4\u6233&#xff09;&#xff1a;<\/p>\n<li>Access&#xff08;atime&#xff09;&#xff1a;\u6700\u540e\u4e00\u6b21\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u7684\u65f6\u95f4\u3002<\/li>\n<li>Modify&#xff08;mtime&#xff09;&#xff1a;\u6587\u4ef6\u5185\u5bb9\u88ab\u4fee\u6539\u7684\u6700\u540e\u65f6\u95f4\u3002<\/li>\n<li>Change&#xff08;ctime&#xff09;&#xff1a;\u6587\u4ef6\u5c5e\u6027&#xff08;\u6743\u9650\u3001\u786c\u94fe\u63a5\u8ba1\u6570\u7b49\u5143\u6570\u636e&#xff09;\u4fee\u6539\u7684\u6700\u540e\u65f6\u95f4\u3002<\/li>\n<p>\u7ec6\u8282\u63d0\u793a&#xff1a;\u786c\u94fe\u63a5\u589e\u52a0\u6216\u5220\u9664\u65f6&#xff0c;\u6587\u4ef6\u5185\u5bb9\u6ca1\u53d8&#xff08;mtime\u4e0d\u53d8&#xff09;&#xff0c;\u4f46 i_links_count \u53d8\u4e86&#xff0c;\u6240\u4ee5 ctime \u4f1a\u66f4\u65b0\u3002<\/p>\n<h4>7.6 \u6838\u5fc3\u5bf9\u6bd4\u4e0e\u603b\u7ed3<\/h4>\n<table>\n<tr>\u7279\u6027\u786c\u94fe\u63a5\u8f6f\u94fe\u63a5<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">\u672c\u8d28<\/td>\n<td align=\"left\">\u6587\u4ef6\u540d\u4e0e\u76ee\u6807\u6587\u4ef6inode\u7684\u6620\u5c04\u5173\u7cfb<\/td>\n<td align=\"left\">\u72ec\u7acb\u6587\u4ef6&#xff0c;\u5185\u5bb9\u4e3a\u76ee\u6807\u6587\u4ef6\u7684\u8def\u5f84<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">inode<\/td>\n<td align=\"left\">\u4e0e\u76ee\u6807\u6587\u4ef6\u76f8\u540c<\/td>\n<td align=\"left\">\u4e0e\u76ee\u6807\u6587\u4ef6\u4e0d\u540c<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u94fe\u63a5\u6570<\/td>\n<td align=\"left\">\u589e\u52a0&#xff08;i_links_count&#xff09;<\/td>\n<td align=\"left\">\u4e0d\u589e\u52a0<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u8de8\u5206\u533a<\/td>\n<td align=\"left\">\u4e0d\u652f\u6301<\/td>\n<td align=\"left\">\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u76ee\u5f55<\/td>\n<td align=\"left\">\u4e0d\u652f\u6301&#xff08;\u6613\u5f62\u6210\u73af\u8def&#xff09;<\/td>\n<td align=\"left\">\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u6e90\u6587\u4ef6\u5220\u9664<\/td>\n<td align=\"left\">\u6587\u4ef6\u4f9d\u7136\u5b58\u5728&#xff08;\u76f4\u5230\u94fe\u63a5\u6570\u4e3a0&#xff09;<\/td>\n<td align=\"left\">\u6587\u4ef6\u5931\u6548&#xff08;\u60ac\u7a7a\u94fe\u63a5&#xff09;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u7528\u9014<\/td>\n<td align=\"left\">. \u548c .. \u76ee\u5f55\u3001\u6587\u4ef6\u5907\u4efd<\/td>\n<td align=\"left\">\u7c7b\u4f3c\u5feb\u6377\u65b9\u5f0f\u3001\u8f6f\u4ef6\u7248\u672c\u7ba1\u7406&#xff08;\u5982 python -&gt; python3&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u7ed3\u8bed&#xff1a;<\/h3>\n<p>\u2003\u2003\u4eca\u5929\u7684\u5185\u5bb9\u5230\u8fd9\u91cc\u5c31\u7ed3\u675f\u4e86&#xff0c;\u5e0c\u671b\u4f60\u80fd\u6709\u6240\u6536\u83b7~<\/p>\n<p><font color=\"skyblue\">\u5e72\u8d27\u6574\u7406\u5230\u624b\u6296&#xff0c;\u89c9\u5f97\u6709\u7528\u7684\u8bdd&#xff0c;\u8d4f\u4e2a\u4e09\u8fde\u56de\u56de\u8840&#xff1f;<\/font>__(:\u15e4\u300d\u3125)_ _<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230 huangjin007_ \u7684\u535a\u5ba2 \u2b50 \u4e2a\u4eba\u4e3b\u9875&#xff1a;huangjin007_ &#x1f525; \u6587\u7ae0\u6536\u5f55\u4e13\u680f&#xff1a;Linux \u5185\u529f\u4fee\u70bc\u624b\u518c(\u7cfb\u7edf\u7bc7)  \u603b\u4f1a\u6709\u4e00\u4e9b\u575a\u6301\u80fd\u4ece\u51b0\u5c01\u7684\u571f\u5730\u91cc\u57f9\u80b2\u51fa\u5341\u4e07\u6735\u6012\u653e\u7684\u8537\u8587 Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 \u6587\u7ae0\u76ee\u5f55Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u74061. Ext2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8f<\/p>\n","protected":false},"author":2,"featured_media":115289,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11820,58,43,44],"topic":[],"class_list":["post-115302","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-atomgit","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115302.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230 huangjin007_ \u7684\u535a\u5ba2 \u2b50 \u4e2a\u4eba\u4e3b\u9875&#xff1a;huangjin007_ &#x1f525; \u6587\u7ae0\u6536\u5f55\u4e13\u680f&#xff1a;Linux \u5185\u529f\u4fee\u70bc\u624b\u518c(\u7cfb\u7edf\u7bc7) \u603b\u4f1a\u6709\u4e00\u4e9b\u575a\u6301\u80fd\u4ece\u51b0\u5c01\u7684\u571f\u5730\u91cc\u57f9\u80b2\u51fa\u5341\u4e07\u6735\u6012\u653e\u7684\u8537\u8587 Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 \u6587\u7ae0\u76ee\u5f55Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u74061. Ext2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8f\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115302.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-11T12:25:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122531-6acb803b29d5e.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115302.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115302.html\",\"name\":\"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-11T12:25:36+00:00\",\"dateModified\":\"2026-10-11T12:25:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115302.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115302.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115302.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115302.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5927\u5bb6\u597d&#xff0c;\u6b22\u8fce\u6765\u5230 huangjin007_ \u7684\u535a\u5ba2 \u2b50 \u4e2a\u4eba\u4e3b\u9875&#xff1a;huangjin007_ &#x1f525; \u6587\u7ae0\u6536\u5f55\u4e13\u680f&#xff1a;Linux \u5185\u529f\u4fee\u70bc\u624b\u518c(\u7cfb\u7edf\u7bc7) \u603b\u4f1a\u6709\u4e00\u4e9b\u575a\u6301\u80fd\u4ece\u51b0\u5c01\u7684\u571f\u5730\u91cc\u57f9\u80b2\u51fa\u5341\u4e07\u6735\u6012\u653e\u7684\u8537\u8587 Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 \u6587\u7ae0\u76ee\u5f55Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b) \u2014\u2014 Ext2\u5757\u7ec4\u7ed3\u6784&#xff0c;inode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u74061. Ext2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8f","og_url":"https:\/\/www.wsisp.com\/helps\/115302.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-11T12:25:36+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011122531-6acb803b29d5e.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115302.html","url":"https:\/\/www.wsisp.com\/helps\/115302.html","name":"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-11T12:25:36+00:00","dateModified":"2026-10-11T12:25:36+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115302.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115302.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115302.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010Linux \u7cfb\u7edf\u7bc7(\u4e8c\u5341\u516b)\u3011\u6587\u4ef6(\u4e94)\uff1aExt \u7cfb\u5217\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0b\uff09\uff1aExt2\u5757\u7ec4\u7ed3\u6784\uff0cinode\u4e0e\u6587\u4ef6\u5bfb\u5740\u539f\u7406"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115302"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115302\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/115289"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115302"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}