inode\u7684\u5927\u5c0f<\/strong><\/div>\ninode\u4e5f\u4f1a\u6d88\u8017\u786c\u76d8\u7a7a\u95f4\uff0c\u6240\u4ee5\u786c\u76d8\u683c\u5f0f\u5316\u7684\u65f6\u5019\uff0c\u64cd\u4f5c\u7cfb\u7edf\u81ea\u52a8\u5c06\u786c\u76d8\u5206\u6210\u4e24\u4e2a\u533a\u57df\u3002\u4e00\u4e2a\u662f\u6570\u636e\u533a\uff0c\u5b58\u653e\u6587\u4ef6\u6570\u636e\uff1b\u53e6\u4e00\u4e2a\u662finode\u533a\uff08inode table\uff09\uff0c\u5b58\u653einode\u6240\u5305\u542b\u7684\u4fe1\u606f\u3002<\/p>\n
\u6bcf \u4e2ainode\u8282\u70b9\u7684\u5927\u5c0f\uff0c\u4e00\u822c\u662f128\u5b57\u8282\u6216256\u5b57\u8282\u3002inode\u8282\u70b9\u7684\u603b\u6570\uff0c\u5728\u683c\u5f0f\u5316\u65f6\u5c31\u7ed9\u5b9a\uff0c\u4e00\u822c\u662f\u6bcf1KB\u6216\u6bcf2KB\u5c31\u8bbe\u7f6e\u4e00\u4e2ainode\u3002\u5047\u5b9a \u5728\u4e00\u57571GB\u7684\u786c\u76d8\u4e2d\uff0c\u6bcf\u4e2ainode\u8282\u70b9\u7684\u5927\u5c0f\u4e3a128\u5b57\u8282\uff0c\u6bcf1KB\u5c31\u8bbe\u7f6e\u4e00\u4e2ainode\uff0c\u90a3\u4e48inode table\u7684\u5927\u5c0f\u5c31\u4f1a\u8fbe\u5230128MB\uff0c\u5360\u6574\u5757\u786c\u76d8\u768412.8%\u3002<\/p>\n
\u67e5\u770b\u6bcf\u4e2a\u786c\u76d8\u5206\u533a\u7684inode\u603b\u6570\u548c\u5df2\u7ecf\u4f7f\u7528\u7684\u6570\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528df\u547d\u4ee4\u3002<\/p>\n
df -i<\/pre>\n\u67e5\u770b\u6bcf\u4e2ainode\u8282\u70b9\u7684\u5927\u5c0f\uff0c\u53ef\u4ee5\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n
sudo dumpe2fs -h \/dev\/hda | grep \"Inode size\"<\/pre>\n\u7531\u4e8e\u6bcf\u4e2a\u6587\u4ef6\u90fd\u5fc5\u987b\u6709\u4e00\u4e2ainode\uff0c\u56e0\u6b64\u6709\u53ef\u80fd\u53d1\u751finode\u5df2\u7ecf\u7528\u5149\uff0c\u4f46\u662f\u786c\u76d8\u8fd8\u672a\u5b58\u6ee1\u7684\u60c5\u51b5\u3002\u8fd9\u65f6\uff0c\u5c31\u65e0\u6cd5\u5728\u786c\u76d8\u4e0a\u521b\u5efa\u65b0\u6587\u4ef6\u3002<\/p>\n
inode\u53f7\u7801<\/strong><\/div>\n<\/p>\n
\u6bcf\u4e2ainode\u90fd\u6709\u4e00\u4e2a\u53f7\u7801\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7528inode\u53f7\u7801\u6765\u8bc6\u522b\u4e0d\u540c\u7684\u6587\u4ef6\u3002<\/p>\n
\u8fd9 \u91cc\u503c\u5f97\u91cd\u590d\u4e00\u904d\uff0cUnix\/Linux\u7cfb\u7edf\u5185\u90e8\u4e0d\u4f7f\u7528\u6587\u4ef6\u540d\uff0c\u800c\u4f7f\u7528inode\u53f7\u7801\u6765\u8bc6\u522b\u6587\u4ef6\u3002\u5bf9\u4e8e\u7cfb\u7edf\u6765\u8bf4\uff0c\u6587\u4ef6\u540d\u53ea\u662finode\u53f7\u7801\u4fbf\u4e8e\u8bc6\u522b\u7684\u522b\u79f0\u6216 \u8005\u7ef0\u53f7\u3002\u8868\u9762\u4e0a\uff0c\u7528\u6237\u901a\u8fc7\u6587\u4ef6\u540d\uff0c\u6253\u5f00\u6587\u4ef6\u3002\u5b9e\u9645\u4e0a\uff0c\u7cfb\u7edf\u5185\u90e8\u8fd9\u4e2a\u8fc7\u7a0b\u5206\u6210\u4e09\u6b65\uff1a\u9996\u5148\uff0c\u7cfb\u7edf\u627e\u5230\u8fd9\u4e2a\u6587\u4ef6\u540d\u5bf9\u5e94\u7684inode\u53f7\u7801\uff1b\u5176\u6b21\uff0c\u901a\u8fc7inode\u53f7 \u7801\uff0c\u83b7\u53d6inode\u4fe1\u606f\uff1b\u6700\u540e\uff0c\u6839\u636einode\u4fe1\u606f\uff0c\u627e\u5230\u6587\u4ef6\u6570\u636e\u6240\u5728\u7684block\uff0c\u8bfb\u51fa\u6570\u636e\u3002<\/p>\n
\u4f7f\u7528ls -i\u547d\u4ee4\uff0c\u53ef\u4ee5\u770b\u5230\u6587\u4ef6\u540d\u5bf9\u5e94\u7684inode\u53f7\u7801\uff1a<\/p>\n
ls -i example.txt<\/pre>\n\u76ee\u5f55\u6587\u4ef6<\/strong><\/div>\nUnix\/Linux\u7cfb\u7edf\u4e2d\uff0c\u76ee\u5f55\uff08directory\uff09\u4e5f\u662f\u4e00\u79cd\u6587\u4ef6\u3002\u6253\u5f00\u76ee\u5f55\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f\u6253\u5f00\u76ee\u5f55\u6587\u4ef6\u3002<\/p>\n
\u76ee\u5f55\u6587\u4ef6\u7684\u7ed3\u6784\u975e\u5e38\u7b80\u5355\uff0c\u5c31\u662f\u4e00\u7cfb\u5217\u76ee\u5f55\u9879\uff08dirent\uff09\u7684\u5217\u8868\u3002\u6bcf\u4e2a\u76ee\u5f55\u9879\uff0c\u7531\u4e24\u90e8\u5206\u7ec4\u6210\uff1a\u6240\u5305\u542b\u6587\u4ef6\u7684\u6587\u4ef6\u540d\uff0c\u4ee5\u53ca\u8be5\u6587\u4ef6\u540d\u5bf9\u5e94\u7684inode\u53f7\u7801\u3002<\/p>\n
ls\u547d\u4ee4\u53ea\u5217\u51fa\u76ee\u5f55\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u540d\uff1a<\/p>\n
ls \/etc<\/pre>\nls -i\u547d\u4ee4\u5217\u51fa\u6574\u4e2a\u76ee\u5f55\u6587\u4ef6\uff0c\u5373\u6587\u4ef6\u540d\u548cinode\u53f7\u7801\uff1a<\/p>\n
ls -i \/etc<\/pre>\n\u5982\u679c\u8981\u67e5\u770b\u6587\u4ef6\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5c31\u5fc5\u987b\u6839\u636einode\u53f7\u7801\uff0c\u8bbf\u95eeinode\u8282\u70b9\uff0c\u8bfb\u53d6\u4fe1\u606f\u3002ls -l\u547d\u4ee4\u5217\u51fa\u6587\u4ef6\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n
ls -l \/etc<\/pre>\n\u786c\u94fe\u63a5<\/strong><\/div>\n\u4e00 \u822c\u60c5\u51b5\u4e0b\uff0c\u6587\u4ef6\u540d\u548cinode\u53f7\u7801\u662f\"\u4e00\u4e00\u5bf9\u5e94\"\u5173\u7cfb\uff0c\u6bcf\u4e2ainode\u53f7\u7801\u5bf9\u5e94\u4e00\u4e2a\u6587\u4ef6\u540d\u3002\u4f46\u662f\uff0cUnix\/Linux\u7cfb\u7edf\u5141\u8bb8\uff0c\u591a\u4e2a\u6587\u4ef6\u540d\u6307\u5411\u540c\u4e00\u4e2a inode\u53f7\u7801\u3002\u8fd9\u610f\u5473\u7740\uff0c\u53ef\u4ee5\u7528\u4e0d\u540c\u7684\u6587\u4ef6\u540d\u8bbf\u95ee\u540c\u6837\u7684\u5185\u5bb9\uff1b\u5bf9\u6587\u4ef6\u5185\u5bb9\u8fdb\u884c\u4fee\u6539\uff0c\u4f1a\u5f71\u54cd\u5230\u6240\u6709\u6587\u4ef6\u540d\uff1b\u4f46\u662f\uff0c\u5220\u9664\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4e0d\u5f71\u54cd\u53e6\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u8bbf \u95ee\u3002\u8fd9\u79cd\u60c5\u51b5\u5c31\u88ab\u79f0\u4e3a\"\u786c\u94fe\u63a5\"\uff08hard link\uff09\u3002<\/p>\n
ln\u547d\u4ee4\u53ef\u4ee5\u521b\u5efa\u786c\u94fe\u63a5\uff1a<\/p>\n
ln \u6e90\u6587\u4ef6 \u76ee\u6807\u6587\u4ef6<\/pre>\n\u8fd0 \u884c\u4e0a\u9762\u8fd9\u6761\u547d\u4ee4\u4ee5\u540e\uff0c\u6e90\u6587\u4ef6\u4e0e\u76ee\u6807\u6587\u4ef6\u7684inode\u53f7\u7801\u76f8\u540c\uff0c\u90fd\u6307\u5411\u540c\u4e00\u4e2ainode\u3002inode\u4fe1\u606f\u4e2d\u6709\u4e00\u9879\u53eb\u505a\"\u94fe\u63a5\u6570\"\uff0c\u8bb0\u5f55\u6307\u5411\u8be5inode\u7684\u6587 \u4ef6\u540d\u603b\u6570\uff0c\u8fd9\u65f6\u5c31\u4f1a\u589e\u52a01\u3002\u53cd\u8fc7\u6765\uff0c\u5220\u9664\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u5c31\u4f1a\u4f7f\u5f97inode\u8282\u70b9\u4e2d\u7684\"\u94fe\u63a5\u6570\"\u51cf1\u3002\u5f53\u8fd9\u4e2a\u503c\u51cf\u52300\uff0c\u8868\u660e\u6ca1\u6709\u6587\u4ef6\u540d\u6307\u5411\u8fd9\u4e2ainode\uff0c\u7cfb \u7edf\u5c31\u4f1a\u56de\u6536\u8fd9\u4e2ainode\u53f7\u7801\uff0c\u4ee5\u53ca\u5176\u6240\u5bf9\u5e94block\u533a\u57df\u3002<\/p>\n
\u8fd9\u91cc\u987a\u4fbf\u8bf4\u4e00\u4e0b\u76ee\u5f55\u6587\u4ef6\u7684\"\u94fe\u63a5\u6570\"\u3002\u521b\u5efa\u76ee\u5f55\u65f6\uff0c \u9ed8\u8ba4\u4f1a\u751f\u6210\u4e24\u4e2a\u76ee\u5f55\u9879\uff1a\".\"\u548c\"..\"\u3002\u524d\u8005\u7684inode\u53f7\u7801\u5c31\u662f\u5f53\u524d\u76ee\u5f55\u7684inode\u53f7\u7801\uff0c\u7b49\u540c\u4e8e\u5f53\u524d\u76ee\u5f55\u7684\"\u786c\u94fe\u63a5\"\uff1b\u540e\u8005\u7684inode\u53f7\u7801\u5c31\u662f\u5f53 \u524d\u76ee\u5f55\u7684\u7236\u76ee\u5f55\u7684inode\u53f7\u7801\uff0c\u7b49\u540c\u4e8e\u7236\u76ee\u5f55\u7684\"\u786c\u94fe\u63a5\"\u3002\u6240\u4ee5\uff0c\u4efb\u4f55\u4e00\u4e2a\u76ee\u5f55\u7684\"\u786c\u94fe\u63a5\"\u603b\u6570\uff0c\u603b\u662f\u7b49\u4e8e2\u52a0\u4e0a\u5b83\u7684\u5b50\u76ee\u5f55\u603b\u6570\uff08\u542b\u9690\u85cf\u76ee\u5f55\uff09,\u8fd9\u91cc\u7684 2\u662f\u7236\u76ee\u5f55\u5bf9\u5176\u7684\u201c\u786c\u94fe\u63a5\u201d\u548c\u5f53\u524d\u76ee\u5f55\u4e0b\u7684\".\u786c\u94fe\u63a5\u201c\u3002<\/p>\n
<\/p>\n
\u8f6f\u94fe\u63a5<\/strong><\/div>\n\u9664\u4e86\u786c\u94fe\u63a5\u4ee5\u5916\uff0c\u8fd8\u6709 \u4e00\u79cd\u7279\u6b8a\u60c5\u51b5\u3002\u6587\u4ef6A\u548c\u6587\u4ef6B\u7684inode\u53f7\u7801\u867d\u7136\u4e0d\u4e00\u6837\uff0c\u4f46\u662f\u6587\u4ef6A\u7684\u5185\u5bb9\u662f\u6587\u4ef6B\u7684\u8def\u5f84\u3002\u8bfb\u53d6\u6587\u4ef6A\u65f6\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u5c06\u8bbf\u95ee\u8005\u5bfc\u5411\u6587\u4ef6B\u3002\u56e0\u6b64\uff0c\u65e0\u8bba\u6253 \u5f00\u54ea\u4e00\u4e2a\u6587\u4ef6\uff0c\u6700\u7ec8\u8bfb\u53d6\u7684\u90fd\u662f\u6587\u4ef6B\u3002\u8fd9\u65f6\uff0c\u6587\u4ef6A\u5c31\u79f0\u4e3a\u6587\u4ef6B\u7684\"\u8f6f\u94fe\u63a5\"\uff08soft link\uff09\u6216\u8005\"\u7b26\u53f7\u94fe\u63a5\uff08symbolic link\uff09\u3002<\/p>\n
\u8fd9 \u610f\u5473\u7740\uff0c\u6587\u4ef6A\u4f9d\u8d56\u4e8e\u6587\u4ef6B\u800c\u5b58\u5728\uff0c\u5982\u679c\u5220\u9664\u4e86\u6587\u4ef6B\uff0c\u6253\u5f00\u6587\u4ef6A\u5c31\u4f1a\u62a5\u9519\uff1a\"No such file or directory\"\u3002\u8fd9\u662f\u8f6f\u94fe\u63a5\u4e0e\u786c\u94fe\u63a5\u6700\u5927\u7684\u4e0d\u540c\uff1a\u6587\u4ef6A\u6307\u5411\u6587\u4ef6B\u7684\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u6587\u4ef6B\u7684inode\u53f7\u7801\uff0c\u6587\u4ef6B\u7684inode\"\u94fe\u63a5\u6570\"\u4e0d\u4f1a\u56e0\u6b64 \u53d1\u751f\u53d8\u5316\u3002<\/p>\n
ln -s\u547d\u4ee4\u53ef\u4ee5\u521b\u5efa\u8f6f\u94fe\u63a5\u3002<\/p>\n
ln -s \u6e90\u6587\u6587\u4ef6\u6216\u76ee\u5f55 \u76ee\u6807\u6587\u4ef6\u6216\u76ee\u5f55<\/p>\n
inode\u7684\u7279\u6b8a\u4f5c\u7528<\/strong><\/div>\n\u7531\u4e8einode\u53f7\u7801\u4e0e\u6587\u4ef6\u540d\u5206\u79bb\uff0c\u8fd9\u79cd\u673a\u5236\u5bfc\u81f4\u4e86\u4e00\u4e9bUnix\/Linux\u7cfb\u7edf\u7279\u6709\u7684\u73b0\u8c61\u3002<\/p>\n
1. \u6709\u65f6\uff0c\u6587\u4ef6\u540d\u5305\u542b\u7279\u6b8a\u5b57\u7b26\uff0c\u65e0\u6cd5\u6b63\u5e38\u5220\u9664\u3002\u8fd9\u65f6\uff0c\u76f4\u63a5\u5220\u9664inode\u8282\u70b9\uff0c\u5c31\u80fd\u8d77\u5230\u5220\u9664\u6587\u4ef6\u7684\u4f5c\u7528\u3002<\/p>\n
2. \u79fb\u52a8\u6587\u4ef6\u6216\u91cd\u547d\u540d\u6587\u4ef6\uff0c\u53ea\u662f\u6539\u53d8\u6587\u4ef6\u540d\uff0c\u4e0d\u5f71\u54cdinode\u53f7\u7801\u3002<\/p>\n
3. \u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\u4ee5\u540e\uff0c\u7cfb\u7edf\u5c31\u4ee5inode\u53f7\u7801\u6765\u8bc6\u522b\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4e0d\u518d\u8003\u8651\u6587\u4ef6\u540d\u3002\u56e0\u6b64\uff0c\u901a\u5e38\u6765\u8bf4\uff0c\u7cfb\u7edf\u65e0\u6cd5\u4eceinode\u53f7\u7801\u5f97\u77e5\u6587\u4ef6\u540d\u3002<\/p>\n
\u7b2c3\u70b9\u4f7f\u5f97\u8f6f\u4ef6\u66f4\u65b0\u53d8\u5f97\u7b80\u5355\uff0c\u53ef\u4ee5\u5728\u4e0d\u5173\u95ed\u8f6f\u4ef6\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u66f4\u65b0\uff0c\u4e0d\u9700\u8981\u91cd\u542f\u3002\u56e0\u4e3a\u7cfb\u7edf\u901a\u8fc7inode\u53f7\u7801\uff0c\u8bc6\u522b\u8fd0\u884c\u4e2d\u7684\u6587\u4ef6\uff0c\u4e0d\u901a\u8fc7\u6587\u4ef6\u540d\u3002\u66f4\u65b0\u7684\u65f6 \u5019\uff0c\u65b0\u7248\u6587\u4ef6\u4ee5\u540c\u6837\u7684\u6587\u4ef6\u540d\uff0c\u751f\u6210\u4e00\u4e2a\u65b0\u7684inode\uff0c\u4e0d\u4f1a\u5f71\u54cd\u5230\u8fd0\u884c\u4e2d\u7684\u6587\u4ef6\u3002\u7b49\u5230\u4e0b\u4e00\u6b21\u8fd0\u884c\u8fd9\u4e2a\u8f6f\u4ef6\u7684\u65f6\u5019\uff0c\u6587\u4ef6\u540d\u5c31\u81ea\u52a8\u6307\u5411\u65b0\u7248\u6587\u4ef6\uff0c\u65e7\u7248\u6587\u4ef6\u7684 inode\u5219\u88ab\u56de\u6536\u3002<\/p>\n