一些關(guān)于掛載解決問題的方法分析
#sudo apt-get install nfs-kernel-server
打開/etc/exports文件,
/work/nfs_root/file_sys_yl
其中的file_sys_yl就是新添加的掛載目錄
注:nfs允許掛載的目錄及權(quán)限,在文件/etc/exports中進(jìn)行定義,各字段含義如下:
/work/nfs_root/file_sys_yl:要共享的目錄
* :允許所有的網(wǎng)段訪問
rw :讀寫權(quán)限
sync:資料同步寫入內(nèi)在和硬盤
no_root_squash:nfs客戶端共享目錄使用者權(quán)限
重啟服務(wù):
sudo
/etc/init.d/portmap
restart
showmount
-e
注:nfs是一個RPC程序,使用它前,需要映射好端口,通過portmap設(shè)定
命令執(zhí)行情況如下:
kevin@ubuntu:~$sudo
/etc/init.d/portmap restart
rtmap 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 742
kevin@ubuntu:~$sudo
/etc/init.d/nfs-kernel-server
restart
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/work/nfs_root".
exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/work/nfs_root/first_fs".
kevin@ubuntu:~$showmount
-e
Export list for book-desktop:
/work/nfs_root/first_fs *
/work/nfs_root
現(xiàn)在可以在本機上試一下:
#sudo mount -t nfs
localhost:/home/kevin /mnt
注:localhost為本機linux的IP地址
這樣就把共享目錄掛到了/mnt目錄,取消掛載用:
#sudo umount
/mnt
如果用在嵌入式設(shè)備上掛載,要加上參數(shù)-o nolock
我在開發(fā)板上使用的掛載命令:
mount -t nfs -o nolock 59.68.190.128:/work/nfs_root/first_fs /mnt
,這樣就能在開發(fā)板上面查看到自己虛擬機中的文件了,
有一個問題就是找了很長時間,其實是/work/nfs_root/first_fs這個文件夾寫錯了,悲劇的我為了這一個錯誤找了一上午
歡迎光臨 (http://www.torrancerestoration.com/bbs/) | Powered by Discuz! X3.1 |