{"id":21534,"date":"2025-04-19T04:42:46","date_gmt":"2025-04-18T20:42:46","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/21534.html"},"modified":"2025-04-19T04:42:46","modified_gmt":"2025-04-18T20:42:46","slug":"linux-%e9%85%8d%e7%bd%aenfs%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/21534.html","title":{"rendered":"Linux \u914d\u7f6eNFS\u670d\u52a1\u5668"},"content":{"rendered":"<h3>\u00a01. \u5f00\u653e\/nfs\/shared\u76ee\u5f55&#xff0c;\u4f9b\u6240\u6709\u7528\u6237\u67e5\u9605\u8d44\u6599<\/h3>\n<h4>\u670d\u52a1\u7aef<\/h4>\n<h5>&#xff08;1&#xff09;\u5b89\u88c5nfs\u670d\u52a1&#xff0c;nfs-utils\u5305\u4e2d\u5305\u542brpcbind&#xff08;rpc\u5b88\u62a4\u8fdb\u7a0b&#xff09;<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">yum install -y nfs-utils<\/span>\u00a0 <span style=\"color:#fe2c24\"># nfs-utils\u5305\u4e2d\u5305\u542brpcbind<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">rpm -q rpcbind<\/span>\u00a0 <span style=\"color:#fe2c24\"># \u68c0\u67e5rpcbind\u662f\u5426\u5b89\u88c5<\/span><\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204241-6802b94199212.jpg\" \/><\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204241-6802b941cf933.jpg\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"79\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204242-6802b94206695.jpg\" width=\"833\" \/><\/p>\n<h5>&#xff08;2&#xff09;\u521b\u5efa\u5171\u4eab\u76ee\u5f55<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">mkdir -p \/nfs\/shared<\/span>\u00a0 <span style=\"color:#fe2c24\"># -p \u9012\u5f52\u521b\u5efa\u76ee\u5f55<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">ll \/nfs<\/span> total 0 drwxr-xr-x. 2 root root 6 Mar 27 10:08 shared<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"155\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204242-6802b9422ad6e.jpg\" width=\"799\" \/><\/p>\n<h5>&#xff08;3&#xff09;\u5173\u95ed\u9632\u706b\u5899\u3001selinux\u8bbe\u7f6e\u5bbd\u5bb9\u6a21\u5f0f\u3001\u67e5\u770b\u72b6\u6001<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl stop firewalld<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">setenforce 0<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">getenforce\u00a0 <\/span><span style=\"color:#fe2c24\"># \u67e5\u770bselinux\u6a21\u5f0f<\/span> Permissive\u00a0 <span style=\"color:#fe2c24\"># \u5bbd\u5bb9\u6a21\u5f0f<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl status firewalld.service<\/span> \u25cb firewalld.service &#8211; firewalld &#8211; dynamic firewall daemon \u00a0 \u00a0 \u00a0Loaded: loaded (\/usr\/lib\/systemd\/system\/firewalld.service; disabled; preset: enabled) \u00a0 \u00a0 \u00a0Active: inactive (dead) \u00a0 \u00a0 \u00a0 \u00a0Docs: man:firewalld(1)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"169\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204242-6802b9424f392.jpg\" width=\"740\" \/><\/p>\n<h5>&#xff08;4&#xff09;\u542f\u52a8\u670d\u52a1\u3001\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u3001\u67e5\u770b\u670d\u52a1\u72b6\u6001<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl start nfs-server<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl start rpcbind<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl enable nfs-server<\/span> Created symlink \/etc\/systemd\/system\/multi-user.target.wants\/nfs-server.service \u2192 \/usr\/lib\/systemd\/system\/nfs-server.service.<\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl enable rpcbind<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl status nfs-server<\/span> \u25cf nfs-server.service &#8211; NFS server and services<\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">systemctl status rpcbind<\/span> \u25cf rpcbind.service &#8211; RPC Bind<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204242-6802b9427fd69.jpg\" \/><\/p>\n<h5>&#xff08;5&#xff09;\u7f16\u8f91\/etc\/exports\u6587\u4ef6<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">vim \/etc\/exports<\/span>\u00a0 <span style=\"color:#fe2c24\">#\u00a0\/etc\/exports<\/span><span style=\"color:#4da8ee\">\u00a0<\/span><span style=\"color:#fe2c24\">NFS\u670d\u52a1\u7684\u662f\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6&#xff0c;\u4f5c\u7528\u662f\u5bf9\u5171\u4eab\u7684\u76ee\u5f55\u3001\u5141\u8bb8\u8bbf\u95ee\u7684\u5ba2\u6237\u7aef\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\u7b49\u4fe1\u606f\u8fdb\u884c\u914d\u7f6e<\/span> <span style=\"color:#4da8ee\">\/nfs\/shared *(ro)<\/span>\u00a0 <span style=\"color:#fe2c24\">#\u00a0\u5c06\u00a0\/nfs\/shared\u00a0\u76ee\u5f55\u5171\u4eab\u51fa\u53bb&#xff0c;\u5e76\u4e14\u5141\u8bb8\u7f51\u7edc\u4e0a\u7684\u6240\u6709\u4e3b\u673a\u4ee5\u53ea\u8bfb\u6743\u9650\u8bbf\u95ee\u8be5\u76ee\u5f55\u00a0 \u00a0*()\u4e2d\u95f4\u6ca1\u6709\u7a7a\u683c<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"179\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204242-6802b942d9dd9.jpg\" width=\"901\" \/><\/p>\n<h5>&#xff08;6&#xff09;\u91cd\u542f\u670d\u52a1<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">exportfs -avr<\/span>\u00a0 <span style=\"color:#fe2c24\"># exportfs \u7528\u4e8e\u7ba1\u7406 NFS\u5171\u4eab\u76ee\u5f55 &#xff1b; -a\u9009\u9879\u8868\u793a \u201call\u201d&#xff0c;\u5373\u5bf9 \/etc\/exports \u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u6240\u6709\u5171\u4eab\u76ee\u5f55\u6267\u884c\u76f8\u5e94\u64cd\u4f5c &#xff1b; -v \u9009\u9879\u4ee3\u8868 \u201cverbose\u201d&#xff0c;\u4e5f\u5c31\u662f\u8be6\u7ec6\u6a21\u5f0f &#xff1b; -r \u9009\u9879\u610f\u5473\u7740 \u201creexport\u201d&#xff0c;\u5373\u91cd\u65b0\u5bfc\u51fa\u6240\u6709\u5171\u4eab\u76ee\u5f55<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"57\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204243-6802b9430b3f3.jpg\" width=\"783\" \/><\/p>\n<\/p>\n<h4>\u5ba2\u6237\u7aef<\/h4>\n<h5>&#xff08;1&#xff09;\u5b89\u88c5\u670d\u52a1<\/h5>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">yum install -y nfs-utils<\/span><\/p>\n<h5>&#xff08;2&#xff09;\u542f\u52a8\u670d\u52a1<\/h5>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">systemctl start nfs-server.service<\/span><\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">systemctl start rpcbind<\/span><\/p>\n<h5>&#xff08;3&#xff09;\u5173\u95ed\u9632\u706b\u5899\u3001selinux\u8bbe\u7f6e\u5bbd\u5bb9\u6a21\u5f0f\u3001\u67e5\u770b\u72b6\u6001<\/h5>\n<p>[root&#064;node1-client\u00a0~]#<span style=\"color:#4da8ee\"> systemctl stop firewalld<\/span><\/p>\n<p>[root&#064;node1-client\u00a0~]# <span style=\"color:#4da8ee\">setenforce 0<\/span><\/p>\n<p>[root&#064;node1-client\u00a0~]# <span style=\"color:#4da8ee\">getenforce<\/span><\/p>\n<p>[root&#064;node1-client\u00a0~]# <span style=\"color:#4da8ee\">systemctl status firewalld.service<\/span><\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204243-6802b9432e887.jpg\" \/><\/p>\n<h5>&#xff08;4&#xff09;\u67e5\u770b\u670d\u52a1\u7aef\u63d0\u4f9b\u7684nfs\u670d\u52a1<\/h5>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">showmount -e 192.168.11.135\u00a0 <\/span><span style=\"color:#fe2c24\">#\u00a0\u67e5\u8be2 IP \u5730\u5740\u4e3a192.168.11.135\u7684 NFS \u670d\u52a1\u5668\u5f53\u524d\u5171\u4eab\u7684\u76ee\u5f55\u5217\u8868\u00a0 \u00a0showmount&#xff1a;\u83b7\u53d6\u5176\u5171\u4eab\u76ee\u5f55\u4fe1\u606f\u00a0 \u00a0 -e&#xff1a;\u5411\u6307\u5b9a\u7684 NFS \u670d\u52a1\u5668\u8bf7\u6c42\u5176\u5f53\u524d\u5171\u4eab\u7684\u76ee\u5f55\u5217\u8868<\/span> Export list for 192.168.11.135: \/nfs\/shared (everyone)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"73\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204243-6802b943596fc.jpg\" width=\"754\" \/><\/p>\n<h5>&#xff08;5&#xff09;\u521b\u5efa\u6302\u8f7d\u70b9\u3001\u4e34\u65f6\u6302\u8f7d\u3001\u67e5\u770b\u6302\u8f7d\u8bbe\u5907<\/h5>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">mkdir -p \/mnt\/shared<\/span><\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">mount -t nfs 192.168.11.135:\/nfs\/shared \/mnt\/shared\/<\/span>\u00a0<span style=\"color:#fe2c24\"> # -t&#xff1a;\u7528\u4e8e\u6307\u5b9a\u8981\u6302\u8f7d\u7684\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\u00a0 &#xff1b;192.168.11.135\u662f NFS \u670d\u52a1\u5668\u7684 IP \u5730\u5740 &#xff1b;:\/nfs\/shared \u8868\u793a\u8be5\u670d\u52a1\u5668\u4e0a\u5171\u4eab\u51fa\u6765\u7684\u76ee\u5f55\u8def\u5f84<\/span><\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">df -h<\/span>\u00a0 <span style=\"color:#fe2c24\"># df&#xff1a;\u62a5\u544a\u6587\u4ef6\u7cfb\u7edf\u78c1\u76d8\u7a7a\u95f4\u7684\u4f7f\u7528\u60c5\u51b5 &#xff1b; -h&#xff1a;\u5c06\u78c1\u76d8\u7a7a\u95f4\u7684\u5bb9\u91cf\u4ee5\u4eba\u7c7b\u53ef\u8bfb\u7684\u683c\u5f0f\u663e\u793a\u51fa\u6765<\/span> Filesystem \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Size \u00a0Used Avail Use% Mounted on devtmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a04.0M \u00a0 \u00a0 0 \u00a04.0M \u00a0 0% \/dev tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 866M \u00a0 \u00a0 0 \u00a0866M \u00a0 0% \/dev\/shm tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 347M \u00a07.1M \u00a0340M \u00a0 3% \/run \/dev\/mapper\/rhel-root \u00a0 \u00a0 \u00a0 \u00a015G \u00a04.2G \u00a0 11G \u00a028% \/ \/dev\/nvme0n1p2 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0960M \u00a0291M \u00a0670M \u00a031% \/boot \/dev\/nvme0n1p1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 1022M \u00a07.0M 1016M \u00a0 1% \/boot\/efi tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 174M \u00a0 52K \u00a0174M \u00a0 1% \/run\/user\/42 tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 174M \u00a0 36K \u00a0174M \u00a0 1% \/run\/user\/0 192.168.11.135:\/nfs\/shared \u00a0 15G \u00a04.3G \u00a0 11G \u00a029% \/mnt\/shared<\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">ll -d \/mnt\/shared\/<\/span>\u00a0 <span style=\"color:#fe2c24\"># -d&#xff1a;\u4ec5\u5217\u51fa\u76ee\u5f55\u672c\u8eab\u7684\u4fe1\u606f&#xff0c;\u4e0d\u9012\u5f52\u5217\u51fa\u76ee\u5f55\u5185\u90e8\u7684\u6587\u4ef6\u548c\u5b50\u76ee\u5f55<\/span> drwxr-xr-x. 2 root root 6 Mar 27 10:08 \/mnt\/shared\/<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204243-6802b9437c530.jpg\" \/><\/p>\n<\/p>\n<h3> 2. \u5f00\u653e\/nfs\/upload\u76ee\u5f55\u4e3ax.x.x.0\/24\u7f51\u6bb5\u7684\u6570\u636e\u4e0a\u4f20\u76ee\u5f55&#xff0c;\u5e76\u5c06\u6240\u6709\u7528\u6237\u53ca\u6240\u5c5e\u7684\u7528\u6237\u7ec4\u90fd\u6620\u5c04\u4e3aredhat&#xff0c;\u5176UID\u4e0eGID\u5747\u4e3a3000<\/h3>\n<h4>\u670d\u52a1\u7aef&#xff08;\u5f00\u542f\u670d\u52a1\u540c\u4e0a&#xff0c;\u7565&#xff09;<\/h4>\n<h5>&#xff08;1&#xff09;\u521b\u5efa\u5171\u4eab\u76ee\u5f55<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">mkdir -p \/nfs\/upload<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">ll \/nfs\/<\/span> total 0 drwxr-xr-x. 2 root root 6 Mar 27 10:08 shared drwxr-xr-x. 2 root root 6 Mar 27 15:18 upload<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"181\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204243-6802b943ad40a.jpg\" width=\"738\" \/><\/p>\n<h5>&#xff08;2&#xff09;\u521b\u5efaGID\u4e3a3000\u7684\u7ec4redhat&#xff0c;\u521b\u5efaGID\u548cUID\u5747\u4e3a3000\u7684\u7528\u6237redhat<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">groupadd -g 3000 redhat\u00a0 <\/span><span style=\"color:#fe2c24\"># \u521b\u5efaGID\u4e3a3000\u7684\u7528\u6237\u524d\u5fc5\u987b\u8981\u6709\u4e00\u4e2aGID\u4e3a3000\u7684\u7ec4<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">tail -1 \/etc\/group\u00a0 <\/span><span style=\"color:#fe2c24\"># \u67e5\u770b\u6700\u540e\u4e00\u884c\u7ec4\u4fe1\u606f<\/span> redhat:x:3000:<\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">useradd -g 3000 -u 3000 redhat\u00a0 <\/span><span style=\"color:#fe2c24\"># -g \u6307\u5b9aGID\u00a0 \u00a0-u \u6307\u5b9aUID<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">tail -1 \/etc\/passwd\u00a0 <\/span><span style=\"color:#fe2c24\"># \u67e5\u770b\u6700\u540e\u4e00\u884c\u7528\u6237\u4fe1\u606f<\/span> redhat:x:3000:3000::\/home\/redhat:\/bin\/bash<\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">id redhat\u00a0<\/span> <span style=\"color:#fe2c24\"># \u67e5\u770bredhat\u7528\u6237\u7684id<\/span> uid&#061;3000(redhat) gid&#061;3000(redhat) groups&#061;3000(redhat)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"222\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204243-6802b943d1c70.jpg\" width=\"779\" \/><\/p>\n<h5>&#xff08;3&#xff09;\u7f16\u8f91 \/etc\/exports \u6587\u4ef6<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">vim \/etc\/exports<\/span> <span style=\"color:#4da8ee\">\/nfs\/upload 192.168.11.0\/24(rw,all_squash,anonuid&#061;3000,anongid&#061;3000)<\/span><\/p>\n<p><span style=\"color:#fe2c24\">#\u00a0\u5c06\u00a0\/nfs\/shared\u00a0\u76ee\u5f55\u5171\u4eab\u51fa\u53bb&#xff0c;\u5141\u8bb8192.168.11.0\u7f51\u6bb5\u4e2d\u7684\u6240\u6709\u4e3b\u673a\u4ee5\u8bfb\u5199\u8bfb\u6743\u9650\u8bbf\u95ee\u8be5\u76ee\u5f55\u00a0 \u00a0ip\u7f51\u6bb5\u548c()\u4e2d\u95f4\u6ca1\u6709\u7a7a\u683c &#xff1b;\u6240\u6709\u5ba2\u6237\u7aef\u7528\u6237&#xff08;\u5305\u62ec root \u7528\u6237&#xff09;\u7684\u8eab\u4efd\u90fd\u4f1a\u88ab\u6620\u5c04\u4e3a UID \u548c GID \u5747\u4e3a3000\u7684\u533f\u540d\u7528\u6237\u3002<\/span><\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204244-6802b94403cd6.jpg\" \/><\/p>\n<h5>&#xff08;4&#xff09;\u4fee\u6539\u5171\u4eab\u76ee\u5f55 \/nfs\/upload \u7684\u6240\u5c5e\u7ec4\u548c\u6240\u5c5e\u7528\u6237<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">chown -R redhat:redhat \/nfs\/upload\/\u00a0 <\/span><span style=\"color:#fe2c24\">#\u00a0-R\u00a0\u4fee\u6539\u4e00\u4e2a\u76ee\u5f55\u53ca\u5176\u5185\u90e8\u6240\u6709\u5b50\u6587\u4ef6\u548c\u5b50\u76ee\u5f55\u7684\u6240\u6709\u8005&#xff08;\u9012\u5f52\u4fee\u6539&#xff09;<\/span><\/p>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">ll \/nfs<\/span> total 0 drwxr-xr-x. 2 root \u00a0 root \u00a0 6 Mar 27 10:08 shared drwxr-xr-x. 2 redhat redhat 6 Mar 27 15:18 upload<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"167\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204244-6802b94427dac.jpg\" width=\"723\" \/><\/p>\n<h5>&#xff08;5&#xff09;\u91cd\u542f\u670d\u52a1<\/h5>\n<p>[root&#064;node1-server ~]# <span style=\"color:#4da8ee\">exportfs -avr<\/span> exporting 192.168.11.0\/24:\/nfs\/upload <img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"103\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204244-6802b9444b027.jpg\" width=\"827\" \/><\/p>\n<\/p>\n<h4>\u5ba2\u6237\u7aef&#xff08;\u5f00\u542f\u670d\u52a1\u540c\u4e0a&#xff0c;\u7565&#xff09;<\/h4>\n<h5>&#xff08;1&#xff09;\u67e5\u770b\u5171\u4eab\u76ee\u5f55<\/h5>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">showmount -e 192.168.11.135<\/span>\u00a0\u00a0<span style=\"color:#fe2c24\">#\u00a0\u67e5\u8be2 IP \u5730\u5740\u4e3a192.168.11.135\u7684 NFS \u670d\u52a1\u5668\u5f53\u524d\u5171\u4eab\u7684\u76ee\u5f55\u5217\u8868<\/span> Export list for 192.168.11.135: \/nfs\/upload 192.168.11.0\/24 <img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"79\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204244-6802b94470bb1.jpg\" width=\"740\" \/><\/p>\n<h5>&#xff08;2&#xff09;\u521b\u5efa\u6302\u8f7d\u70b9<\/h5>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">mkdir -p \/mnt\/upload<\/span><\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">ll \/mnt<\/span> ls: cannot access &#039;\/mnt\/shared&#039;: Stale file handle total 0 drwxr-xr-x. 2 root root 6 Mar 24 17:34 hgfs d?????????? ? ? \u00a0 \u00a0? \u00a0 \u00a0? \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0? shared\u00a0 <span style=\"color:#fe2c24\"># \u7531\u4e8e\u670d\u52a1\u7aef\u914d\u7f6e\u6587\u4ef6 \/etc\/exports \u4e2d\u5df2\u5220\u9664\u914d\u7f6e\u00a0\/nfs\/shared *(ro) &#xff0c;\u6545\u6b64\u5904\u6709\u672a\u77e5\u4fe1\u606f<\/span> drwxr-xr-x. 2 root root 6 Mar 27 15:56 upload <img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"168\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204244-6802b94494ced.jpg\" width=\"731\" \/><\/p>\n<h5>&#xff08;3&#xff09;\u6c38\u4e45\u6302\u8f7d<\/h5>\n<p>[root&#064;node2-client ~]#<span style=\"color:#4da8ee\"> vim \/etc\/fstab\u00a0 <\/span><span style=\"color:#fe2c24\"># \/etc\/fatab\u00a0\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u914d\u7f6e\u6587\u4ef6&#xff0c;\u7528\u4e8e\u5b9a\u4e49\u6587\u4ef6\u7cfb\u7edf\u7684\u6302\u8f7d\u70b9\u3001\u6302\u8f7d\u53c2\u6570\u53ca\u5176\u4ed6\u76f8\u5173\u5c5e\u6027&#xff1b;\u6bcf\u6b21\u7cfb\u7edf\u542f\u52a8\u65f6&#xff0c;\u4f1a\u81ea\u52a8\u8bfb\u53d6\u8be5\u6587\u4ef6\u5e76\u6302\u8f7d\u76f8\u5e94\u7684\u6587\u4ef6\u7cfb\u7edf<\/span><\/p>\n<p><span style=\"color:#ffd900\">\u00a016<\/span><span style=\"color:#4da8ee\">\u00a0 192.168.11.135:\/nfs\/upload \u00a0 \u00a0 \u00a0\/mnt\/upload \u00a0 \u00a0 nfs \u00a0 \u00a0 defaults \u00a0 \u00a0 \u00a0 \u00a00 0<\/span><\/p>\n<p><span style=\"color:#fe2c24\"># 192.168.11.135:\/nfs\/upload\u00a0\u6307\u5b9a\u4e86\u8981\u6302\u8f7d\u7684 NFS \u5171\u4eab\u8d44\u6e90\u7684\u4f4d\u7f6e<\/span><\/p>\n<p><span style=\"color:#fe2c24\"># \/mnt\/upload\u00a0\u672c\u5730\u7cfb\u7edf\u4e0a\u7684\u4e00\u4e2a\u6302\u8f7d\u70b9&#xff0c;\u5b83\u662f\u5f53\u524d\u6587\u4ef6\u7cfb\u7edf\u6811\u4e2d\u7684\u4e00\u4e2a\u76ee\u5f55<\/span><\/p>\n<p><span style=\"color:#fe2c24\"># nfs\u00a0\u6307\u5b9a\u4e86\u8981\u6302\u8f7d\u7684\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b<\/span><\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">mount -a<\/span>\u00a0 <span style=\"color:#fe2c24\"># mount -a\u4f1a\u904d\u5386\u00a0\/etc\/fstab\u00a0\u6587\u4ef6\u7684\u6bcf\u4e00\u884c&#xff0c;\u5e76\u5c1d\u8bd5\u6302\u8f7d\u6240\u6709\u672a\u88ab\u6302\u8f7d\u7684\u6587\u4ef6\u7cfb\u7edf<\/span> mount: (hint) your fstab has been modified, but systemd still uses \u00a0 \u00a0 \u00a0 \u00a0the old version; use &#039;systemctl daemon-reload&#039; to reload.<\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">df -h\u00a0 <\/span><span style=\"color:#fe2c24\"># \u67e5\u770b\u6302\u8f7d\u60c5\u51b5<\/span> df: \/mnt\/shared: Stale file handle Filesystem \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Size \u00a0Used Avail Use% Mounted on devtmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a04.0M \u00a0 \u00a0 0 \u00a04.0M \u00a0 0% \/dev tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 866M \u00a0 \u00a0 0 \u00a0866M \u00a0 0% \/dev\/shm tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 347M \u00a07.1M \u00a0340M \u00a0 3% \/run \/dev\/mapper\/rhel-root \u00a0 \u00a0 \u00a0 \u00a015G \u00a04.2G \u00a0 11G \u00a028% \/ \/dev\/nvme0n1p2 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0960M \u00a0291M \u00a0670M \u00a031% \/boot \/dev\/nvme0n1p1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 1022M \u00a07.0M 1016M \u00a0 1% \/boot\/efi tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 174M \u00a0 52K \u00a0174M \u00a0 1% \/run\/user\/42 tmpfs \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 174M \u00a0 36K \u00a0174M \u00a0 1% \/run\/user\/0 192.168.11.135:\/nfs\/upload \u00a0 15G \u00a04.3G \u00a0 11G \u00a029% \/mnt\/upload<\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">ll -d \/mnt\/upload\/\u00a0 <\/span><span style=\"color:#fe2c24\"># \u67e5\u770b\u6302\u8f7d\u60c5\u51b5<\/span><span style=\"color:#4da8ee\">\u00a0<\/span> drwxr-xr-x. 2 3000 3000 6 Mar 27 15:18 \/mnt\/upload\/<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"393\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204244-6802b944b9e65.jpg\" width=\"760\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"269\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204244-6802b944e5fd4.jpg\" width=\"744\" \/><\/p>\n<h5>&#xff08;4&#xff09;\u521b\u5efa\u6d4b\u8bd5\u6587\u4ef6<\/h5>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">touch \/mnt\/upload\/textfile.txt<\/span><\/p>\n<p>[root&#064;node2-client ~]# <span style=\"color:#4da8ee\">ll \/mnt\/upload\/<\/span> total 0 -rw-r&#8211;r&#8211;. 1 <span style=\"color:#fe2c24\">3000 3000<\/span> 0 Mar 27 16:05 textfile.txt<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"123\" src=\"2025-04-19w0xpm3rxa5j.png\" width=\"762\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb904\u6b21\uff0c\u70b9\u8d5e27\u6b21\uff0c\u6536\u85cf18\u6b21\u3002\u670d\u52a1\u5668\u5f00\u653e\u5171\u4eab\u6587\u4ef6\uff0c\u901a\u8fc7\u5ba2\u6237\u7aef\u8bfb\u53d6_nfs\u670d\u52a1\u5668\u914d\u7f6e<\/p>\n","protected":false},"author":2,"featured_media":21514,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,78],"topic":[],"class_list":["post-21534","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-43","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux \u914d\u7f6eNFS\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\/21534.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux \u914d\u7f6eNFS\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb904\u6b21\uff0c\u70b9\u8d5e27\u6b21\uff0c\u6536\u85cf18\u6b21\u3002\u670d\u52a1\u5668\u5f00\u653e\u5171\u4eab\u6587\u4ef6\uff0c\u901a\u8fc7\u5ba2\u6237\u7aef\u8bfb\u53d6_nfs\u670d\u52a1\u5668\u914d\u7f6e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/21534.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-18T20:42:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204241-6802b94199212.jpg\" \/>\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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/21534.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/21534.html\",\"name\":\"Linux \u914d\u7f6eNFS\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T20:42:46+00:00\",\"dateModified\":\"2025-04-18T20:42:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/21534.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/21534.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/21534.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux \u914d\u7f6eNFS\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 \u914d\u7f6eNFS\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\/21534.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux \u914d\u7f6eNFS\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb904\u6b21\uff0c\u70b9\u8d5e27\u6b21\uff0c\u6536\u85cf18\u6b21\u3002\u670d\u52a1\u5668\u5f00\u653e\u5171\u4eab\u6587\u4ef6\uff0c\u901a\u8fc7\u5ba2\u6237\u7aef\u8bfb\u53d6_nfs\u670d\u52a1\u5668\u914d\u7f6e","og_url":"https:\/\/www.wsisp.com\/helps\/21534.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T20:42:46+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418204241-6802b94199212.jpg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/21534.html","url":"https:\/\/www.wsisp.com\/helps\/21534.html","name":"Linux \u914d\u7f6eNFS\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T20:42:46+00:00","dateModified":"2025-04-18T20:42:46+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/21534.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/21534.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/21534.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux \u914d\u7f6eNFS\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\/21534","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=21534"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/21534\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/21514"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=21534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=21534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=21534"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=21534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}