ubuntu12.04下NFS服务器建设

来源:互联网 发布:网络语言233是什么意思 编辑:程序博客网 时间:2024/06/01 08:15
服务端环境:ubuntu12.04
开发板环境:fs2410开发板、移植linux2.6.28.6内核

1、安装NFS服务
#sudo apt-get install nfs-kernel-server

2、配置
打开/etc/exports文件,在末尾加入:

/source *(rw,sync,no_root_squash)

注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:

/source:要共享的目录

* :允许所有的网段访问

rw :读写权限

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

no_root_squash:nfs客户端共享目录使用者权限

3、重启服务
#sudo /etc/init.d/portmap restart                <---重启portmap-->
#sudo /etc/init.d/nfs-kernel-server restart      <---重启nfs服务-->
#showmount -e                                    <---显示共享出的目录-->

4、测试
在本机上试一下:
#sudo mount -t nfs 127.0.0.1:/source /mnt
#ls -l /mnt
 <---会显示/source路径的文件>
取消挂载用:
#sudo umount /mnt

开发板上挂载
# mount -t nfs -o nolock 192.168.2.100:/source /mnt
如果出现如下错误:
mount: mounting 192.168.2.100:/source on /mnt failed: Protocol not supported
原因:
   开发板上移植的linux系统不支持 NFS 客户端:
方法:
   重启编译内核,开启 NFS 客户端
make menuconfig
添加如下配置,选中
File system--->
[*]Network File Systems --->
<*> NFS client support
[*] NFS client support for NFS version 3
重新编译内核







0 0
原创粉丝点击