{"id":2515,"date":"2022-06-25T14:02:12","date_gmt":"2022-06-25T06:02:12","guid":{"rendered":"https:\/\/dasmz.com\/?p=2515"},"modified":"2023-02-23T13:20:39","modified_gmt":"2023-02-23T05:20:39","slug":"debian-11-%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%aenfs-server%ef%bc%8c%e4%b8%balinux-%e5%ae%b9%e5%99%a8%e6%8f%90%e4%be%9b%e6%8c%81%e7%bb%ad%e5%8c%96%e7%9a%84%e5%85%b1%e4%ba%ab%e5%ad%98%e5%82%a8-2022-6-25","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=2515","title":{"rendered":"NFS \u6587\u4ef6\u5b58\u50a8\uff0c\u5b89\u88c5\u914d\u7f6e\u4f7f\u7528\uff0c\u4e3aLinux\u670d\u52a1\u5668\/Docker\u5bb9\u5668\u63d0\u4f9b\u6301\u7eed\u5316\u7684\u6587\u4ef6\u5b58\u50a8 2022-6-25"},"content":{"rendered":"\n<p><strong>\u6bb5\u843d1\u3001\u9700\u6c42\u63cf\u8ff0<\/strong><\/p>\n\n\n\n<p>\u5185\u7f51\u4e2d\u7684\u4e00\u4e9bLinux\u4e3b\u673a\uff0c\u8fd8\u6709\u4e00\u4e9bDocker\u5bb9\u5668\uff0c\u9700\u8981\u6301\u7eed\u5316\u7684\u4e00\u4e9b\u6587\u4ef6\u5171\u4eab\uff0c\u8fd9\u4e2a\u573a\u666f\uff0cNFS\u662f\u975e\u5e38\u9002\u5408\u7684\uff0c\u4e0b\u9762\u5c31\u6765\u8bb2\u89e3\u4e00\u4e0b\uff0c\u5982\u4f55\u914d\u7f6eNFS\u670d\u52a1\u5668\uff0c\u4e3a\u5176\u4ed6\u5185\u7f51Linux\/Docker\u5bb9\u5668\uff0c\u63d0\u4f9b\u5171\u4eab\u7684\u6587\u4ef6\u5b58\u50a8\u5206\u533a<\/p>\n\n\n\n<p>NFS \u7684\u4f18\u70b9\u662f\u5185\u6838\u76f4\u63a5\u652f\u6301\uff0c\u90e8\u7f72\u7b80\u5355\u3001\u8fd0\u884c\u7a33\u5b9a\uff0c\u534f\u8bae\u7b80\u5355\u3001\u4f20\u8f93\u6548\u7387\u9ad8\u3002<br>NFS \u7684\u7f3a\u70b9\u662f\u6ca1\u6709\u52a0\u5bc6\u6388\u6743\u7b49\u529f\u80fd\uff0c\u4ec5\u4f9d\u9760 IP \u5730\u5740\u6216\u4e3b\u673a\u540d\u6765\u51b3\u5b9a\u7528\u6237\u80fd\u5426\u6302\u8f7d\u5171\u4eab\u76ee\u5f55\uff0c\u5bf9\u5177\u4f53\u76ee\u5f55\u548c\u6587\u4ef6\u65e0\u6cd5\u8fdb\u884c ACL \u6743\u9650\u63a7\u5236\uff08NFSv4 \u4ee5\u524d\uff09\u3002\u901a\u5e38\u7684\u505a\u6cd5\u662f\u901a\u8fc7 Kerberos \u5bf9 NFS \u8fdb\u884c\u8ba4\u8bc1\u53ca\u52a0\u5bc6\uff0c\u4e0d\u8fc7\u90e8\u7f72\u914d\u7f6e\u6bd4\u8f83\u9ebb\u70e6\u3002<\/p>\n\n\n\n<p>Windows\u5bf9\u4e8eNFS\u6587\u4ef6\u5b58\u50a8\u652f\u6301\u7a0d\u6b20\u7f3a\uff0c\u7f3aUTF8\u7f16\u7801\uff0c\u53ef\u80fd\u6709\u6587\u4ef6\u540d\u4e71\u7801\u95ee\u9898\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u6bb5\u843d2\u3001\u5b89\u88c5 NFS Server<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt update\napt install nfs-kernel-server<\/pre>\n\n\n\n<p><strong>\u6bb5\u843d3\u3001\u914d\u7f6e NFS Server<\/strong><\/p>\n\n\n\n<p>\/media\/NFSData \u662f\u6211\u8fd9\u91cc\u6a21\u62df\u63d0\u4f9bNFS\u5b58\u50a8\u7684\u5927\u5bb9\u91cf\u78c1\u76d8\u7684\u6302\u8f7d\u70b9<\/p>\n\n\n\n<p>\/dev\/sdb1 \u662f\u6211\u8fd9\u91cc\u6a21\u62df\u63d0\u4f9bNFS\u5b58\u50a8\u7684\u5927\u5bb9\u91cf\u8bbe\u5907\u6587\u4ef6\u5206\u533a<\/p>\n\n\n\n<p>\u76f8\u5173Dasmz\u7684\u5176\u4ed6\u535a\u5ba2<\/p>\n\n\n\n<p><a href=\"https:\/\/dasmz.com\/?p=2177\" data-type=\"URL\" data-id=\"https:\/\/dasmz.com\/?p=2177\">Ubuntu\/Debian \u7684Linux\u73af\u5883\uff0c\u683c\u5f0f\u5316\u8d85\u8fc72TB\u7684\u78c1\u76d8 2022-4-24 <\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/dasmz.com\/?p=2177\" data-type=\"URL\" data-id=\"https:\/\/dasmz.com\/?p=2177\">https:\/\/dasmz.com\/?p=2177<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir -p \/media\/NFSData\nchown nobody:nogroup \/media\/NFSData \nchmod 777 \/media\/NFSData\nmount \/dev\/sdb1 \/media\/NFSData<\/pre>\n\n\n\n<p>\u4fee\u6539\u57fa\u4e8eIP\u53ef\u4fe1\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u6211\u8fd9\u91cc\uff0c\u5bf9\u4e8e\u6574\u4e2a\u5185\u7f51\u7684IP\u6bb5\u865a\u62df\u673aVM\u90fd\u653e\u884c\u8fd9\u4e2aNFS\u5206\u533a<\/p>\n\n\n\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u4fee\u6539 \/etc\/exports \u6587\u4ef6\n\/media\/NFSData    10.11.11.0\/24(rw,sync,no_subtree_check)<\/pre>\n\n\n\n<p>\u53c2\u6570\u91ca\u4e49<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ro: specifies that the directory may only be mounted as read only\nrw: grants both read and write permissions on the directory\nno_root_squash: is an extremely dangerous option that allows remote \u201croot\u201d users the same privilege as the \u201croot\u201d user of the host machine\nsubtree_check: specifies that, in the case of a directory is exported instead of an entire filesystem, the host should verify the location of files and directories on the host filesystem\nno_subtree_check: specifies that the host should not check the location of the files being accessed withing the host filesystem\nsync: this just ensures that the host keeps any changes uploaded to the shared directory in sync\nasync: ignores synchronization checks in favor of increased speed<\/pre>\n\n\n\n<p>\u4fee\u6539\u5b8c\u914d\u7f6e\u6587\u4ef6\uff0c\u91cd\u542f\u670d\u52a1\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl restart nfs-server\nsystemctl enable nfs-server<\/pre>\n\n\n\n<p>NFS Server\u76d1\u542c\u7aef\u53e3\u662f TCP\/2049<\/p>\n\n\n\n<p>RPC-Bind\u76d1\u542c\u7aef\u53e3 TCP\/111<\/p>\n\n\n\n<p><strong>\u6bb5\u843d4\u3001\u914d\u7f6e\u5ba2\u6237\u7aef<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt update\napt install nfs-common\n\nmkdir -p \/media\/NFS\nmount -t nfs4 10.11.11.200:\/media\/NFSData \/media\/NFS<\/pre>\n\n\n\n<p><strong>\u6bb5\u843d5\u3001\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u7684\u6302\u8f7d<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u4fee\u6539\u6587\u4ef6 \/etc\/fstab\n\n10.11.11.200:\/media\/NFSData\t\/media\/NFS\tnfs4\tdefaults,user,exec\t0 0<\/pre>\n\n\n\n<p>\u5b8c\u6210<\/p>\n\n\n\n<p>\u6bb5\u843d6\u3001\u6392\u67e5\u95ee\u9898\uff0c\u90e8\u5206\u7248\u672c\u7684\uff0c\u53ef\u80fd\u9700\u8981\u4fee\u6539\/etc\/default\/nfs-common<\/p>\n\n\n\n<p>\u5e38\u89c1\u62a5\u9519<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mount.nfs: access denied by server while mounting<\/pre>\n\n\n\n<p>\u53ef\u80fd\u539f\u56e0<\/p>\n\n\n\n<p>6.1\u3001\u5b89\u5168\u7ec4\uff0c\u9632\u706b\u5899\uff0c\u7aef\u53e3\u653e\u884c<\/p>\n\n\n\n<p>6.2\u3001\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">exportfs -rav<\/pre>\n\n\n\n<p>6.3\u3001\u7528\u6237ID\u5339\u914d\uff0c\u6211\u8fd9\u91cc\u4e0d\u533a\u5206\uff0c\u5373\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u4fee\u6539 \/etc\/default\/nfs-common\nNEED_IDMAPD=no\nNEED_GSSD=no\n<\/pre>\n\n\n\n<p>6.4\u3001\u5ba2\u6237\u7aef\u663e\u793a\u66f4\u591a\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u5ba2\u6237\u7aef\u6267\u884cmount\u547d\u4ee4\u7684\u65f6\u5019\uff0c\u52a0\u4e0a -v \u53c2\u6570\n\nmount -t nfs -vvvv 1.169.9.27:\/media\/remote_nfs \/media\/LNFS<\/pre>\n\n\n\n<p><strong>\u9644\u5f551\u3001\u5b89\u5168<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u4e0d\u653e\u5fc3\u672a\u77e5\u7684\u98ce\u9669\uff0c\u53ef\u9009\u7528\u9632\u706b\u5899\u52a0\u56fa\u4e00\u4e0b 111\/ 2049 \u4e24\u4e2a\u7aef\u53e3\uff0c\u5982\u679c\u662fNFSv3\uff0c\u53ef\u80fd\u8fd8\u9700\u8981\u589e\u52a0\u9632\u62a4\u7aef\u53e3 37305\/40087\/54045\/55529<\/p>\n\n\n\n<p>2023-02-23 \u66f4\u65b0\u6587\u7ae0<\/p>\n\n\n\n<p><strong>\u9644\u5f552\u3001\u89c6\u9891\u6f14\u793a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"000102  NFS\u6587\u4ef6\u5b58\u50a8\uff0c\u5b89\u88c5\u914d\u7f6e\u4f7f\u7528\uff0c\u4e3aLinux\u670d\u52a1\u5668 \uff0cDocker\u5bb9\u5668\u63d0\u4f9b\u6301\u7eed\u5316\u7684\u6587\u4ef6\u5b58\u50a8 20220625\" width=\"625\" height=\"352\" src=\"https:\/\/www.youtube.com\/embed\/BRGHQsleQYs?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6bb5\u843d1\u3001\u9700\u6c42\u63cf\u8ff0 \u5185\u7f51\u4e2d\u7684\u4e00\u4e9bLinux\u4e3b\u673a\uff0c\u8fd8\u6709\u4e00\u4e9bDocker\u5bb9\u5668\uff0c\u9700\u8981\u6301\u7eed\u5316\u7684\u4e00\u4e9b\u6587\u4ef6\u5171\u4eab\uff0c\u8fd9\u4e2a\u573a\u666f\uff0cN [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/2515"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2515"}],"version-history":[{"count":24,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/2515\/revisions"}],"predecessor-version":[{"id":3131,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/2515\/revisions\/3131"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}