ubuntu驅動開發環境搭建之nfs

來源:互聯網
上載者:User

標籤:ubuntu   nfs   server   kernel   嵌入式   

安裝nfs:

#sudo apt-get install nfs-kernel-server

(1)設定共用目錄
運行命令
#gedit /etc/exports
編輯 nfs 服務的設定檔(注意:第一次開啟時該檔案是空的),添加以下內容:
/opt/FriendlyARM/mini2440/rootfs_qtopia_qt4 *(rw,sync,no_root_squash)
其中:
/opt/FriendlyARM/mini2440/rootfs_qtopia_qt4 表示 nfs 共用目錄,
它可以作為開發板
的根檔案系統通過 nfs 掛接;
* 表示所有的客戶機都可以掛接此目錄
rw 表示掛接此目錄的客戶機對該目錄有讀寫的權力
no_root_squash 表示允許掛接此目錄的客戶機享有該主機的 root 身份

(2)重啟服務:
#sudo /etc/init.d/portmap restart                    重啟portmap,
#sudo /etc/init.d/nfs-kernel-server restart      重啟nfs服務
#showmount -e                                             顯示共用出的目錄

註:nfs是一個RPC程式,使用它前,需要映射好連接埠,通過portmap設定

命令執行情況如下:

[email protected]:~$sudo /etc/init.d/portmap 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 474


[email protected]:~$sudo /etc/init.d/nfs-kernel-server restart
 * Stopping NFS kernel daemon                                              [ OK ] 
 * Unexporting directories for NFS kernel daemon...                   [ OK ] 
 * Exporting directories for NFS kernel daemon...     

  exportfs: /etc/exports [1]: Neither ‘subtree_check‘ or ‘no_subtree_check‘ specified for export "*:/home/xgc".
  Assuming default behaviour (‘no_subtree_check‘).
  NOTE: this default has changed since nfs-utils version 1.0.x
                                                                                 [ OK ]
 * Starting NFS kernel daemon                                       [ OK ]

[email protected]:~$showmount -e
Export list for xgc-VirtualBox:
/home/kevin *

 

現在可以在本機上試一下:
#sudo mount -t nfs localhost:/opt/FriendlyARM/mini2440/rootfs_qtopia_qt4/mnt/

註:localhost為本機linux的IP地址

這樣就把共用目錄掛到了/mnt目錄,取消掛載用:
#sudo umount /mnt

如果用在嵌入式裝置上掛載,要加上參數-o nolock

我在開發板上使用的掛載命令:

mount -t nfs -o nolock 192.168.1.102:/opt/FriendlyARM/mini2440/rootfs_qtopia_qt4/mnt/

ubuntu驅動開發環境搭建之nfs

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.