ralink APSOC NFS功能的添加步骤

http://blog.chinaunix.net/space.php?uid=25100840&do=blog&id=1744971

一、首先添加模块

  # make menuconfig

 Kernel/Library/Defaults Selection  --->

   [*] Customize Kernel Settings

     Networking  --->

       Networking options  --->

         [*]   IP: kernel level autoconfiguration

      File systems  --->

       Network File Systems  --->

             <*> NFS file system support                                                                       

             [*]   Provide NFSv3 client support                                                                  

             [*]     Provide client support for the NFSv3 ACL protocol extension                             

             [*]   Provide NFSv4 client support (EXPERIMENTAL)                                                 

             [*]   Allow direct I/O on NFS files  

      Kernel/Library/Defaults Selection  --->

        [*] Customize Busybox Settings

             Linux System Utilities  --->

[*] mount

[*]   Support mounting NFS file systems

 二、以上都添加完之后,运行make dep 和 make ,查看是否添加模块正确,若有一下错误则需做如下修改

 # make menuconfig

 Kernel/Library/Defaults Selection  --->

   [*] Customize Kernel Settings

            Cryptographic options  --->

<*>   ECB support

                   <*>   PCBC support

WARNING: "crypto_unregister_template" [crypto/pcbc.ko] undefined!

WARNING: "crypto_register_template" [crypto/pcbc.ko] undefined!

WARNING: "crypto_drop_spawn" [crypto/pcbc.ko] undefined!

 三、在确保以上步骤都正确无误后,测试是否能挂载

     mount -t nfs -o nolock,rw,tcp,nfsvers=3 10.10.10.3:/root/sharedfs /mnt

(1)若出现错误:failed: RPC Error: Program not registered 

重启RPC服务器:

错误原因是home主机上nfs服务被中断,重新开启home的nfs服务然后在客户端重新执行mount命令即可
service nfs restart 或 /etc/rc.d/init.d/nfs restart
(2)若出现错误: mount.nfs: access denied by server while mounting 192.168.5.139:/home/howard  则需要将你的虚拟机做一下配置:

① 首先在vim /etc/exports中 /root/sharedfs *(rw,sync,no_root_squash)  然后保存退出。

       /root/sharedfs 就表示共享目录,前面三位是你主机的ip地址, rw:读/写权限,只读权限的参数为ro;  

sync:数据同步写入内存和硬盘,也可以使用async,此时数据会先暂存于内存中,而不立即写入硬盘。 no_root_squash:NFS 服务器共享目录用户的属性,如果用户是 root,那么对于这个共享目录来说就具有 root 的权限。

② 然后启动端口映射: # /etc/rc.d/init.d/portmap start(如果说找不到,就执行 #/etc/init.d/portmap start) 如果这一步不成功,最后也连接不上了。
启动NFS 服务: # /etc/rc.d/init.d/nfs start(又找不到,执行 # /etc/init.d/nfs start或# /etc/init.d/nfs-kernel-server start)
这两项执行成功 的话,就会显示[ok]

③  最后再执行:mount -t nfs -o nolock,rw,tcp,nfsvers=3 10.10.10.3:/root/sharedfs /mnt

最后执行:#ls /mnt

 #mount 

则会显示以下挂载信息:

192.168.5.139:/home/howard/Howard/ on /mnt type nfs (rw,addr=192.168.5.139)

 

四、测试NFS

① 将编译好的内核通过tftp刷到板子上进行NFS测试

② 在主机上启动NFS服务:service nfs start(restart)

              关闭防火墙:service iptables stop

③ cavium机器执行:

            #mount -o nolock 192.168.5.139:/home/howard/Howard /mnt

④ 在主机的/home/howard/Howard目录下建一文件:例  yangxuan.txt

⑤ 在 cavium机下进入主机的/home/howard/Howard目录中,

  #cd /home/howard/Howard

  #ls

  #cat yangxuan.txt

# cat yangxuan.txt

  PID TTY          TIME CMD

 9797 pts/1    00:00:00 bash

26818 pts/1    00:00:00 ps 

yangxuan yajhuriosaehfiukghjnvjxsgrk

注:

1)        添加TFTP功能

2)        主机和cavium机要配在同一个网段

常见错误:

 Please reference the diagnose log .

Red Hat Enterprise Linux ES release 3 (Taroon Update 3)
Kernel 2.4.21-40.ELsmp on an i686
welcome to 10.150.4.18
login: foxadm
Password:
Last login: Fri Aug 10 15:15:00 from 10.134.28.133
[foxadm@dbaweb foxadm]$ telnet 10.130.14.34
Trying 10.130.14.34...
Connected to 10.130.14.34 (10.130.14.34).
Escape character is '^]'.
Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
Kernel 2.6.9-22.ELsmp on an x86_64
login: root
Password:
Last login: Sat Aug 11 11:42:11 from 10.148.53.63
You have new mail.
Hi
cnsbgctbs</root>#
cnsbgctbs</root>#
cnsbgctbs</root>#exportfs -v
/exp/ware     hstest(rw,async,wdelay,root_squash)
/exp/4.25bak  <world>(rw,wdelay,root_squash)
cnsbgctbs</root>#df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p1     10317828   6174372   3619340  64% /
/dev/cciss/c0d0p5    103210940  29794928  68173204  31% /dbspace1
/dev/cciss/c0d0p3    103210972  15777500  82190660  17% /dbspace2
none                   2020892         0   2020892   0% /dev/shm
/dev/cciss/c0d0p8    362234144 108223444 235610256  32% /exp
/dev/cciss/c0d0p2    103210972     93852  97874308   1% /hist
/dev/cciss/c0d0p6     15116836  10604324   3744608  74% /u
cnsbgctbs</root>#ps -ef|grep nfs
root      2431  2391  0 14:40 pts/4    00:00:00 grep nfs
cnsbgctbs</root>#service nfs status
Shutting down NFS mountd: rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
cnsbgctbs</root>#ps -ef|grep rpc
root      2764     1  0 Jun20 ?        00:00:16 rpc.idmapd
root     26122     1  0 11:40 ?        00:00:00 rpc.idmapd
root      2455  2391  0 14:41 pts/4    00:00:00 grep rpc
cnsbgctbs</root>#kill  -9 2764 26122
cnsbgctbs</root>#service nfs restart
Shutting down NFS mountd:                                  [FAILED]
Shutting down NFS daemon:                                  [FAILED]
Shutting down NFS quotas:                                  [FAILED]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Co
nnection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
                                                           [FAILED]
Starting NFS daemon:

cnsbgctbs</root>#
cnsbgctbs</root>#service nfs stop
Shutting down NFS mountd:                                  [FAILED]
Shutting down NFS daemon:                                  [FAILED]
Shutting down NFS quotas:                                  [FAILED]
Shutting down NFS services:                                [  OK  ]
cnsbgctbs</root>#ps -ef|grep nfs
root      2550     1  0 14:41 pts/4    00:00:00 rpc.nfsd 8
root      2588  2391  0 14:42 pts/4    00:00:00 grep nfs
cnsbgctbs</root>#kill  -9 2550
cnsbgctbs</root>#ps -ef|grep nfs
root      2550     1  0 14:41 pts/4    00:00:00 rpc.nfsd 8
root      2596  2391  0 14:42 pts/4    00:00:00 grep nfs
cnsbgctbs</root>#uptime
14:42:28 up 51 days, 23:21,  4 users,  load average: 0.60, 0.30, 0.16
cnsbgctbs</root>#cd /etc/init.d
cnsbgctbs</etc/init.d>#service portmap status
portmap dead but subsys locked
cnsbgctbs</etc/init.d>#ps -ef |grep port
root      2831  2391  0 14:44 pts/4    00:00:00 grep port
cnsbgctbs</etc/init.d>#rpcinfo
Usage: rpcinfo [ -n portnum ] -u host prognum [ versnum ]
       rpcinfo [ -n portnum ] -t host prognum [ versnum ]
       rpcinfo -p [ host ]
       rpcinfo -b prognum versnum
       rpcinfo -d prognum versnum
cnsbgctbs</etc/init.d>#rpcinfo -p cnsbgctbs
rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused
cnsbgctbs</etc/init.d>#./portmap start
Starting portmap:                                          [  OK  ]
cnsbgctbs</etc/init.d>#rpcinfo -p cnsbgctbs
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
cnsbgctbs</etc/init.d>#service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
cnsbgctbs</etc/init.d>#exportfs -v
/exp/ware       hstest(rw,async,wdelay,root_squash)
/exp/4.25bak    <world>(rw,wdelay,root_squash)
cnsbgctbs</etc/init.d>#ls

你可能感兴趣的:(ralink APSOC NFS功能的添加步骤)