Ubuntu 14.04安装配置NFS

本文详细介绍如何在Linux系统中安装并配置NFS服务器,包括安装NFS服务器软件包、设置共享目录、配置NFS服务文件及重启服务等步骤,并提供了解决NFS挂载时可能出现的延迟问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(一)安装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机和目标机网卡传输速率冲突,使得目标机需要大量时间复制大量数据包,其实如果目标机的网卡速率够大,则不用分那么多包,也不会冲突。

转载于:https://www.cnblogs.com/qiengo/p/5834052.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值