NFS搭建错误处理:exportfs:No options for /home/source/*(rw,sync,no_root_squash):suggest(sync) to avoid warn

一,NFS搭建步骤:

     1.安装Ubuntu NFS服务:
           ---> apt-get install nfs-kernel-server
                • 安装过程弹出对话,选择Y,回车继续安装

     2.配置/etc/exports
       – 最后一行添加/home/source/ *(rw,sync,no_root_squash)
         /home/source/表示要共享的目录,根据实际情况修改
        – *:代表允许所有的网络段访问
      – rw:是可读写权限
     – ync:是资料同步写入内存和硬盘
      – no_root_squash:是Ubuntu nfs 客户端分享目录使用者的权限,如果客户端使用的是root 用户,那么对于该共享目录而言,该客户端就具有root 权限


    3 .重启portmap 服务
        – /etc/init.d/portmap restart

root@ubuntu:/home/source# /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop portmap ; start portmap. The restart(8) utility is also available.
portmap stop/waiting
portmap start/running, process 15124


    4.重启nfs 服务
       – /etc/init.d/nfs-kernel-server restart

   

root@ubuntu:/home/source# /etc/init.d/nfs-kernel-server  restart
 * Stopping NFS kernel daemon                                             [ OK ] 
 * Unexporting directories for NFS kernel daemon...                       [ OK ] 
 * Exporting directories for NFS kernel daemon...                              
exportfs: No options for /home/source/*(rw,sync,no_root_squash) : suggest (sync) to avoid warning
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export ":/home/source/*(rw,sync,no_root_squash)".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: Failed to stat /home/source/*(rw,sync,no_root_squash): No such file or directory
                                                                          [ OK ]
 * Starting NFS kernel daemon                                             [ OK ]

5.测试NFS功能:

root@ubuntu:/home/source# mount -t nfs localhost:/home/source/system /mnt
mount.nfs: access denied by server while mounting localhost:/home/source/system

二.错误分析:

这里可以看出NFS挂载失败。问题在于重启的时候失败,报错:exportfs: No options for /home/source/*(rw,sync,no_root_squash) : suggest (sync) to avoid warning
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export ":/home/source/*(rw,sync,no_root_squash)". 

这里是把配置/etc/exports
       – 最后一行添加/home/source/ *(rw,sync,no_root_squash)------>改成/home/source *(rw,sync,no_root_squash,no_subtree_check)就OK了。

执行结果:

root@ubuntu:/home/source# /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop portmap ; start portmap. The restart(8) utility is also available.
portmap stop/waiting
portmap start/running, process 15511
root@ubuntu:/home/source# /etc/init.d/nfs-kernel-server  restart
 * Stopping NFS kernel daemon                                             [ OK ] 
 * Unexporting directories for NFS kernel daemon...                       [ OK ] 
 * Exporting directories for NFS kernel daemon...                         [ OK ] 
 * Starting NFS kernel daemon                                             [ OK ] 
root@ubuntu:/home/source# mount -t nfs localhost:/home/source/system /mnt
root@ubuntu:/home/source#
 

猜你喜欢

转载自blog.csdn.net/weixin_42490904/article/details/84202200