开发板使用nfs挂载远程文件

关于嵌入式Linux开发板使用 nfs 挂载服务器(主机)文件
因为大部分开发板没有安装TFTP、SSH文件系统,但都有挂载(mount)功能,所以为了互传文件,使用NFS服务挂载桌面Linux系统。
如果是在Windows环境下使用虚拟机Ubuntu系统,要保证开发板、Ubuntu、Windows三者之间能够ping通。

  1. Ubuntu安装NFS服务
    sudo apt-get install nfs-kernel-server
  2. 编辑/etc/exports文件,添加NFS服务的工作目录
    sudo vim /etc/exports
    在文件末尾添加:(目录自己指定,括号内的选项不变)
    /home/jun/nfs_rootfs *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)
  3. 重启NFS服务
    sudo service nfs-kernel-server restart
  4. 可以在Ubuntu中,自己挂载自己的目录,测试能否挂载成功
    sudo mount -t nfs -o nolock,vers=4 127.0.0.1:/home/jun /mnt
    如果不成功,试一试vers=2,或vers=3
    查看/mnt目录下有没有nfs_rootfs文件夹
    ls /mnt
    注意:在 /etc/exports添加的文件夹为/home/jun/nfs_rootfs,经测试发现挂载时到上级目录(/home/jun)即可。
  5. 在开发板Linux系统中挂载命令(默认root模式)假设ip地址是192.168.0.180
    mount -t nfs -o nolock,vers=4 192.168.0.180:/home/jun /mnt
    查看挂载
    ls /mnt
  6. 卸载挂载文件
    umount /mnt

你可能感兴趣的:(开发板使用nfs挂载远程文件)