安裝 nfs 相關元件
增加 nfs 目錄
/var/nfsboot 為 nfs 共享目錄,可自由指定
× 表示任意的 ip 位址都可以挂載此目錄,若設定為 192.168.1.× 則表示隻有在 192.168.1.??? 這個網段的 ip 才可以挂載
rw 可讀寫的權限
ro 隻讀的權限
no_root_squash nfs 用戶端分享目錄使用者的權限,即如果用戶端使用的是 root 使用者,那麼對于這個共享的目錄而言,該用戶端就具有 root 的權限,若是以nfs挂載根檔案系統時,必須設定此項
sync 資料同步寫入到記憶體與硬碟當中
async 資料會先暫存于記憶體當中,而非直接寫入硬碟
服務操作指令


測試


注意:
1.完成後如出現 access denied 異常,重新啟動系統即可
2.在 ubuntu 11.10 中啟動 nfs 服務時會遇到
* not starting: portmapper is not running
解決方法:
2012-04-24 21:46
i googled and found that since the port is over 1024 i needed to add the "insecure" option to the relevant line in /etc/exports on the server. once i did that (and ran exportfs -r), the mount -a on the client worked.
//如果端口号大于1024,則需要将 insecure 選項加入到配置檔案(/etc/exports)相關選項中mount用戶端才能正常工作:
檢視 exports 手冊中關于 secure 選項說明也發現确實如此
[root@lzgonline init.d]# man exports
secure,this option requires that requests originate on an internet port less than ipport_reserved (1024). this option is on by default. to turn it off, specify insecure.
//secure 選項要求mount用戶端請求源端口小于1024(然而在使用 nat 網絡位址轉換時端口一般總是大于1024的),預設情況下是開啟這個選項的,如果要禁止這個選項,則使用 insecure 辨別
修改配置檔案/etc/exports,加入 insecure 選項
/home/lzgonline/rootfs *(insecure,rw,async,no_root_squash)
儲存退出
然後重新開機nfs服務:service nfs restart
然後問題就解決了
<a target="_blank" href="http://hi.baidu.com/alizee635_2012/item/a8c4d371f3bd7042ee1e53ec">http://hi.baidu.com/alizee635_2012/item/a8c4d371f3bd7042ee1e53ec</a>