日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

VMware中為Ubuntu安裝配置nfs服務(wù)

 angelbrian 2013-03-27
配置:vmware中安裝Ubuntu10.04
系統(tǒng):windows XP
連接:開發(fā)板通過RS232和交叉網(wǎng)線與PC相連

方法如下:
一、虛擬機(jī)設(shè)置(如果網(wǎng)絡(luò)已經(jīng)設(shè)置在橋接方式,跳過這步)
1、在啟動(dòng)ubuntu前,將其Ethernet(網(wǎng)絡(luò))連接方式設(shè)為Bridge(橋接方式)
2、啟動(dòng)ubuntu,設(shè)置靜態(tài)ip地址(必須與開發(fā)板處于同一網(wǎng)段)
lingd@ubuntu:~$ sudo ifconfig eth0 192.168.0.26 netmask 255.255.255.0

二、為ubuntu安裝NFS
1、安裝NFS
lingd@ubuntu:~$ sudo apt-get install nfs-kernel-server
同時(shí)會(huì)有兩個(gè)軟件包nfs-common和portmap被安裝上
2.修改NFS配置文件
lingd@ubuntu:~$ vi /etc/exports
內(nèi)容為:
     /home/lingd/arm     192.168.0.*(rw,sync,no_root_squash,no_subtree_check)

     /home/lingd/arm---要共享的目錄
     192.168.0.*---允許訪問的網(wǎng)段,也可以是ip地址、主機(jī)名(能夠被服務(wù)器解析)、*(所有人都能訪問)
     (rw,sync,no_root_squash,no_subtree_check)---rw:讀/寫權(quán)限
                                 sync:數(shù)據(jù)同步寫入內(nèi)存和硬盤
                                 no_root_squash:服務(wù)器允許遠(yuǎn)程系統(tǒng)以root特權(quán)存取該目錄
no_subtree_check:關(guān)閉子樹檢查
其他選項(xiàng)可以通過man exports查閱man文檔

3、啟動(dòng)服務(wù)
重啟portmapper(端口映射)服務(wù)
lingd@ubuntu:~$ sudo service portmap restart
portmap start/running, process 550
重啟NFS服務(wù)
lingd@ubuntu:~$ sudo service nfs-kernel-server restart
 * Stopping NFS kernel daemon                                            [ OK ] 
 * Unexporting directories for NFS kernel daemon...                      [ OK ] 
 * Exporting directories for NFS kernel daemon...                        [ OK ] 
 * Starting NFS kernel daemon                                            [ OK ]


三、測(cè)試
1、本機(jī)掛載
lingd@ubuntu:~$ ls /mnt/nfs/
lingd@ubuntu:~$ sudo mount -t nfs -o nolock localhost:/home/lingd/arm/ /mnt/nfs/
lingd@ubuntu:~$ ls /mnt/nfs/
cross-3.4.1.tar.bz2  linux-2.6.12        upload
download             msap                VMwareTools-8.1.3-203739.tar.gz
DSDT_2[1].8b.zip     ntp                 vmware-tools-distrib
DSDT_2.8b            protocol-converter  安裝包
lingd@ubuntu:~$ sudo umount /mnt/nfs 
lingd@ubuntu:~$ ls /mnt/nfs/

2、開發(fā)板掛載
lingd@ubuntu:~$ telnet 192.168.0.25 2009
Trying 192.168.0.25...
Connected to 192.168.0.25.
Escape character is '^]'.

(none) login: root
Password: 
~ # ls /mnt                                                 
ext1  ext2
~ # mount -t nfs -o nolock 192.168.0.26:/home/lingd/arm /mnt
~ # ls /mnt
DSDT_2.8b                        msap
DSDT_2[1].8b.zip                 ntp
VMwareTools-8.1.3-203739.tar.gz  protocol-converter
cross-3.4.1.tar.bz2              upload
download                         vmware-tools-distrib
linux-2.6.12                     安裝包
~ # umount /mnt
~ # ls /mnt
ext1  ext2
~ # 

四、掛載nfs文件系統(tǒng)失敗的原因
1、nfs錯(cuò)誤信息
Too many levels of remote in path:試圖掛載一個(gè)存在的文件系統(tǒng)
Permission denied:NFS服務(wù)器不讓客戶機(jī)掛接,也可能是因?yàn)橛脩粼诜?wù)器上不存在
No such host:通常是DNS配置錯(cuò)誤
No such file or directory:通常是訪問的目錄不存在
NFS server is not responding:通常是NFS已經(jīng)超過負(fù)載或者NFS已經(jīng)停止工作
Stale file handle:在NFS客戶端關(guān)閉之前客戶端訪問的文件被刪除
Fake hostname:Forward和reverse的DNS記錄在NFS客戶端下不存在
2、掛載nfs文件系統(tǒng)失敗的原因
(1)主機(jī)和網(wǎng)絡(luò)不通:看看網(wǎng)線連接、主機(jī)和開發(fā)板ip是否在同一網(wǎng)段、防火墻有沒有關(guān)閉等。不僅vmware中l(wèi)inux的防火墻要關(guān)閉,vmware外xp的防火墻也要關(guān)閉,我就因?yàn)閤p中的eset殺毒軟件的防火墻使nfs無法掛載(可以掛本機(jī),無法掛遠(yuǎn)程),折騰了一天,后來才發(fā)現(xiàn)是xp中的防火墻搞的鬼!

(2)使用的mount命令不正確。可以參照上面的例子改一下;或者man nfs查閱一下nfs的man文檔,里面有nfs中mount的使用介紹和選項(xiàng)解釋

(3)nfs配置文件/etc/exports配置不正確??梢詤⒄丈厦娴睦痈囊幌拢换蛘?font class="Apple-style-span" color="#f00000">man exports查閱一下/etc/exports的man文檔

(4)必要時(shí)重新啟動(dòng)NFS和portmap服務(wù)。
sudo service portmap restart
sudo service nfs-kernel-server restart

(5)內(nèi)核不支持NFS和RPC服務(wù)(可能需要重新配置、編譯、燒寫內(nèi)核)。
普通的內(nèi)核應(yīng)有的選項(xiàng)為CONFIG_NFS_FS=m、CONFIG_NFS_V3=y、CONFIG_ NFSD=m、CONFIG_NFSD_V3=y和CONFIG_SUNRPC=m。
rpcinfo命令用于顯示系統(tǒng)的RPC信息,一般使用-p參數(shù)列出某臺(tái)主機(jī)的RPC服務(wù)。rpcinfo -p命令檢查服務(wù)器時(shí),應(yīng)該能看到portmapper、status、mountd、nfs和nlockmgr。用該命令檢查客戶端時(shí),應(yīng)該至少能看到portmapper服務(wù)(開發(fā)板可能不帶該命令)。由rpcinfo -p可知,nfs使用的port為2049,portmapper使用111port。

五、nfs相關(guān)的配置文件與命令
1、/etc/exports
NFS的主要配置文件,不過系統(tǒng)并沒有默認(rèn)值,所以這個(gè)文件不一定會(huì)存在(需要自己建立)。

2、/usr/sbin/exportfs
用于維護(hù)NFS共享資源的命令,用在nfs server端。修改/etc/exports后,只要使用exportfs重新掃瞄一次 /etc/exports,重新將設(shè)定加載即可,并不一定要重啟nfs服務(wù)
命令格式: exportfs [-aruv]
參數(shù)說明如下。
(1)-a:全部掛載或卸載(export or unexpect)/etc/exports文件內(nèi)的目錄。
(2)-r:重新掛載(reexport)/etc/exports中的目錄,并將/var/lib/nfs/etab中的內(nèi)容與/etc/exports同步。
(3)-u:卸載某些目錄。
(4)-v:顯示exportfs處理信息。

3、/usr/sbin/showmount
用于查看指定主機(jī)NFS共享出來的目錄資源,主要用在Client端。
命令格式: showmount [-ade] hostname/服務(wù)器ip地址
參數(shù)說明如下。
(1)-a或-all:以host:dir格式顯示客戶主機(jī)名和掛載的目錄。
(2)-d或-directories:僅顯示被客戶掛載的目錄名。
(3)-e或-exports:顯示指定NFS服務(wù)器的nfs共享目錄。

4、/var/lib/nfs/etab
/etc/exports里列舉的是用戶希望nfs共享的目錄,而/var/lib/nfs/etab里面是ubuntu實(shí)際共享的目錄。它記 錄了NFS所共享出來的目錄的完整權(quán)限設(shè)定值。/var/lib/nfs/etab由exportfs維護(hù),每次exportfs都會(huì)掃描/etc /exports以建立新的/var/lib/nfs/etab,每當(dāng)nfs客戶請(qǐng)求掛載共享目錄時(shí)mountd都會(huì)讀取該文件以檢測(cè)客戶和目錄的權(quán)限。 同時(shí)/var/lib/nfs/etab中共享的目錄會(huì)保存在內(nèi)核nfs共享表(export table)中

5、其他nfs相關(guān)文件的解析
/var/lib/nfs/etab contains information about what filesystems should be exported to whom at the moment.
/var/lib/nfs/rmtab contains a list of which filesystems actually are mounted by certain clients at the moment.
/proc/fs/nfs/exports contains information about what filesystems are exported to actual client (individual, not subnet or whatever) at the moment.
/var/lib/nfs/xtab is the same information as /proc/fs/nfs/exports but is maintained by nfs-utils instead of directly by the kernel. It is only used if /proc isn't mounted.
* /var/lib/nfs/etab: the /etc/exports file only contains a wish list. etab is created by exportfs. It contains on each line detailed information about the options used when exporting a file system towards a single client. It's the reference file used by rpc.mountd when started
* /proc/fs/nfs/exports contains the clients list as known by the kernel
* /var/lib/nfs/xtab: Use for accuracy when etab holds client names and machines groups with wildcards. This file only contains explicit machine names.
* /var/lib/nfs/rmtab : each line shows the client's name and the file system imported from this server;

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多