嵌入式Linux--日常用NFS操作流程

前提设置

  • 虚拟机:192.168.0.120
  • 开发板:192.168.0.121

1、虚拟机查看NFS情况:showmount -e

显示:

efyuan@ubuntu:~$ showmount -e
Export list for ubuntu:
/home/liefyuan/linux/nfs 192.168.132.0/24

IP地址不对,需要修改NFS配置文件


2、查看ID:id

显示:

liefyuan@ubuntu:~$ id
uid=1000(liefyuan) gid=1000(liefyuan)=1000(liefyuan),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare)

3、虚拟机修改NFS配置文件:sudo vim /etc/exports

修改为:

# /etc/exports: the access control list for filesystems which may be exported
#       to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/home/liefyuan/linux/nfs 192.168.0.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000,no_subtree_check)

  • 里面的id = 1000

4、虚拟机修改NFX配置文件之后更新:sudo exportfs -arv

显示:

liefyuan@ubuntu:~$ sudo exportfs -arv
exporting 192.168.0.0/24:/home/liefyuan/linux/nfs
# 看看有没有修改过来
iefyuan@ubuntu:~$ showmount -e
Export list for ubuntu:
/home/liefyuan/linux/nfs 192.168.0.0/24


5、开发板查看NFS情况:showmount -e 192.168.0.120

正常情况显示:

root@ATK-IMX6U:~# showmount -e 192.168.0.120
Export list for 192.168.0.120:
/home/liefyuan/linux/nfs 192.168.0.0/24

6、开发板挂载NFS文件系统:mount -t nfs -o nolock,nfsvers=3 192.168.0.120:/home/liefyuan/linux/nfs /mnt/nfs

显示:

root@ATK-IMX6U:~# mount -t nfs -o nolock,nfsvers=3 192.168.0.120:/home/liefyuan/linux/nfs /mnt/nfs
# 没有任何显示即正常挂载

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页