配置:vmware中安装Ubuntu10.04系统:windows XP连接:开发板通过RS232和交叉网线与PC相连
方法如下:一、虚拟机设置(如果网络已经设置在桥接方式,跳过这步)1、在启动ubuntu前,
将其Ethernet(网络)连接方式设为Bridge(桥接方式)2、启动ubuntu,设置静态ip地址(必须与开发板处于同一网段)lingd@ubuntu:~$
sudo ifconfig eth0 192.168.0.26 netmask 255.255.255.0二、为ubuntu安装NFS1、安装NFSlingd@ubuntu:~$
sudo apt-get install nfs-kernel-server同时会有两个软件包nfs-common和portmap被安装上2.修改NFS配置文件lingd@ubuntu:~$
vi /etc/exports内容为:
/home/lingd/arm 192.168.0.*(rw,sync,no_root_squash,no_subtree_check) /home/lingd/arm---要共享的目录 192.168.0.*---允许访问的网段,也可以是ip地址、主机名(能够被服务器解析)、*(所有人都能访问) (rw,sync,no_root_squash,no_subtree_check)---rw:读/写权限 sync:数据同步写入内存和硬盘 no_root_squash:服务器允许远程系统以root特权存取该目录no_subtree_check:关闭子树检查其他选项可以通过man exports查阅man文档
3、启动服务重启portmapper(端口映射)服务lingd@ubuntu:~$
sudo service portmap restartportmap start/running, process 550重启NFS服务lingd@ubuntu:~$
sudo service nfs-kernel-server restart * Stopping NFS kernel daemon [ OK ] * Unexporting directories for NFS kernel daemon... [ OK ] * Exporting directories for NFS kernel daemon... [ OK ] * Starting NFS kernel daemon [ OK ]
三、测试1、本机挂载lingd@ubuntu:~$
ls /mnt/nfs/lingd@ubuntu:~$
sudo mount -t nfs -o nolock localhost:/home/lingd/arm/ /mnt/nfs/lingd@ubuntu:~$
ls /mnt/nfs/cross-3.4.1.tar.bz2 linux-2.6.12 uploaddownload msap VMwareTools-8.1.3-203739.tar.gzDSDT_2[1].8b.zip ntp vmware-tools-distribDSDT_2.8b protocol-converter 安装包lingd@ubuntu:~$
sudo umount /mnt/nfs lingd@ubuntu:~$
ls /mnt/nfs/2、开发板挂载lingd@ubuntu:~$
telnet 192.168.0.25 2009Trying 192.168.0.25...Connected to 192.168.0.25.Escape character is "^]".
(none) login: rootPassword: ~ #
ls /mnt ext1 ext2~ #
mount -t nfs -o nolock 192.168.0.26:/home/lingd/arm /mnt~ #
ls /mntDSDT_2.8b msapDSDT_2[1].8b.zip ntpVMwareTools-8.1.3-203739.tar.gz protocol-convertercross-3.4.1.tar.bz2 uploaddownload vmware-tools-distriblinux-2.6.12 安装包~ #
umount /mnt~ #
ls /mntext1 ext2~ #
四、挂载nfs文件系统失败的原因1、nfs错误信息
Too many levels of remote in path:试图挂载一个存在的文件系统
Permission denied:NFS服务器不让客户机挂接,也可能是因为用户在服务器上不存在
No such host:通常是DNS配置错误
No such file or directory:通常是访问的目录不存在
NFS server is not responding:通常是NFS已经超过负载或者NFS已经停止工作
Stale file handle:在NFS客户端关闭之前客户端访问的文件被删除
Fake hostname:Forward和reverse的DNS记录在NFS客户端下不存在2、挂载nfs文件系统失败的原因(1)主机和网络不通:看看网线连接、主机和开发板ip是否在同一网段、防火墙有没有关闭等。
不仅vmware中linux的防火墙要关闭,vmware外xp的防火墙也要关闭,我就因为xp中的eset杀毒软件的防火墙使nfs无法挂载(可以挂本机,无法挂远程),折腾了一天,后来才发现是xp中的防火墙搞的鬼!
(2)使用的mount命令不正确。可以参照上面的例子改一下;或者
man nfs查阅一下nfs的man文档,里面有nfs中mount的使用介绍和选项解释
(3)nfs配置文件/etc/exports配置不正确。可以参照上面的例子改一下;或者
man exports查阅一下/etc/exports的man文档(4)必要时重新启动NFS和portmap服务。sudo service portmap restartsudo service nfs-kernel-server restart
(5)内核不支持NFS和RPC服务(可能需要重新配置、编译、烧写内核)。普通的内核应有的选项为CONFIG_NFS_FS=m、CONFIG_NFS_V3=y、CONFIG_ NFSD=m、CONFIG_NFSD_V3=y和CONFIG_SUNRPC=m。
rpcinfo命令用于显示系统的RPC信息,一般使用-p参数列出某台主机的RPC服务。rpcinfo -p命令检查服务器时,应该能看到portmapper、status、mountd、nfs和nlockmgr。用该命令检查客户端时,应该至少能看到portmapper服务(开发板可能不带该命令)。
由rpcinfo -p可知,nfs使用的port为2049,portmapper使用111port。五、nfs相关的配置文件与命令1、
/etc/exportsNFS的主要配置文件,不过系统并没有默认值,所以这个文件不一定会存在(需要自己建立)。
2、
/usr/sbin/exportfs用于维护NFS共享资源的命令,用在nfs server端。修改/etc/exports后,只要使用exportfs重新扫瞄一次 /etc/exports,重新将设定加载即可,并不一定要重启nfs服务命令格式: exportfs [-aruv]参数说明如下。(1)-a:全部挂载或卸载(export or unexpect)/etc/exports文件内的目录。(2)-r:重新挂载(reexport)/etc/exports中的目录,并将/var/lib/nfs/etab中的内容与/etc/exports同步。(3)-u:卸载某些目录。(4)-v:显示exportfs处理信息。
3、
/usr/sbin/showmount用于查看指定主机NFS共享出来的目录资源,主要用在Client端。命令格式: showmount [-ade] hostname/服务器ip地址参数说明如下。(1)-a或-all:以host:dir格式显示客户主机名和挂载的目录。(2)-d或-directories:仅显示被客户挂载的目录名。(3)-e或-exports:显示指定NFS服务器的nfs共享目录。
4、
/var/lib/nfs/etab/etc/exports里列举的是用户希望nfs共享的目录,而/var/lib/nfs/etab里面是ubuntu实际共享的目录。它记录了NFS所共享出来的目录的完整权限设定值。/var/lib/nfs/etab由exportfs维护,每次exportfs都会扫描/etc/exports以建立新的/var/lib/nfs/etab,每当nfs客户请求挂载共享目录时mountd都会读取该文件以检测客户和目录的权限。同时/var/lib/nfs/etab中共享的目录会保存在内核nfs共享表(export table)中
5、其他nfs相关文件的解析
/var/lib/nfs/etab contains information about what filesystems should be exported to whom at the moment.
/var/lib/nfs/rmtab contains a list of which filesystems actually are mounted by certain clients at the moment.
/proc/fs/nfs/exports contains information about what filesystems are exported to actual client (individual, not subnet or whatever) at the moment.
/var/lib/nfs/xtab is the same information as /proc/fs/nfs/exports but is maintained by nfs-utils instead of directly by the kernel. It is only used if /proc isn"t mounted.*
/var/lib/nfs/etab: the /etc/exports file only contains a wish list. etab is created by exportfs. It contains on each line detailed information about the options used when exporting a file system towards a single client. It"s the reference file used by rpc.mountd when started*
/proc/fs/nfs/exports contains the clients list as known by the kernel*
/var/lib/nfs/xtab: Use for accuracy when etab holds client names and machines groups with wildcards. This file only contains explicit machine names.*
/var/lib/nfs/rmtab : each line shows the client"s name and the file system imported from this server;Linux进程控制——exec函数族虚拟机VirtualBox中Ubuntu无法全屏解决方法相关资讯 ubuntu安装
- Linux系统教程:如何通过代理服务 (03月17日)
- MacBook Air 安装 Ubuntu 双系统 (01/27/2015 16:21:32)
- Ubuntu 12.04中安装Qt SDK 1.2.1图 (11/24/2012 13:19:21)
| - Linux系统入门教程: 当使用代理服 (11/08/2015 09:04:46)
- Ubuntu安装到移动硬盘 & grub (02/05/2014 19:52:51)
- Ubuntu 下安装字体的方法 (07/12/2012 08:56:50)
|
本文评论 查看全部评论 (0)