Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    【FAQ】全志R系列Tina 如何使用 NFS?

    其它全志芯片讨论区
    r329 r328 r818 faq 技术支持
    1
    1
    219
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • q1215200171
      budbool LV 8 last edited by

      NFS(Network File System,网络文件系统)可用于客户端访问服务器端的文件,并且从上层看其过程与访问本地文件相同。

      以下介绍如何将 Tina 作为客户端、Ubuntu 电脑作为服务器端使用。

      配置

      客户端

      在 Tina 的 kernel_menuconfig 中选上以下内容:

      File systems --->
          [*] Network File Systems --->
              <*> NFS client support
      

      服务器端
      ( 下面以 Ubuntu 14.04 为例,新一些版本的 Ubuntu 可能使用 systemd 管理系统服务,用到的命令会有所不同 )

      安装 nfs 服务器端软件包:

      sudo apt-get install nfs-kernel-server
      

      打开 /etc/exports 文件,添加需要共享的目录:

      /path/to/share *(rw,sync,no_root_squash,no_subtree_check)
      
      • /path/to/share 是共享的目录
      • 表示允许所有网段访问
      • rw 表示允许读写

      更多的配置说明可用 man 5 exports 查看 exports 的手册。

      接着重启 NFS 服务:

      sudo /etc/init.d/rpcbind restart
      sudo /etc/init.d/nfs-kernel-server restart
      

      使用

      客户端和服务器端连接到 同一个网段,接着在客户端执行挂载命令:

      mount -t nfs -o nolock <server_address>:/path/to/share /local/mnt/dir
      <server_address> 为服务器端的地址,一般使用 IP 地址
      /path/to/share 为服务器端共享的目录
      /local/mnt/dir 为客户端挂载的目录
      

      此处若不加 -o nolock 在某些情况下可能会挂载失败,尚不清楚原因。如果加上后无法挂载成功可以尝试去掉看看。

      1 Reply Last reply Reply Quote Share 0
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • 1 / 1
      • First post
        Last post

      Copyright © 2022 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策