全部博文(395)
分类: LINUX
2011-07-19 18:13:42
NFS功能的添加步骤:
一、首先添加模块
# 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!
WARNING: "crypto_mod_put" [crypto/pcbc.ko] undefined!
WARNING: "crypto_blkcipher_type" [crypto/pcbc.ko] undefined!
WARNING: "crypto_alloc_instance" [crypto/pcbc.ko] undefined!
WARNING: "crypto_get_attr_alg" [crypto/pcbc.ko] undefined!
WARNING: "crypto_free_tfm" [crypto/pcbc.ko] undefined!
WARNING: "crypto_spawn_tfm" [crypto/pcbc.ko] undefined!
WARNING: "crypto_unregister_template" [crypto/pcbc.ko] undefined!
WARNING: "crypto_register_template" [crypto/pcbc.ko] undefined!
WARNING: "crypto_drop_spawn" [crypto/pcbc.ko] undefined!
WARNING: "crypto_mod_put" [crypto/pcbc.ko] undefined!
WARNING: "crypto_blkcipher_type" [crypto/pcbc.ko] undefined!
WARNING: "crypto_alloc_instance" [crypto/pcbc.ko] undefined!
WARNING: "crypto_get_attr_alg" [crypto/pcbc.ko] undefined!
WARNING: "crypto_free_tfm" [crypto/pcbc.ko] undefined!
WARNING: "crypto_spawn_tfm" [crypto/pcbc.ko] undefined!
WARNING: "blkcipher_walk_done" [crypto/pcbc.ko] undefined!
WARNING: "blkcipher_walk_virt" [crypto/pcbc.ko] undefined!
三、在确保以上步骤都正确无误后,测试是否能挂载
mount -t nfs 192.168.5.139:/home/howard/Howard /mnt
192.168.5.139 为本机地址
(1)若出现错误:failed: RPC Error: Program not registered
错误原因是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中添加误/home/howard/Howard *(rw,sync,no_root_squash) 然后保存退出。
/home/howard/Howard就表示共享目录,前面三位是你主机的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 192.168.5.139:/home/howard/Howard /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机要配在同一个网段