当前位置首页 > Ubuntu知识

Ubuntu14.04安装配置NFS

阅读次数:402 次  来源:admin  发布时间:

(一)安装NFS服务器

udo apt-get install nfs-kernel-server

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

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

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

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

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

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

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

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

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

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

udo service rpcbind restart

2.3-重启nfs服务:

udo service nfs-kernel-server restart

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

howmount -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 nf

在目标板上通过NFS复制PC机上较大文件到目标板上的时候遇到的问题:

fs: server *** not responding, still trying

修改方法:

fs 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:

gt; Mandag 27 november 2006 19:33 skrev John P. New:

gt; > Verner,

gt; >

gt; > This is a problem with NFS and 2.6 kernels, fast server NICs and

gt; > comparatively slower client NICs. This will show up when the server ha

gt; > a 1000Mb card and the client a 100Mb, or when the server has a 100M

gt; > card and the client a 10Mb.

gt; >

gt; > Essentially, you have to pass some options to the kernel on terminal

gt; > boot, and this varies depending on whether you are using etherboot or

gt; > PXE.

gt; >

gt; > See

gt; > http://wiki.ltsp.org/twiki/bin/view/Ltsp/NFS#NFS_Server_not_responding

gt; > for a deeper explanation of the problem and the cure.

//注:原因是server机和目标机网卡传输速率冲突,使得目标机需要大量时间复制大量数据包,其实如果目标机的网卡速率够大,则不用分那么多包,也不会冲突。

上一篇:翻译Debian软件包简介信息
下一篇:Ubuntu12.04下NFS安装配置图解