{"id":63708,"date":"2025-04-29T10:48:46","date_gmt":"2025-04-29T02:48:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63708\/"},"modified":"2025-04-29T10:48:46","modified_gmt":"2025-04-29T02:48:46","slug":"linux%e6%80%8e%e4%b9%88%e7%9c%8bnfs%e9%85%8d%e7%bd%ae-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63708\/","title":{"rendered":"linux\u600e\u4e48\u770bnfs\u914d\u7f6e"},"content":{"rendered":"<blockquote><p>\n  \u5728 linux \u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b nfs \u914d\u7f6e\u7684\u65b9\u6cd5\uff1a\u67e5\u770b \/etc\/exports \u6587\u4ef6\uff0c\u4e86\u89e3\u5bfc\u51fa\u76ee\u5f55\uff1b\u67e5\u770b \/proc\/mounts \u6587\u4ef6\uff0c\u83b7\u53d6\u5df2\u6302\u8f7d nfs \u5171\u4eab\uff1b\u4f7f\u7528 exportfs \u547d\u4ee4\uff0c\u7ba1\u7406\u5e76\u67e5\u770b\u5171\u4eab\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/04\/2024060413181948571.jpg\" class=\"aligncenter\" title=\"linux\u600e\u4e48\u770bnfs\u914d\u7f6e\u63d2\u56fe\" alt=\"linux\u600e\u4e48\u770bnfs\u914d\u7f6e\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b Linux \u7cfb\u7edf\u4e2d\u7684 NFS \u914d\u7f6e<\/strong><\/p>\n<p>NFS\uff08\u7f51\u7edc\u6587\u4ef6\u7cfb\u7edf\uff09\u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\uff0c\u5141\u8bb8\u5ba2\u6237\u7aef\u8ba1\u7b97\u673a\u8bbf\u95ee\u548c\u4f7f\u7528\u5b58\u50a8\u5728\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u7684\u6587\u4ef6\u3002\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u6709\u51e0\u79cd\u65b9\u6cd5\u53ef\u4ee5\u67e5\u770b NFS \u914d\u7f6e\uff1a<\/p>\n<p><strong>1. \u67e5\u770b \/etc\/exports \u6587\u4ef6<\/strong><\/p>\n<p>\/etc\/exports \u6587\u4ef6\u6307\u5b9a\u4e86\u54ea\u4e9b\u76ee\u5f55\u88ab\u5bfc\u51fa\u4e3a NFS \u5171\u4eab\u3002\u8981\u67e5\u770b\u6b64\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>sudo cat \/etc\/exports<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b\u8f93\u51fa\uff1a<\/strong><\/p>\n<pre>\/data *(rw,sync,no_root_squash)\n\/home\/user *(ro,async)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u67e5\u770b \/proc\/mounts \u6587\u4ef6<\/strong><\/p>\n<p>\/proc\/mounts \u6587\u4ef6\u663e\u793a\u4e86\u5f53\u524d\u6302\u8f7d\u7684\u6587\u4ef6\u7cfb\u7edf\u5217\u8868\uff0c\u5305\u62ec NFS \u5171\u4eab\u3002\u8981\u67e5\u770b\u6b64\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>sudo cat \/proc\/mounts<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b\u8f93\u51fa\uff1a<\/strong><\/p>\n<pre>nfsd on \/nfsmount type nfs (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=2049,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.100,local_lock=none,addr=192.168.1.10)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u4f7f\u7528 exportfs \u547d\u4ee4<\/strong><\/p>\n<p>exportfs \u547d\u4ee4\u53ef\u7528\u4e8e\u7ba1\u7406 NFS \u5171\u4eab\u3002\u8981\u4f7f\u7528\u6b64\u547d\u4ee4\u67e5\u770b\u5171\u4eab\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<\/p>\n<pre>sudo exportfs -a<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b\u8f93\u51fa\uff1a<\/strong><\/p>\n<pre>\/data -&gt; 192.168.1.100\n\/home\/user -&gt; 192.168.1.200<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u770bnfs\u914d\u7f6e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 linux \u7cfb\u7edf\u4e2d\uff0c\u67e5\u770b nfs \u914d\u7f6e\u7684\u65b9\u6cd5\uff1a\u67e5\u770b \/etc\/exports \u6587\u4ef6\uff0c\u4e86\u89e3\u5bfc\u51fa\u76ee\u5f55\uff1b\u67e5\u770b \/proc\/mounts \u6587\u4ef6\uff0c\u83b7\u53d6\u5df2\u6302\u8f7d nfs \u5171\u4eab\uff1b\u4f7f\u7528 exportfs \u547d\u4ee4\uff0c\u7ba1\u7406\u5e76\u67e5\u770b\u5171\u4eab\u3002 \u5982\u4f55\u67e5\u770b Linux \u7cfb\u7edf\u4e2d\u7684 NFS \u914d\u7f6e NFS\uff08\u7f51\u7edc\u6587\u4ef6\u7cfb\u7edf\uff09\u662f\u4e00\u79cd\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\uff0c\u5141\u8bb8\u5ba2\u6237\u7aef\u8ba1\u7b97\u673a\u8bbf\u95ee\u548c\u4f7f\u7528\u5b58\u50a8\u5728\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u7684\u6587\u4ef6\u3002\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u6709\u51e0\u79cd\u65b9\u6cd5\u53ef\u4ee5\u67e5\u770b NFS \u914d\u7f6e\uff1a 1. \u67e5\u770b \/etc\/exports \u6587\u4ef6 \/etc\/exports \u6587\u4ef6\u6307\u5b9a\u4e86\u54ea\u4e9b\u76ee\u5f55\u88ab\u5bfc\u51fa\u4e3a NFS \u5171\u4eab\u3002\u8981\u67e5\u770b\u6b64\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a sudo cat \/etc\/exports \u767b\u5f55\u540e\u590d\u5236 \u793a\u4f8b\u8f93\u51fa\uff1a \/data *(rw,sync,no_root_squash) \/home\/user *(ro,async) \u767b\u5f55\u540e\u590d\u5236 2. \u67e5\u770b \/proc\/mounts \u6587\u4ef6 \/proc\/mounts \u6587\u4ef6\u663e\u793a\u4e86\u5f53\u524d\u6302\u8f7d\u7684\u6587\u4ef6\u7cfb\u7edf\u5217\u8868\uff0c\u5305\u62ec NFS \u5171\u4eab\u3002\u8981\u67e5\u770b\u6b64\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a sudo cat \/proc\/mounts \u767b\u5f55\u540e\u590d\u5236 \u793a\u4f8b\u8f93\u51fa\uff1a nfsd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63708","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63708"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63708\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}