一些關(guān)于掛載解決問(wèn)題的方法分析
#sudo apt-get install nfs-kernel-server
打開(kāi)/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)段訪問(wèn)
rw :讀寫(xiě)權(quán)限
sync:資料同步寫(xiě)入內(nèi)在和硬盤(pán)
no_root_squash:nfs客戶端共享目錄使用者權(quán)限
重啟服務(wù):
sudo
/etc/init.d/portmap
restart
showmount
-e
注:nfs是一個(gè)RPC程序,使用它前,需要映射好端口,通過(guò)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)在可以在本機(jī)上試一下:
#sudo mount -t nfs
localhost:/home/kevin /mnt
注:localhost為本機(jī)linux的IP地址
這樣就把共享目錄掛到了/mnt目錄,取消掛載用:
#sudo umount
/mnt
如果用在嵌入式設(shè)備上掛載,要加上參數(shù)-o nolock
我在開(kāi)發(fā)板上使用的掛載命令:
mount -t nfs -o nolock 59.68.190.128:/work/nfs_root/first_fs /mnt
,這樣就能在開(kāi)發(fā)板上面查看到自己虛擬機(jī)中的文件了,
有一個(gè)問(wèn)題就是找了很長(zhǎng)時(shí)間,其實(shí)是/work/nfs_root/first_fs這個(gè)文件夾寫(xiě)錯(cuò)了,悲劇的我為了這一個(gè)錯(cuò)誤找了一上午
歡迎光臨 (http://www.torrancerestoration.com/bbs/) | Powered by Discuz! X3.1 |