{"id":981,"date":"2018-11-07T20:11:20","date_gmt":"2018-11-07T12:11:20","guid":{"rendered":"https:\/\/blog.freesilo.com\/?p=981"},"modified":"2018-11-07T20:26:59","modified_gmt":"2018-11-07T12:26:59","slug":"raspberry-pi3-%e5%ae%89%e8%a3%85-nfs-server","status":"publish","type":"post","link":"https:\/\/freesilo.com\/?p=981","title":{"rendered":"Raspberry Pi3  \u5b89\u88c5 NFS Server"},"content":{"rendered":"<p>\u5b89\u88c5\u5fc5\u8981\u670d\u52a1\uff1a<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td><span style=\"font-family: inherit;\">sudo apt-get install portmap<\/span><\/p>\n<div>\n<p align=\"left\">sudo apt-get install nfs-kernel-server<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nsudo vi \/etc\/exports<br \/>\n\u5728\u6587\u4ef6\u7684\u6700\u540e\u4e00\u884c\u6dfb\u52a0\uff1a<br \/>\n\/mnt\/nfs *(rw,sync,no_root_squash)<br \/>\n\/mnt\/nfs\u662fUbuntu\u6839\u76ee\u5f55\u4e0b\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\uff08\u521b\u5efa sudo mkdir \/mnt\/nfs\uff09<br \/>\n#\u00a0 * \u8868\u793a\u4efb\u4f55IP\u90fd\u53ef\u4ee5\u5171\u4eab\uff0c\u5982\u679c\u4f60\u60f3\u9650\u5b9a\u4e2a\u522bIP\uff0c\u7528IP\u66ff\u4ee3<br \/>\n#no_root_squash\u4e0d\u592a\u5b89\u5168\uff0c\u53ef\u4ee5\u6539\u4e3aroot_squash,\u8fd9\u91cc\u662f\u7279\u6b8a\u5e94\u7528<br \/>\n\u4fdd\u5b58\u5e76\u9000\u51fa<br \/>\n\u542f\u52a8NFS\u670d\u52a1<br \/>\nsudo \/etc\/init.d\/portmap restart<br \/>\nsudo \/etc\/init.d\/nfs-kernel-server restart<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>l\u00a0 \u7f16\u8f91\u6587\u4ef6<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>sudo vim \/etc\/exports<\/p>\n<div>\n<p align=\"left\">\u6dfb\u52a0\uff1a<\/p>\n<p align=\"left\">\/home\/pi\/Myself \u00a0\u00a0\u00a0 \u00a0192.168.123.*(rw,sync,no_subtree_check)<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>* \u8868\u793a\u6700\u540e\u4e00\u6bb5\u4efb\u4f55IP\u90fd\u53ef\u4ee5\u5171\u4eab\uff0c\u5982\u679c\u4f60\u60f3\u9650\u5b9a\u4e2a\u522bIP\uff0c\u7528IP\u66ff\u4ee3<\/p>\n<p>\u6ce8\u610f\u8981\u4e8b\u5148\u521b\u5efa\u8981\u5171\u4eab\u7684\u76ee\u5f55<\/p>\n<p>&nbsp;<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>\u53c2\u6570<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\"><strong>\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>ro<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u53ea\u8bfb\u8bbf\u95ee<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>rw<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u8bfb\u5199\u8bbf\u95ee<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>sync<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u6240\u6709\u6570\u636e\u5728\u8bf7\u6c42\u65f6\u5199\u5165\u5171\u4eab<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>async<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">nfs\u5728\u5199\u5165\u6570\u636e\u524d\u53ef\u4ee5\u54cd\u5e94\u8bf7\u6c42<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>secure<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">nfs\u901a\u8fc71024\u4ee5\u4e0b\u7684\u5b89\u5168TCP\/IP\u7aef\u53e3\u53d1\u9001<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>insecure<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">nfs\u901a\u8fc71024\u4ee5\u4e0a\u7684\u7aef\u53e3\u53d1\u9001<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>wdelay<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u5982\u679c\u591a\u4e2a\u7528\u6237\u8981\u5199\u5165nfs\u76ee\u5f55\uff0c\u5219\u5f52\u7ec4\u5199\u5165\uff08\u9ed8\u8ba4\uff09<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>no_wdelay<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u5982\u679c\u591a\u4e2a\u7528\u6237\u8981\u5199\u5165nfs\u76ee\u5f55\uff0c\u5219\u7acb\u5373\u5199\u5165\uff0c\u5f53\u4f7f\u7528async\u65f6\uff0c\u65e0\u9700\u6b64\u8bbe\u7f6e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>hide<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u5728nfs\u5171\u4eab\u76ee\u5f55\u4e2d\u4e0d\u5171\u4eab\u5176\u5b50\u76ee\u5f55<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>no_hide<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u5171\u4eabnfs\u76ee\u5f55\u7684\u5b50\u76ee\u5f55<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>subtree_check<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u5982\u679c\u5171\u4eab\/usr\/bin\u4e4b\u7c7b\u7684\u5b50\u76ee\u5f55\u65f6\uff0c\u5f3a\u5236nfs\u68c0\u67e5\u7236\u76ee\u5f55\u7684\u6743\u9650\uff08\u9ed8\u8ba4\uff09<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>no_subtree_check<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u4e0d\u68c0\u67e5\u7236\u76ee\u5f55\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>all_squash<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u5171\u4eab\u6587\u4ef6\u7684UID\u548cGID\u6620\u5c04\u533f\u540d\u7528\u6237anonymous\uff0c\u9002\u5408\u516c\u7528\u76ee\u5f55<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>no_all_squash<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u4fdd\u7559\u5171\u4eab\u6587\u4ef6\u7684UID\u548cGID\uff08\u9ed8\u8ba4\uff09<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>root_squash<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">root\u7528\u6237\u7684\u6240\u6709\u8bf7\u6c42\u6620\u5c04\u6210\u5982anonymous\u7528\u6237\u4e00\u6837\u7684\u6743\u9650\uff08\u9ed8\u8ba4\uff09<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>no_root_squash<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">root\u7528\u6237\u5177\u6709\u6839\u76ee\u5f55\u7684\u5b8c\u5168\u7ba1\u7406\u8bbf\u95ee\u6743\u9650<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>anonuid=xxx<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u6307\u5b9anfs\u670d\u52a1\u5668\/etc\/passwd\u6587\u4ef6\u4e2d\u533f\u540d\u7528\u6237\u7684UID<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"165\">\n<p align=\"left\"><strong>anongid=xxx<\/strong><\/p>\n<\/td>\n<td valign=\"top\" width=\"555\">\n<p align=\"left\">\u6307\u5b9anfs\u670d\u52a1\u5668\/etc\/passwd\u6587\u4ef6\u4e2d\u533f\u540d\u7528\u6237\u7684GID<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>l\u00a0 \u542f\u52a8NFS Server<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<p align=\"left\">\/etc\/init.d\/nfs-kernel-server start<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>l\u00a0 \u68c0\u67e5\u662f\u5426\u542f\u52a8<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<p align=\"left\">showmount\u00a0 \u00a0\u2013e localhost<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u53d1\u73b0\u542f\u52a8\u4e0d\u8d77\u6765\uff0c\u5361\u4e3b\u4e0d\u52a8\u3002\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<p>l\u00a0 \u5728\u670d\u52a1\u5668\u4e0a\u5148\u505c\u6b62rpcbind \u548cnfs\u5728\u542f\u52a8 \u6ce8\u610f\u987a\u5e8f<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\n<p>sudo \/etc\/init.d\/rpcbind stop\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u505c\u6b62rpcbind<\/p>\n<p align=\"left\">sudo \/etc\/init.d\/nfs-kernel-server stop\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u505c\u6b62nfs<\/p>\n<p>sudo \/etc\/init.d\/rpcbind start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u542f\u52a8rpcbind<\/p>\n<p align=\"left\">sudo \/etc\/init.d\/nfs-kernel-server start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u542f\u52a8nfs<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>l\u00a0 \u67e5\u770bnfs\u72b6\u6001\uff1a<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>pi@raspberrypi:~ $ showmount -e localhost<\/p>\n<p>Export \u00a0\u00a0\u00a0 list for localhost:<\/p>\n<div>\/home\/pi\/Myself \u00a0\u00a0\u00a0 192.168.123.*<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u51fa\u73b0\u76ee\u5f55\u548c\u8bbf\u95ee\u5730\u5740\u5373\u53ef<\/p>\n<p>&nbsp;<\/p>\n<p>l\u00a0 \u5ba2\u6237\u7aef\u8fdb\u884c\u8fde\u63a5<\/p>\n<table cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<div>\u00a0mount -t nfs -o nolock 192.168.123.20:\/home\/pi\/Myself \u00a0\/mnt\/nfs<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u6ce8\u610f\u4e8b\u5148\u521b\u5efa\u76ee\u5f55<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5\u5fc5\u8981\u670d\u52a1\uff1a sudo apt-get install portmap sud&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/freesilo.com\/?p=981\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-981","post","type-post","status-publish","format-standard","hentry","category-raspberry"],"_links":{"self":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=981"}],"version-history":[{"count":5,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/981\/revisions"}],"predecessor-version":[{"id":986,"href":"https:\/\/freesilo.com\/index.php?rest_route=\/wp\/v2\/posts\/981\/revisions\/986"}],"wp:attachment":[{"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freesilo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}