Linux 掛載(nfs)__Linux

來源:互聯網
上載者:User
一、配置NFS 伺服器 1. 下載安裝NFS      如果系統是Centos 5:
yum -y install nfs-utils portmap
   如果系統是Cenos 6:
yum -y install nfs-utils rpcbind

192.168.0.103     nfs伺服器 192.168.0.107     用戶端
2.配置NFS 設定檔etc/exports
/root/nfs 192.168.0.107(rw,sync,no_root_squash,no_subtree_check)

mount 的地址可以是一個IP,一個網段,一個網域名稱,網域名稱萬用字元, ep: *.youxia.com. mount地址和許可權之間沒有空格。
以後主要講解參數含義:
rw : read-write  讀寫權限 ro :  read-only  唯讀許可權 sync: 檔案寫入記憶體和硬碟 async: 檔案暫存於記憶體,但是不寫入記憶體。 no_root_squash: 如果用戶端以root身份登入,則對共用的伺服器目錄頁有root的使用許可權(不安全)。 root_squash:如果用戶端以root身份登入,則對共用的伺服器目錄以匿名使用者的許可權操作,一般為nobody或者nfsnobody.

3.啟動NFS 
如果系統為Centos 5:
service portmap start service nfs  start
如果系統為Centos6
service rpcbind start service nfs start
4.用戶端mount nfs 伺服器
mount -t nfs 192.168.0.103:/root/nfs /root/test
/root/nfs 為NFS伺服器共用的目錄,/root/test為用戶端mount點(掛載點)。
pleae see teset below:
在用戶端的root/test下做操作,觀察nfs 伺服器指定目錄情況:
192.168.0.103
[root@localhost nfs]# ls[root@localhost nfs]# 

192.168.0.107
[root@kevin test]# ls[root@kevin test]# 

在用戶端建立檔案
[root@kevin test]# echo "hello world" >> test.log[root@kevin test]# lstest.log[root@kevin test]# 

服務端:
[root@localhost nfs]# lstest.log[root@localhost nfs]# cat test.log hello world[root@localhost nfs]# 

在用戶端,另一種方法查詢掛載:
[root@kevin test]# df -hFilesystem            Size  Used Avail Use% Mounted on/dev/sda2              18G  885M   16G   6% /tmpfs                 491M     0  491M   0% /dev/shm192.168.0.103:/root/nfs                      7.7G  3.0G  4.4G  41% /root/test







聯繫我們

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