{"id":20266,"date":"2025-04-19T03:01:16","date_gmt":"2025-04-18T19:01:16","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/20266.html"},"modified":"2025-04-19T03:01:16","modified_gmt":"2025-04-18T19:01:16","slug":"linux-nfs%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/20266.html","title":{"rendered":"Linux - nfs\u670d\u52a1\u5668"},"content":{"rendered":"<h2>\u4e94\u3001nfs\u670d\u52a1\u5668<\/h2>\n<h3>1\u3001\u57fa\u7840<\/h3>\n<p>NFS\u670d\u52a1\u5668\u53ef\u4ee5\u8ba9PC\u5c06\u7f51\u7edc\u4e2d\u7684NFS\u670d\u52a1\u5668\u5171\u4eab\u7684\u76ee\u5f55\u6302\u8f7d\u5230\u672c\u5730\u7aef\u7684\u6587\u4ef6\u7cfb\u7edf\u4e2d&#xff0c;\u800c\u5728\u672c\u5730\u7aef\u7684\u7cfb\u7edf \u4e2d\u770b\u6765&#xff0c;\u90a3\u4e2a\u8fdc\u7a0b\u4e3b\u673a\u7684\u76ee\u5f55\u5c31\u597d\u50cf\u662f\u81ea\u5df1\u7684\u4e00\u4e2a\u78c1\u76d8\u5206\u533a\u4e00\u6837\u3002<\/p>\n<p>\u7531\u4e8eNFS\u652f\u6301\u7684\u529f\u80fd\u6bd4\u8f83\u591a&#xff0c;\u800c\u4e0d\u540c\u7684\u529f\u80fd\u90fd\u4f1a\u4f7f\u7528\u4e0d\u540c\u7684\u7a0b\u5e8f\u6765\u542f\u52a8&#xff0c;\u6bcf\u542f\u52a8\u4e00\u4e2a\u529f\u80fd\u5c31\u4f1a\u542f\u7528\u4e00\u4e9b \u7aef\u53e3\u6765\u4f20\u8f93\u6570\u636e&#xff0c;\u56e0\u6b64NFS\u7684\u529f\u80fd\u6240\u5bf9\u5e94\u7684\u7aef\u53e3\u5e76\u4e0d\u56fa\u5b9a&#xff0c;\u800c\u662f\u968f\u673a\u53d6\u7528\u4e00\u4e9b\u672a\u88ab\u4f7f\u7528\u7684\u5c0f\u4e8e1024\u7684\u7aef\u53e3\u7528\u4e8e\u4f20\u8f93\u3002\u4f46\u5982\u6b64\u4e00\u6765\u5c31\u4f1a\u4ea7\u751f\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u5668\u7684\u95ee\u9898&#xff0c;\u56e0\u4e3a\u5ba2\u6237\u7aef\u9700\u8981\u77e5\u9053\u670d\u52a1\u5668\u7aef\u7684\u76f8\u5173\u7aef\u53e3 \u624d\u80fd\u591f\u8fde\u63a5\u3002 \u6b64\u65f6\u5c31\u9700\u8981RPC&#xff08;Remote Procedure Call&#xff0c;\u8fdc\u7a0b\u8fc7\u7a0b\u8c03\u7528&#xff09;\u7684\u670d\u52a1\u3002\u7531\u4e8e\u5f53\u670d\u52a1\u5668\u5728\u542f\u52a8NFS\u65f6\u4f1a\u968f\u673a \u9009\u53d6\u6570\u4e2a\u7aef\u53e3\u53f7&#xff0c;\u5e76\u4e3b\u52a8\u5411RPC\u6ce8\u518c&#xff0c;\u6240\u4ee5RPC\u77e5\u9053\u6bcf\u4e2aNFS\u529f\u80fd\u6240\u5bf9\u5e94\u7684\u7aef\u53e3\u53f7&#xff0c;RPC\u5c06\u7aef\u53e3\u53f7\u901a\u77e5\u7ed9 \u5ba2\u6237\u7aef&#xff0c;\u8ba9\u5ba2\u6237\u7aef\u53ef\u4ee5\u8fde\u63a5\u5230\u6b63\u786e\u7684\u7aef\u53e3\u4e0a\u53bb\u3002RPC\u91c7\u7528\u56fa\u5b9a\u7aef\u53e3\u53f7port 111\u6765\u76d1\u542c\u5ba2\u6237\u7aef\u7684\u9700\u6c42\u5e76\u5411 \u5ba2\u6237\u7aef\u54cd\u5e94\u6b63\u786e\u7684\u7aef\u53e3\u53f7\u3002 \u6ce8&#xff1a;\u5728\u542f\u52a8NFS\u4e4b\u524d&#xff0c;\u8981\u5148\u542f\u52a8RPC&#xff0c;\u5426\u5219NFS\u4f1a\u65e0\u6cd5\u5411RPC\u6ce8\u518c\u3002\u53e6\u5916&#xff0c;RPC\u82e5\u91cd\u65b0\u542f\u52a8&#xff0c;\u539f\u6765\u6ce8\u518c\u7684 \u6570\u636e\u4f1a\u6d88\u5931\u4e0d\u89c1&#xff0c;\u56e0\u6b64RPC\u91cd\u542f\u540e&#xff0c;\u5b83\u7ba1\u7406\u7684\u6240\u6709\u670d\u52a1\u90fd\u9700\u8981\u91cd\u65b0\u542f\u52a8\u4ee5\u91cd\u65b0\u5411RPC\u6ce8\u518c\u3002<\/p>\n<p>\u5b89\u88c5<\/p>\n<p><span class=\"token comment\">#nfs<\/span><br \/>\nyum <span class=\"token function\">install<\/span> nfs-utils<br \/>\n<span class=\"token comment\">#rpc<\/span><br \/>\nyum <span class=\"token function\">install<\/span> rpcbind<\/p>\n<h3>2\u3001\u7b80\u5355\u914d\u7f6e<\/h3>\n<p>\u521b\u5efa\u5171\u4eab\u6587\u4ef6<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;server ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir \/share -v<\/span><br \/>\nmkdir: \u5df2\u521b\u5efa\u76ee\u5f55 <span class=\"token string\">&#039;\/share&#039;<\/span><\/p>\n<p>\u5f00\u542f\u76ee\u5f55\u5171\u4eab&#xff08;\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6&#xff09;<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;server ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># vim \/etc\/exports<\/span><br \/>\n<span class=\"token comment\">#\u7f16\u8f91\u6587\u4ef6\u5185\u5bb9<\/span><br \/>\n\/share\u5171\u4eab\u6587\u4ef6\u76ee\u5f55          <span class=\"token number\">192.168<\/span>.5.0\/24<span class=\"token punctuation\">(<\/span>rw<span class=\"token punctuation\">)<\/span>\u5171\u4eab\u7684\u4e3b\u673a&#xff08;\u7f51\u6bb5&#xff0c;\u53ef\u4ee5\u4f7f\u7528*\u4ee3\u8868\u6240\u6709&#xff09;\u4ee5\u53ca\u5171\u4eab\u6743\u9650<br \/>\n<span class=\"token comment\">#\u6743\u9650\u53c2\u6570\u53ef\u4ee5\u5199\u591a\u4e2a&#xff0c;\u4f7f\u7528\u9017\u53f7\u9694\u5f00<\/span><\/p>\n<p>\u76f8\u5173\u6743\u9650\u53c2\u6570<\/p>\n<table>\n<tr>\u53c2\u6570\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">rw&#xff0c;ro<\/td>\n<td>\u8be5\u76ee\u5f55\u5171\u4eab\u7684\u6743\u9650\u662f\u53ef\u8bfb\u5199\u8fd8\u662f\u53ea\u8bfb&#xff0c;\u4f46\u6700\u7ec8\u80fd\u5426\u8bfb\u5199&#xff0c;\u8fd8\u662f\u4e0e \u6587\u4ef6\u7cfb\u7edf\u7684 rwx\u6709\u5173<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">sync&#xff0c;async<\/td>\n<td>sync\u4ee3\u8868\u6570\u636e\u4f1a\u540c\u6b65\u5199\u5165\u5230\u5185\u5b58\u4e0e\u786c\u76d8\u4e2d&#xff0c;async\u5219\u4ee3\u8868\u6570\u636e\u4f1a\u5148\u6682\u5b58\u4e8e\u5185\u5b58 \u5f53\u4e2d&#xff0c;\u800c\u975e\u76f4\u63a5\u5199\u5165\u786c\u76d8<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">no_root_squash root_squash<\/td>\n<td>\u82e5\u5ba2\u6237\u7aef\u5728\u5171\u4eab\u76ee\u5f55\u91cc\u521b\u5efa\u7684\u6587\u4ef6\u7684\u6240\u5c5e\u8005\u548c\u6240\u5c5e\u7ec4\u662froot\u7528\u6237 \u548croot\u7ec4&#xff0c; \u90a3\u4e48\u663e\u793a\u6587\u4ef6\u7684\u5c5e\u4e3b\u548c\u5c5e\u7ec4\u65f6\u6709\u4ee5\u4e0b\u4e24\u79cd\u60c5\u51b5&#xff1a; no_root_squash\u8868\u793a&#xff0c;\u6587\u4ef6 \u7684\u6240\u5c5e\u8005\u548c\u6240\u5c5e\u7ec4\u662froot\u7528\u6237\u548c root\u7ec4&#xff1b;root_squash\u8868\u793a\u5c06root\u7528\u6237\u548c\u7ec4 \u6620\u5c04\u4e3a\u533f\u540d\u7528\u6237\u548c\u7ec4 &#xff08;\u9ed8\u8ba4\u8bbe\u7f6e&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">all_squash no_all_squash<\/td>\n<td>all_squash\u8868\u793a\u5ba2\u6237\u7aef\u6240\u6709\u7528\u6237\u521b\u5efa\u6587\u4ef6\u65f6&#xff0c;\u5ba2\u6237\u7aef\u4f1a\u5c06\u6587\u4ef6\u7684\u7528\u6237 \u548c\u7ec4\u6620\u5c04\u4e3a \u533f\u540d\u7528\u6237\u548c\u7ec4,\u800cno_all_squash\u8868\u793a\u5ba2\u6237\u7aef\u666e\u901a\u7528\u6237\u521b\u5efa\u7684 \u6587\u4ef6\u7684UID\u548cGID\u662f\u591a \u5c11&#xff0c;\u670d\u52a1\u7aef\u5c31\u663e\u793a\u4e3a\u591a\u5c11&#xff08;\u9ed8\u8ba4\u8bbe\u7f6e&#xff09;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">anonuid&#061; anongid&#061;<\/td>\n<td>\u5c06\u6587\u4ef6\u7684\u7528\u6237\u548c\u7ec4\u6620\u5c04\u4e3a\u6307\u5b9a\u7684UID\u548cGID&#xff0c;\u82e5\u4e0d\u6307\u5b9a\u9ed8\u8ba4\u4e3a 65534&#xff08;nfsnobody&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5ba2\u6237\u7aef\u6302\u8f7d<\/p>\n<p><span class=\"token comment\">#\u67e5\u770b\u53ef\u6302\u8f7d\u7684\u4e3b\u673a\u53ca\u5176\u76ee\u5f55<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># showmount -e 192.168.5.100<\/span><br \/>\nExport list <span class=\"token keyword\">for<\/span> <span class=\"token number\">192.168<\/span>.5.100:<br \/>\n\/share <span class=\"token number\">192.168<\/span>.5.0<br \/>\n<span class=\"token comment\">#\u521b\u5efa\u6587\u4ef6\u5e76\u6302\u8f7d<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mount 192.168.5.100:\/share \/nfs<\/span><\/p>\n<p>\u6d4b\u8bd5<\/p>\n<p><span class=\"token comment\">#\u5728\u670d\u52a1\u7aef\u521b\u5efa\u76ee\u5f55<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;server ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir \/share\/{1,2,3} -pv<\/span><br \/>\nmkdir: \u5df2\u521b\u5efa\u76ee\u5f55 <span class=\"token string\">&#039;\/share\/1&#039;<\/span><br \/>\nmkdir: \u5df2\u521b\u5efa\u76ee\u5f55 <span class=\"token string\">&#039;\/share\/2&#039;<\/span><br \/>\nmkdir: \u5df2\u521b\u5efa\u76ee\u5f55 <span class=\"token string\">&#039;\/share\/3&#039;<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;server ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tree \/share<\/span><br \/>\n\/share<br \/>\n\u251c\u2500\u2500 <span class=\"token number\">1<\/span><br \/>\n\u2502   \u2514\u2500\u2500 <span class=\"token builtin class-name\">test<\/span><br \/>\n\u251c\u2500\u2500 <span class=\"token number\">2<\/span><br \/>\n\u2514\u2500\u2500 <span class=\"token number\">3<\/span><\/p>\n<p><span class=\"token number\">3<\/span> directories, <span class=\"token number\">1<\/span> <span class=\"token function\">file<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;server ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># echo hello &gt; \/share\/1\/test<\/span><br \/>\n<span class=\"token comment\">#\u5ba2\u6237\u7aef\u67e5\u770b<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tree \/nfs<\/span><br \/>\n\/nfs<br \/>\n\u251c\u2500\u2500 <span class=\"token number\">1<\/span><br \/>\n\u2502   \u2514\u2500\u2500 <span class=\"token builtin class-name\">test<\/span><br \/>\n\u251c\u2500\u2500 <span class=\"token number\">2<\/span><br \/>\n\u2514\u2500\u2500 <span class=\"token number\">3<\/span><\/p>\n<p><span class=\"token number\">3<\/span> directories, <span class=\"token number\">1<\/span> <span class=\"token function\">file<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cat \/nfs\/1\/test <\/span><br \/>\nhello<br \/>\n<span class=\"token comment\">#\u67e5\u770b\u6302\u8f7d\u60c5\u51b5<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># df -h<\/span><br \/>\n\u6587\u4ef6\u7cfb\u7edf               \u5bb9\u91cf  \u5df2\u7528  \u53ef\u7528 \u5df2\u7528% \u6302\u8f7d\u70b9<br \/>\ndevtmpfs               <span class=\"token number\">4<\/span>.0M     <span class=\"token number\">0<\/span>  <span class=\"token number\">4<\/span>.0M    <span class=\"token number\">0<\/span>% \/dev<br \/>\ntmpfs                  866M     <span class=\"token number\">0<\/span>  866M    <span class=\"token number\">0<\/span>% \/dev\/shm<br \/>\ntmpfs                  347M  <span class=\"token number\">7<\/span>.0M  340M    <span class=\"token number\">3<\/span>% \/run<br \/>\n\/dev\/mapper\/rhel-root   17G  <span class=\"token number\">4<\/span>.3G   13G   <span class=\"token number\">27<\/span>% \/<br \/>\n\/dev\/nvme0n1p2         960M  292M  669M   <span class=\"token number\">31<\/span>% \/boot<br \/>\n\/dev\/nvme0n1p1         599M  <span class=\"token number\">7<\/span>.0M  592M    <span class=\"token number\">2<\/span>% \/boot\/efi<br \/>\ntmpfs                  174M   52K  174M    <span class=\"token number\">1<\/span>% \/run\/user\/42<br \/>\ntmpfs                  174M   36K  174M    <span class=\"token number\">1<\/span>% \/run\/user\/0<br \/>\n<span class=\"token number\">192.168<\/span>.5.100:\/share    17G  <span class=\"token number\">4<\/span>.4G   12G   <span class=\"token number\">27<\/span>% \/nfs<span class=\"token comment\">#\u6302\u8f7d\u7684\u670d\u52a1\u5668\u76ee\u5f55<\/span><br \/>\n<span class=\"token comment\">#\u82e5\u5ba2\u6237\u7aef\u5728\u5177\u5907\u8be5\u76ee\u5f55\u7684\u5199\u6743\u9650\u540e&#xff0c;\u5728\u8be5\u76ee\u5f55\u4e0b\u521b\u5efa\u7684\u6587\u4ef6&#xff08;\u5728\u4e0d\u6307\u5b9aanonuid&#061;\u548canongid&#061;\u4e24\u4e2a\u53c2\u6570\u7684\u60c5\u51b5\u4e0b&#xff09;\u7528\u6237\u548c\u7528\u6237\u7ec4\u90fd\u4e3anobody<\/span><br \/>\n<span class=\"token comment\">#\u670d\u52a1\u5668\u7ed9\u6743\u9650<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;server ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># chmod 777 \/share<\/span><br \/>\n<span class=\"token comment\">#\u5ba2\u6237\u7aef\u4fee\u6539\u76ee\u5f55<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># mkdir \/nfs\/{4,5,6} -pv<\/span><br \/>\nmkdir: \u5df2\u521b\u5efa\u76ee\u5f55 <span class=\"token string\">&#039;\/nfs\/4&#039;<\/span><br \/>\nmkdir: \u5df2\u521b\u5efa\u76ee\u5f55 <span class=\"token string\">&#039;\/nfs\/5&#039;<\/span><br \/>\nmkdir: \u5df2\u521b\u5efa\u76ee\u5f55 <span class=\"token string\">&#039;\/nfs\/6&#039;<\/span><br \/>\n<span class=\"token comment\">#\u5728\u5ba2\u6237\u7aef\u770b<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ll \/nfs<\/span><br \/>\n\u603b\u7528\u91cf <span class=\"token number\">0<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> root   root   <span class=\"token number\">18<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">20<\/span>:24 <span class=\"token number\">1<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> root   root    <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">20<\/span>:23 <span class=\"token number\">2<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> root   root    <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">20<\/span>:23 <span class=\"token number\">3<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> nobody nobody  <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">20<\/span>:35 <span class=\"token number\">4<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> nobody nobody  <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">20<\/span>:35 <span class=\"token number\">5<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> nobody nobody  <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">20<\/span>:35 <span class=\"token number\">6<\/span><br \/>\n<span class=\"token comment\">#\u670d\u52a1\u7aef\u770b<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;server ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ll \/share<\/span><br \/>\n\u603b\u7528\u91cf <span class=\"token number\">0<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> root   root   <span class=\"token number\">18<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">12<\/span>:24 <span class=\"token number\">1<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> root   root    <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">12<\/span>:23 <span class=\"token number\">2<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> root   root    <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">12<\/span>:23 <span class=\"token number\">3<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> nobody nobody  <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">12<\/span>:35 <span class=\"token number\">4<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> nobody nobody  <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">12<\/span>:35 <span class=\"token number\">5<\/span><br \/>\ndrwxr-xr-x. <span class=\"token number\">2<\/span> nobody nobody  <span class=\"token number\">6<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">12<\/span>:35 <span class=\"token number\">6<\/span><\/p>\n<h3>3\u3001autofs\u81ea\u52a8\u6302\u8f7d<\/h3>\n<p>\u5728\u4e00\u822cNFS\u6587\u4ef6\u7cfb\u7edf\u7684\u4f7f\u7528\u8fc7\u7a0b\u4e2d&#xff0c;\u5982\u679c\u5ba2\u6237\u7aef\u8981\u4f7f\u7528\u670d\u52a1\u7aef\u6240\u63d0\u4f9b\u7684\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u53ef\u4ee5\u5728 \/etc\/rc.d\/rc.local \u4e2d\u8bbe\u7f6e\u5f00\u673a\u65f6\u81ea\u52a8\u6302\u8f7d&#xff08; \/etc\/rc.d\/rc.local \u6587\u4ef6\u4e2d\u5199\u5165\u7684\u547d\u4ee4&#xff0c;\u5728\u6bcf\u6b21\u542f\u52a8\u7cfb\u7edf\u7528\u6237 \u767b\u5f55\u4e4b\u524d\u90fd\u4f1a\u6267\u884c\u4e00\u6b21&#xff09;\u3002\u4f46\u82e5\u5bf9\u7aef\u5b95\u673a\u6216\u6839\u672c\u6ca1\u6709\u542f\u52a8&#xff0c;\u4f1a\u5bfc\u81f4\u4e3b\u673a\u8d85\u65f6\u7b49\u5f85\u3002\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5f53\u5ba2\u6237\u7aef\u5728\u6709\u4f7f\u7528NFS\u6587\u4ef6\u7cfb\u7edf\u7684\u9700\u6c42\u65f6\u624d\u8ba9\u7cfb\u7edf\u81ea\u52a8\u6302\u8f7d\u3002\u5f53NFS\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u5b8c\u6bd5\u540e&#xff0c;\u8ba9NFS\u81ea\u52a8\u5378\u8f7d\u3002<\/p>\n<p>autofs\u8fd9\u4e2a\u670d\u52a1\u662f\u5728\u5ba2\u6237\u7aef\u7684\u4e0a\u9762&#xff0c;\u5b83\u4f1a\u6301\u7eed\u7684\u68c0\u6d4b\u67d0\u4e2a\u6307\u5b9a\u7684\u76ee\u5f55&#xff0c;\u5e76\u9884\u5148\u8bbe\u7f6e\u5f53\u4f7f\u7528\u5230\u8be5\u76ee\u5f55\u7684\u67d0 \u4e2a\u5b50\u76ee\u5f55\u65f6&#xff0c;\u5c06\u4f1a\u53d6\u5f97\u6765\u81ea\u670d\u52a1\u5668\u7aef\u7684NFS\u6587\u4ef6\u7cfb\u7edf\u8d44\u6e90&#xff0c;\u5e76\u8fdb\u884c\u81ea\u52a8\u6302\u8f7d\u7684\u64cd\u4f5c\u3002<\/p>\n<p>\u5b89\u88c5\u8f6f\u4ef6&#xff08;\u5ba2\u6237\u7aef&#xff09;<\/p>\n<p>yum <span class=\"token function\">install<\/span> autofs <span class=\"token parameter variable\">-y<\/span><\/p>\n<p>\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># vim \/etc\/auto.master\u4e3b\u914d\u7f6e\u6587\u4ef6&#xff0c;\u5b9a\u4e49\u4e86\u6302\u8f7d\u70b9\u548c\u81ea\u52a8\u6302\u8f7d\u7684\u89c4\u5219<\/span><br \/>\n\u6587\u4ef6\u5185\u6dfb\u52a0:<br \/>\n \/nfs\/test         \/etc\/auto.suibian<br \/>\n <span class=\"token comment\">#\u672c\u5730\u7aef\u76ee\u5f55    \u5177\u4f53\u6302\u8f7d\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># vim \/etc\/auto.suibian\u6302\u8f7d\u70b9\u7684\u5177\u4f53\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n\u6dfb\u52a0&#xff1a;<br \/>\n*<span class=\"token number\">192.168<\/span>.5.100:\/share<span class=\"token comment\">#*\u8868\u793a\u6240\u6709\u5bf9\/nfs\/test\u76ee\u5f55\u7684\u8bbf\u95ee\u90fd\u4f1a\u89e6\u53d1\u81ea\u52a8\u6302\u8f7d 192.168.5.100:\/share<\/span><\/p>\n<p>\u91cd\u542f\u670d\u52a1\u5f00\u542f\u81ea\u52a8\u6302\u8f7d<\/p>\n<p><span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl restart nfs-server<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client test<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># systemctl status autofs<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client ~<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># cd \/nfs\/test\/<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client test<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># ll<\/span><br \/>\n\u603b\u7528\u91cf <span class=\"token number\">0<\/span><br \/>\ndrwxrwxrwx. <span class=\"token number\">8<\/span> root root <span class=\"token number\">60<\/span> <span class=\"token number\">11<\/span>\u6708  <span class=\"token number\">8<\/span> <span class=\"token number\">20<\/span>:35 share<br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client test<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># tree<\/span><br \/>\n<span class=\"token builtin class-name\">.<\/span><br \/>\n\u2514\u2500\u2500 share<br \/>\n    \u251c\u2500\u2500 <span class=\"token number\">1<\/span><br \/>\n    \u2502   \u2514\u2500\u2500 <span class=\"token builtin class-name\">test<\/span><br \/>\n    \u251c\u2500\u2500 <span class=\"token number\">2<\/span><br \/>\n    \u251c\u2500\u2500 <span class=\"token number\">3<\/span><br \/>\n    \u251c\u2500\u2500 <span class=\"token number\">4<\/span><br \/>\n    \u251c\u2500\u2500 <span class=\"token number\">5<\/span><br \/>\n    \u2514\u2500\u2500 <span class=\"token number\">6<\/span><\/p>\n<p><span class=\"token number\">7<\/span> directories, <span class=\"token number\">1<\/span> <span class=\"token function\">file<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>root&#064;client test<span class=\"token punctuation\">]<\/span><span class=\"token comment\"># <\/span><br \/>\n<span class=\"token comment\">#\u6ce8\u610f&#xff1a;\u4ee5\u4e0a\u64cd\u4f5c\u5728\u5173\u95ed\u9632\u706b\u5899\u4ee5\u53caselinux\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf19\u6b21\u3002\u7b80\u5355\u4ecb\u7ecd\u4e86Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684nfs\u670d\u52a1\u3002_mount -t nfs \u6302\u8f7d\u76ee\u5f55\u548c\u672c\u5730\u76ee\u5f55\u4e00\u6837,\u4f1a\u8986\u76d6\u5417<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-20266","post","type-post","status-publish","format-standard","hentry","category-server","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>Linux - nfs\u670d\u52a1\u5668 - \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\/20266.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux - nfs\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf19\u6b21\u3002\u7b80\u5355\u4ecb\u7ecd\u4e86Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684nfs\u670d\u52a1\u3002_mount -t nfs \u6302\u8f7d\u76ee\u5f55\u548c\u672c\u5730\u76ee\u5f55\u4e00\u6837,\u4f1a\u8986\u76d6\u5417\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/20266.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T19:01:16+00:00\" \/>\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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/20266.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/20266.html\",\"name\":\"Linux - nfs\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T19:01:16+00:00\",\"dateModified\":\"2025-04-18T19:01:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/20266.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/20266.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/20266.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux - nfs\u670d\u52a1\u5668\"}]},{\"@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":"Linux - nfs\u670d\u52a1\u5668 - \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\/20266.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux - nfs\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf19\u6b21\u3002\u7b80\u5355\u4ecb\u7ecd\u4e86Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684nfs\u670d\u52a1\u3002_mount -t nfs \u6302\u8f7d\u76ee\u5f55\u548c\u672c\u5730\u76ee\u5f55\u4e00\u6837,\u4f1a\u8986\u76d6\u5417","og_url":"https:\/\/www.wsisp.com\/helps\/20266.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T19:01:16+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/20266.html","url":"https:\/\/www.wsisp.com\/helps\/20266.html","name":"Linux - nfs\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T19:01:16+00:00","dateModified":"2025-04-18T19:01:16+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/20266.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/20266.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/20266.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux - nfs\u670d\u52a1\u5668"}]},{"@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\/20266","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=20266"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/20266\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=20266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=20266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=20266"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=20266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}