Aimer平台nfs支持

1410阅读 0评论2014-12-09 longjiacheng
分类:LINUX

ak3918摇头机开发板实现开发板与linux服务器之间实现nfs挂载的方法与操作步骤

我的linux开发环境是Ubuntu 10.04,以下是基于Ubuntu 10.04下NFS服务器的搭建

一、Ubuntu 10.04下NFS服务器的搭建 
第一步:安装nfs服务器
             sudo apt-get install nfs-kernel-server
第二步:配置NFS服务器
             sudo vim /etc/exports
内容如下:

# /etc/exports: the access control list for filesystems which may be exported
#       to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,     no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/home/anyka/nfs_root  *(rw,sync,no_root_squash)                                //主要是加上这句话

第三步:在根目录下创建文件夹 /home/anyka/nfs_root                     //此文件夹用于与开发板共享的

第四步:重启NFS服务

             sudo /etc/init.d/nfs-kernel-server   restart

第五步:测试,在ak3918摇头机开发板的测试

    测试之前要配置内核,使之能够支持nfs挂载,具体操作如下:
    在内核目录下make menuconfig
File systems  ---> 

        Network File Systems  ---> 

            <*> NFS file system support                        ## 必选

                [*]   Provide NFSv3 client support             ## 可选

            [*] Root file system on NFS                        ## 必选

    Networking  ---> 

        [*] Networking support 

            Networking options  ---> 

                [*]   IP: kernel level autoconfiguration       ## 必选


    确认以上选上,退出,保存,然后make zImage,将生成的zImage重新烧录,

注意:开发板与linux服务器共处同一网段,并且能互相ping通

3、上电启动之后,通过串口命令输入:
        mount -t nfs 192.168.1.100:/home/anyka/nfs_root /mnt/
        如若提示mount: mounting 192.168.1.100:/home/anyka/nfs_root on /mnt/ failed: Connection refused
        命令加上“- o”即可
        完整的命令就是:

        mount -o nolock -t nfs 192.168.1.100:/home/anyka/nfs_root /mnt/
    
              ls  /mnt/                                //查看是否挂载成功
4、如果卸载:
              umount  /mnt/nfs


下面是ubuntu下面全部操作记录:
1、软件包安装
apt-get install portmap <-------------客户端和服务器的安装
#apt-get install nfs-kernel-server 
#apt-get install nfs-common

2、创建共享目录
mkdir -p /nfs

3、修改端口文件
vi /etc/export 
增加如下内容:
eg:
自己的PC:
/work/temp/uart_test/uart_test_2015/uart_test 192.168.1.*(rw,sync,no_root_squash)
/work 192.168.1.*(rw,sync,no_root_squash)
arm:
/nfs  *(rw,sync,no_root_squash)

4、修改端口允许
s udo vi /etc/hosts.allow
eg:
ALL: 192.168.1.*          这步很重要,这个没设对会有Input/output error


5、重启服务
sudo service nfs-kernel-server restart

6、查看服务启动是否成功(即查看  /etc/exports 增加nfs可用目录路径):
PC主机:showmount -e
ARM: showmount -e localhost 

7、nfs挂着远程目录到本地
mount -o nolock 192.168.1.128:/work /mnt/

---------------------------------------------------------------
showmount -e 查看可用的nfs目录
sudo vim /etc/exports 增加nfs可用目录路径
eg:
/work/EMB-PMMB01/uart_test 192.168.1.*(rw,sync,no_root_squash)
/work/temp/jdcomnew_ 192.168.1.*(rw,sync,no_root_squash)

上一篇:error while loading shared libraries: xxx.so.x"错误的原因和解决办法
下一篇:Aimer平台 + 8188 wifi通道支持实现 (认证篇)