Ubuntu 14.04安装配置NFS

(一)安装NFS服务器

  sudo apt-get install nfs-kernel-server

  sudo apt-get install nfs-common​(在安装nsf-kernel-server的时候,也会安装nfs-commom。如果没有安装这个软件包,则要执行1.2中的命令了)

  创建共享的文件目录:mkdir /home/nfsroot 目录自定义

(二)配置NFS 2.1-修改配置文件/etc/exports

在最后一行添加:/home/nfsroot *(rw,sync,no_root_squash,no_subtree_check)

目录是与nfs服务客户端共享的目录,*代表允许所有的网段访问(也可以使用具体的IP)

rw:挂接此目录的客户端对该共享目录具有读写权限

sync:资料同步写入内存和硬盘

no_root_squash:客户机用root访问该共享文件夹时,不映射root用户。(root_squash:客户机用root用户访问该共享文件夹时,将root用户映射成匿名用户)

no_subtree_check:不检查父目录的权限。

2.2-nfs是一个RPC程序,使用它前,需要映射好端口,通过rpcbind 设定:

  sudo service rpcbind restart

2.3-重启nfs服务:

  sudo service nfs-kernel-server restart

2.4-测试 运行以下命令来显示一下共享出来的目录:

  showmount -e​

(三)挂载指令

mount -t nfs 192.168.1.10:/home/nfsroot/ /mnt

或mount -t nfs -o nolock 192.168.1.10:/home/nfsroot/ /mnt

查看挂载状态:mount |grep nfs

 

在目标板上通过NFS复制PC机上较大文件到目标板上的时候遇到的问题:
nfs: server *** not responding, still trying

修改方法:
nfs mount时候出现的NFS崩溃,按照以下的方式mount
mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 192.168.1.3/root/somedir /client

问题原因:
Mandag 27 november 2006 20:12 skrev Verner Kjærsgaard:
> Mandag 27 november 2006 19:33 skrev John P. New:
> > Verner,
> >
> > This is a problem with NFS and 2.6 kernels, fast server NICs and
> > comparatively slower client NICs. This will show up when the server has
> > a 1000Mb card and the client a 100Mb, or when the server has a 100Mb
> > card and the client a 10Mb.
> >
> > Essentially, you have to pass some options to the kernel on terminal
> > boot, and this varies depending on whether you are using etherboot or
> > PXE.
> >
> > See
> > http://wiki.ltsp.org/twiki/bin/view/Ltsp/NFS#NFS_Server_not_responding
> > for a deeper explanation of the problem and the cure.
//注:原因是server机和目标机网卡传输速率冲突,使得目标机需要大量时间复制大量数据包,其实如果目标机的网卡速率够大,则不用分那么多包,也不会冲突。

posted @ 2016-09-02 16:43  Qiengo  阅读(442)  评论(0编辑  收藏  举报