找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5727|回复: 0
打印 上一主题 下一主题
收起左侧

让arm开发板文件系统中的mnt文件夹可以显示linux虚拟机中的某一个文件夹成为挂载

[复制链接]
跳转到指定楼层
楼主
ID:85109 发表于 2015-7-8 22:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
要严格区分1主机59.68.190.113,2、虚拟机linux59.68.190.128,3,arm开发板文件系统59.68.190.100 1、挂载的步骤,首先是要启动虚拟机linux中的nfs网络服务用命令sudo /etc/init.d/nfs-kernel-server  restart,然后就用mount -t nfs -o nolock 59.68.190.128:/work/nfs_root/first_fs /mnt 来实现挂载,一开始我是在虚拟机中使用这个挂载命令,结果导致挂载的方向错了,直接导致自己将自己虚拟机中的/work/nfs_root/first_fs文件夹内容,传递给了自己虚拟机中的/mnt 文件夹这样是不对的
2、修改方法,主机上面打开串口超级终端软件,将开发板内核启动,上面会看到#,这里可以写入命令
mount -t nfs -o nolock 59.68.190.128:/work/nfs_root/first_fs /mnt,这样才是将远程的 59.68.190.128:/work/nfs_root/first_fs中的内容传递给开发板的 /mnt 文件夹,在这个文件夹中可以用ls查看是否挂载成功。
3、关于如何卸掉挂载,用umount命令,可以用man umount来查看其用法,umount /mnt,就可以卸载掉你所挂上去的内容
关于挂载的几个问题以及解决方法。服务器server和客户端client的配置问题

嵌入式开发板 中nfs 出现问题permission denied的问题

解决方法:
去看下你的服务启动了没,客户端需要portmap服务,服务器端需要portmap、nfs服务。具体做法:
客户端:/etc/init.d/portmap start
服务器端:/etc/init.d/portmap start
/etc/init.d/nfs start
另外/etc/exports配置文件要正确,以下供你参考:
假设你的导出目录是/share,配置文件可以写成
/share *(rw,sync,no_root_squash)


一些关于挂载解决问题的方法分析

#sudo apt-get install nfs-kernel-server

打开/etc/exports文件,

 sudo vi  /etc/exports在末尾加入:

/work/nfs_root/file_sys_yl *(rw,sync,no_root_squash)

其中的file_sys_yl就是新添加的挂载目录

注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:

/work/nfs_root/file_sys_yl:要共享的目录

* :允许所有的网段访问

rw :读写权限

sync:资料同步写入内在和硬盘

no_root_squash:nfs客户端共享目录使用者权限

重启服务:
sudo /etc/init.d/portmap restart                  <---重启portmap,
sudo /etc/init.d/nfs-kernel-server restart      <---重启nfs服务
showmount -e                                          <---显示共享出的目录

注:nfs是一个RPC程序,使用它前,需要映射好端口,通过portmap设定

命令执行情况如下:

kevin@ubuntu:~$sudo /etc/init.d/portmap restart

rtmap restart

Rather than invoking init scripts through /etc/init.d, use the service(8)

utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an

Upstart job, you may also use the restart(8) utility, e.g. restart portmap

 

portmap start/running, process 742


kevin@ubuntu:~$sudo /etc/init.d/nfs-kernel-server restart
 
 * Stopping NFS kernel daemon

   ...done.

 * Unexporting directories for NFS kernel daemon...

   ...done.

 * Exporting directories for NFS kernel daemon...

exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/work/nfs_root".

  Assuming default behaviour ('no_subtree_check').

  NOTE: this default has changed since nfs-utils version 1.0.x


exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/work/nfs_root/first_fs".

  Assuming default behaviour ('no_subtree_check').

  NOTE: this default has changed since nfs-utils version 1.0.x


   ...done.

 * Starting NFS kernel daemon

   ...done.


kevin@ubuntu:~$showmount -e

Export list for book-desktop:

/work/nfs_root/first_fs *

 

/work/nfs_root          *

现在可以在本机上试一下:
#sudo mount -t nfs localhost:/home/kevin /mnt

注:localhost为本机linux的IP地址

这样就把共享目录挂到了/mnt目录,取消挂载用:
#sudo umount /mnt

如果用在嵌入式设备上挂载,要加上参数-o nolock

我在开发板上使用的挂载命令:

mount -t nfs -o nolock 59.68.190.128:/work/nfs_root/first_fs /mnt

,这样就能在开发板上面查看到自己虚拟机中的文件了,

有一个问题就是找了很长时间,其实是/work/nfs_root/first_fs这个文件夹写错了,悲剧的我为了这一个错误找了一上午

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表