LINUX nfs server配置

來源:互聯網
上載者:User

LINUX nfs server配置 1.配置nfs1.1#rpm -qa |grep nfs (查詢系統中是否安裝有nfs包)2.2 # vi /etc/exports    (編譯nfs服務的設定檔,我要把我的/data目錄共用出來,允許所有網段的使用者可以訪問)/rhome/nfs1     *(rw,async)2.3.#exportfs –rv(這個命令可以驗證我們設定的設定檔是    否正確,如果是下面的輸出,就說明是正確的)[root@station83 ~]# exportfs -rvexporting *:/rhome/nfs1或showmount -e localhost[root@station83 ~]# showmount -e localhostExport list for localhost:/rhome/nfs1   *2.4 # chkconfig --list |grep nfs (這個命令是查看nfs服務在哪幾種啟動層級會自動啟動)nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:offnfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off[root@station38 ~]# chkconfig nfs on (為了讓nfs服務在2345這幾個啟動層級都啟動,我執行了這個命令)[root@station38 ~]# chkconfig --list |grep nfs (現在去查看一下)nfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off2.5 [root@station38 ~]# service nfs restart    (現在我們就可以啟動這個服務的,讓我們的設定檔生效) 安全:配合/etc/hosts.allow與hosts.deny 固定IP訪問 2.6 用戶端測試[root@station73 other]#  showmount -e 192.168.0.83Export list for 192.168.0.83:/rhome/nfs1   *3.配置autofs用autofs實現掛載192.168.0.83:/rhome/nfs1 到本機。3.1 vim /etc/auto.master#/misc   /etc/auto.misc/nfs    /etc/auto.home/rhome  /etc/auto.misc/home   /etc/auto.misc## vi /etc/auto.misccd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom下增加這行nfs1            192.168.0.83:/rhome/nfs13.2 #service autofs restart  重新啟動autofs服務3.3 以nfs1在用戶端登入ssh nfs1@192.168.0.73成功後[nfs1@station73 ~]$--------------------------------------------------------------------------- 1.服務端和用戶端都需要開啟portmap服務。RCP是nfs mount和umount時通訊的方式。2.假如用戶端portmap沒有啟動,mount時,會非常慢,最終會失敗。umount時,即使本地的portmap是關閉的,也能umount成功。 3.掛載完成後,服務端的portmap停止後,nfs仍然工作正常,但是umout財會提示: not found / mounted or server not reachable。重啟伺服器的portmap也無濟於事。4.假如服務端的portmap重啟了,那麼nfs也要跟著重啟,否則nfs工作仍然是不正常的。5.假如服務端nfs關閉(IP是通的),這時用戶端會無法umount,這時使用umount -f /nfs一般能成功,當服務端死機時,umount -f /nfs 有可能會失敗,這時可以使用 umount -l /nfs . 最終建議:1.使用NFS,就要使用portmap,NFS嚴重依賴於portmap,所以不要試圖去停止它(portmap)。2.當不能umount /nfs 分區時,試著使用umount -f /nfs,一般都能成功。3.當umount -f /nfs不能umount時,可以試試umount -l /nfs. umount -l是最終級的umount。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.