Linux NFS文件系统挂载
一般情况下,都是虚拟机Linux系统挂载开发板方便进行应用程序的调试,或者反过来进行挂载。但是我们需要开发板之间相互挂载进行数据传输。
虚拟机之间挂载
环境:Ubuntu 18.04与CentOS 7之间挂载
方法:CentOS作为 NFS 客户端透明地读写位于Ubuntu 端 NFS 服务器上的文件,就像访问本地文件一样。
Ubuntu 服务端
sudo apt-get install nfs-kernel-server #安装 NFS 服务
查看内核是否支持nfs
查看nfs进程是否启动,主要看nfsd
卸载nfs-kernel-server后nfsd进程会关闭掉,其他的配置不会变化
接着用管理员权限(sudo)打开 ubuntu 中/etc/exports 文件,在末尾添加:/home/user/ *(rw,sync,no_root_squash)
sudo /etc/init.d/nfs-kernel-server restart #重启 NFS 服务,使之前配置生效【这里需要被挂载的目录存在否则会服务不能启动】
showmount -e #查看修改是否生效
查看ubuntu ip地址
CentOS 客户端
mkdir /mnt/nfs #建立一个名为“nfs”的目录,用于挂载 ubuntu 共享的 nfs 文件夹
挂载命令:
[yubo.wang@localhost ~]$ sudo mount -t nfs -o nolock 192.168.201.131:/home/logread/nfs /mnt/nfs
查看挂载:
192.168.201.131:/home/logread/nfs on /mnt/nfs type nfs4 (rw,relatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.201.130,local_lock=none,addr=192.168.201.131)
虚拟机和开发板之间挂载
草稿
8、安装NFSapt-get purge rpcbindapt-get install nfs-kernel-server nfs-commonvim /etc/exports加入/home/yubo.wang/nfsroot *(rw,sync,no_root_squash,no_subtree_check) mkdir nfsrootsudo /etc/init.d/nfs-kernel-server restart[sudo] password for yubo.wang: * Stopping NFS kernel daemon [ OK ] * Unexporting directories for NFS kernel daemon... [ OK ] * Exporting directories for NFS kernel daemon... [ OK ] * Starting NFS kernel daemon [ OK ]yubo.wang@ubuntu:~$ showmount -eExport list for ubuntu:/home/yubo.wang/nfsroot *开发板挂载服务器:mount -t nfs -o nolock 192.168.1.50:/home/yubo.wang/nfsroot /yubo.wang问题: 服务器不能ping通开发板WAN/LAN0,能ping通电脑无线网卡,不能ping通互联网和电脑有线网卡原因:有线网络和无线网共存时,ping默认是走有线网络,所以需要把无线网络禁用root@ubuntu:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:34:4b:95 inet addr:192.168.1.50 Bcast:192.168.1.255 Mask:255.255.255.0root@ZhuoTK:/# ifconfig
br-lan Link encap:Ethernet HWaddr 00:CA:2F:07:0F:C6 inet addr:192.168.1.251 Bcast:192.168.1.255 Mask:255.255.255.0以太网适配器 以太网:连接特定的 DNS 后缀 . . . . . . . :本地链接 IPv6 地址. . . . . . . . : fe80::f0f0:40f7:a883:6c2%14IPv4 地址 . . . . . . . . . . . . : 192.168.1.123子网掩码 . . . . . . . . . . . . : 255.255.255.0默认网关. . . . . . . . . . . . . : 192.168.1.1root@ZhuoTK:/# mount -t nfs -o nolock 192.168.1.50:/home/yubo.wang/nfsroot /yubo.wang192.168.1.50:/home/yubo.wang/nfsroot on /yubo.wang type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.50,mountvers=3,mountproto=tcp,local_lock=all,addr=192.168.1.50)192.168.1.50:/home/yubo.wang/nfsroot47.1G 22.0G 22.7G 49% /yubo.wang开发板挂载服务器:
mount -t nfs -o nolock 192.168.1.251:/yubo.wang /root/nfs< > NFS client support< > NFS server supportnodev nfsroot@ZhuoTK:/# ps |grep nfs630 root 0 SW< [nfsiod]1398 root 1488 S grep nfs
root@ZhuoTK:/# ps |grep rpc609 root 0 SW< [rpciod]820 root 1568 S /sbin/rpcd1400 root 1488 S grep rpcroot@ZhuoTK:/# opkg install /tmp/nfs-kernel-server_1.3.2-3_ramips_24kec.ipk
Installing nfs-kernel-server (1.3.2-3) to root...
Collected errors:* satisfy_dependencies_for: Cannot satisfy the following dependencies for nfs-kernel-server:* libwrap * libblkid * librpc * kmod-fs-nfsd * portmap * * opkg_install_cmd: Cannot install package nfs-kernel-server.root@ZhuoTK:/tmp# opkg install nfs-kernel-server_1.3.2-3_ramips_24kec.ipk
Installing nfs-kernel-server (1.3.2-3) to root...
Configuring nfs-kernel-server.
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/mnt/nfs/".Assuming default behaviour ('no_subtree_check').NOTE: this default has changed since nfs-utils version 1.0.xexportfs: /mnt/nfs does not support NFS export
Collected errors:* resolve_conffiles: Existing conffile /etc/exports is different from the conffile in the new package. The new conffile will be placed at /etc/exports-opkg.no_subtree_check
/mnt *(ro,all_squash,insecure,sync,no_subtree_check)root@ZhuoTK:/tmp# opkg install nfs-kernel-server_1.3.2-3_ramips_24kec.ipk
Installing nfs-kernel-server (1.3.2-3) to root...
Configuring nfs-kernel-server.
exportfs: /mnt does not support NFS export 【这个错误怎么解?难道没有关系,查看ipk已经安装成功了的】
Collected errors:* resolve_conffiles: Existing conffile /etc/exports is different from the conffile in the new package. The new conffile will be placed at /etc/exports-opkg./mnt *(ro,all_squash,insecure,sync,no_subtree_check)* resolve_conffiles: Existing conffile /etc/exports is different from the conffile in the new package. The new conffile will be placed at /etc/exports-opkg.挂载失败
root@ubuntu:~# mount -t nfs -o nolock 192.168.1.251:/yubo.wang /root/aa
mount.nfs: access denied by server while mounting 192.168.1.251:/yubo.wangvi /etc/hosts127.0.0.1 localhostroot@ubuntu:/home/yubo.wang# mount -t nfs -o nolock 192.168.1.251:/yubo.wang /root/nfs
mount.nfs: access denied by server while mounting 192.168.1.251:/yubo.wangroot@ZhuoTK:~# nfsstat
Server rpc stats:
calls badcalls badfmt badauth badclnt
1 1 1 0 0 Server nfs v3:
null getattr setattr lookup access readlink
1 100% 0 0% 0 0% 0 0% 0 0% 0 0%
read write create mkdir symlink mknod
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
remove rmdir rename link readdir readdirplus
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
fsstat fsinfo pathconf commit
0 0% 0 0% 0 0% 0 0% Client rpc stats:
calls retrans authrefrsh
15 0 15 Client nfs v3:
null getattr setattr lookup access readlink
0 0% 6 42% 0 0% 0 0% 1 7% 0 0%
read write create mkdir symlink mknod
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
remove rmdir rename link readdir readdirplus
0 0% 0 0% 0 0% 0 0% 0 0% 1 7%
fsstat fsinfo pathconf commit
0 0% 4 28% 2 14% 0 0% 有连接过来,但是失败了,难道是防火墙导致问题的吗?root@ZhuoTK:~# /etc/init.d/firewall stop
Warning: Unable to locate ipset utility, disabling ipset support* Flushing IPv4 filter table* Flushing IPv4 nat table* Flushing IPv4 mangle table* Flushing IPv4 raw table* Flushing IPv6 filter table* Flushing IPv6 mangle table* Flushing IPv6 raw table* Flushing conntrack table ...启用SYN-flood防御 关闭不行/etc/init.d/firewall disableSat May 25 14:55:07 2019 daemon.notice rpc.mountd[1277]: authenticated mount request from 192.168.1.50:936 for /yubo.wang (/yubo.wang)
Sat May 25 14:55:07 2019 daemon.warn rpc.mountd[1277]: Cannot export /yubo.wang, possibly unsupported filesystem or fsid= requiredSat May 25 21:22:45 2019 daemon.notice rpc.mountd[1277]: authenticated mount request from 192.168.1.50:971 for /yubo.wang (/yubo.wang)
Sat May 25 21:22:45 2019 daemon.warn rpc.mountd[1277]: Cannot export /yubo.wang, possibly unsupported filesystem or fsid= required查看nfs server的/var/log/message:
Mar 30 14:53:07 sysimages mountd[6936]: Cannot export /panfs, possibly unsupported filesystem or fsid= required
Mar 30 14:54:04 sysimages kernel: Removing netfilter NETLINK layer.在NFS server的 /etc/exports文件里做如下改动 fsid = 0:/sdc *(rw,insecure,sync,insecure_locks,no_root_squash)
/panfs *(fsid=0,rw,insecure,sync,insecure_locks,no_root_squash)依然没用,重启还没用挂载卡住不动说明网络没有通,服务端rpc没有看到连接
参考:openwrt系统,作为路由器使用,跨网段nfs挂载共享目录【NO】
/etc/exports下最后行新增一行,不要修改原来的内容【NO】
网络连接方式改为桥接方式【已经是桥接方式】
开发板之间挂载
从了解到放弃
Linux NFS文件系统挂载相关推荐
- linux autofs ftp,Linux NFS自动挂载autofs配置
一.基于Linux下NFS文件系统的自动挂载方式, 前期准备环境两台Linux服务器:准备一台NFS服务器端(系统环境centos6.5,ip地址192.168.100.100) 准备需要挂载NFS服 ...
- Android NFS文件系统挂载遇到的问题解决方法
在网上他人博客中方法都大同小异,但是却无法解决我遇到的问题. 我随意挑选一个网友的方法http://blog.csdn.net/zjg555543/article/details/7792984 当然 ...
- 嵌入式软件开发之------浅析linux根文件系统挂载(九)
Linux代码版本:linux4.4 导读:前些天拿到供应商的一块arm64开发板,需要对其新CPU进行测试评估.需要将公司自己的系统移植上去测试一些参数.在挂载公司的cpio包的时候,出现解压失败. ...
- linux nfs 拒绝挂载,mount:被服务器拒绝的nfs访问
我试图在我的linux机器上挂载NFS设备.mount:被服务器拒绝的nfs访问 我/ etc/fstab中是这样的, 192.168.0.5:/volume2/Asterisk_Recordings ...
- linux nfs文件挂载模拟云存储
背景 产品上线前兼容性测试,云存储未到位: 系统:SUSE Linux Enterprise Server 11 SP1 解决方法 其中一个服务器A开放nfs服务,模拟云存储,其它服务器挂载A的目录, ...
- 挂载 nfs 文件系统
环境 硬件:I.MX6U ALPHY V2.2 宿主机:Ubuntu 20.04 概述 我们的目的是在 kernel 启动后,将 nfs 文件系统挂载成板子的根文件系统.因此,bootloader.k ...
- SigmaStar SSD202 openwrt 系统下ubi根文件系统挂载过程
关于UBI介绍可以参考官方文档 http://www.linux-mtd.infradead.org/doc/ubifs.html 下面是一张简介图,大概的介绍就是UBIFS依赖kernel UBI子 ...
- linux系统文件系统个目录介绍,关于linux的文件系统目录详细介绍
首先我们回答一下最为宽泛的问题,什么是文件系统? 文件系统是对一个存储设备上的数据和元数据进行组织的机制.liuux的文件系统体系结构是一个对复杂系统进行抽象化的有趣例子,通过使用一组通用的API函数 ...
- linux NFS 服务配置
首先恢复虚拟机1与虚拟机2快照,重新准备环境: 虚拟机1-单网卡-仅主机模式-192.168.100.10 虚拟机2-单网卡-仅主机模式-192.168.100.20 虚拟机3-单网卡-仅主机模式-1 ...
最新文章
- 我为什么暂时放弃了React Native
- mysql注释用处_mysql的注释有几种写法
- [转]游戏中各种性能优化方法(不断更新)
- vue 开发2017年变化回顾及2018年展望
- jinja2模板用法详解
- mysql 5.5 性能测试,MySQL 5.5迁移到5.7的性能问题排查案例
- salesforce 零基础开发入门学习(十四)salesforce中工厂模式的运用
- SQL语句取某字段最大的那一条记录
- Java开发笔记(一百三十)Swing的选择框
- learning ddr DLL-off mode
- 计算机中文无敌版,与电脑下象棋无敌版
- Minecraft Mod 开发:0-前言
- 控制反转思想的理解实例
- X/Open和OSF
- Javascript变量、作用域与内存
- [Codeforces 115B] Lawnmower
- IC | 关于传输线的反射原理的详细解析
- 图-154飞机简直就是杀人凶器
- Mapbox 加载自定义 WMS 数据源
- 古琴销售怎么做阳php学,古琴到底能否自学?如何才能学好古琴?
热门文章
- KYLIN立方体构建详解
- 微服务的「扩展立方」与 Docker 化实践
- 通达高百特视频会议使用说明
- 2019HDU多校第七场 HDU6646 A + B = C 【模拟】
- 飞讯 移动售楼营销 iPAD营销楼盘展示
- 省级面板数据(1994-2019)十七:教育、卫生和社会服务(stata版)
- 深入Android系统(八)Android的资源管理
- 我的计算机中找不到磁盘分区,d盘不见了怎么办?我的电脑没有d盘怎么添加硬盘分区...
- java判断字段是否final修饰
- 取消SIM卡槽,eSIM为防盗带来新转机,手机防盗终极大招