ARM busybox连接NFS

<

div id=”content” contentScore=”2416″>主要步骤:
1  在PC上,建立NFS服务器。
2  在PC上,确认NFS服务器正确。
3  telent上ARM板busybox, mount -t nfs -o nolock 10.0.2.130:/export /home

建立NFS服务器
1  假设防火墙已经关闭
2  安装yum install nfs-utils.i686
3  安装yum install rpc2 (我实验时,已经安装过了,这是一个很基本的服务)
4  vi /etc/idmapd.conf
[General]
Domain = localdomain        # 用dnsdomainname得到,search “Linux: find out information about current domain name and host name”

[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
5  启动nfs(nfs相关服务为rpcbind,一般都正常,不用管)
    systemctl enable nfs-server.service
    systemctl start nfs-server.service
6  mkdir -p /export/{share1,share2,share3}
    sudo chmod -R a+rwx /export    # 我不想碰到权限问题,将权限开到最大
7  vi /etc/export
/export        127.0.0.1(ro,sync)
/export        10.0.2.0/255.255.255.0(rw,sync,insecure,no_root_squash)
/home/hl/temp  10.0.2.131(rw,sync,insecure,no_root_squash)
/home/hl/temp  10.0.2.132(rw,sync,insecure,no_root_squash)
    /home/hl/temp 要有777权限,这里允许整个10.0.2.*段访问,ip段有3种写法:
    single host
    wildcards  *.example.com
    IP networks  192.168.0.0/28 allows the first 16 IP addresses, from 192.168.0.0 to 192.168.0.15, to access the exported file system, but not 192.168.0.16 and higher.
8  exportfs -rv    # nfs重读配置

PC端NFS客户端配置
因为服务器和客户端都在一台机器上,没什么好配置的。
以root用户登录
sudo mount -t nfs 127.0.0.1:/ 这时应该出来可以mount的目录
sudo mount -t nfs 127.0.0.1:/export /mnt
umount /mnt
sudo mount -t nfs 10.0.2.130:/export /mnt  # 如果不成功,要看ip是否正确。

ARM板busybox
当然,内核、busybox编译时,都要支持nfs。
不需要配置,唯一注意的是,需要-o nolock选项。
mount -t nfs -o nolock 10.0.2.130:/export /home
mount -t nfs -o nolock 10.0.2.130:/home/hl/temp /home

note:
1  服务器上,export出去的目录,nfsnobody用户要有相应的权限。最简单的是给777权限。
    例如:/home/hl/temp,temp要有777权限。但/home/hl无需设置。
2  ARM、Fedora輯div>