close

reference

before start: 確認pkg

[root@pc /]# rpm -qa|grep rpcbind

rpcbind-0.2.0-11.el6.x86_64

[root@pc /]# rpm -qa | grep nfs-utils

nfs-utils-lib-1.1.5-9.el6.x86_64

nfs-utils-1.2.3-54.el6.x86_64

相關的資料夾

/etc/exports (share files寫在這裡面)

/usr/sbin/exportfs (nfs設定指令)

/usr/sbin/showmount (show 出exports的的設定 for client)

/var/lib/nfs/*tab

 

I.建立分享的檔案設定

ex: share /work1 資料夾給PC02

[root@PC ~]# vi /etc/exports

#sharefile target_node

/work1 PC02(rw,sync) (file修改的權限寫在括弧內)

II. 啟動

[root@PC ~]# /etc/init.d/rpcbind start

[root@PC ~]# /etc/init.d/nfs start (與server相關設定寫在/etc/init.d/nfs 的script裏)

[root@PC ~]# /etc/init.d/nfslock start (與client相關設定寫在/etc/init.d/nfs 的script裏)

[root@PC ~]# chkconfig rpcbind on

[root@PC ~]# chkconfig nfs on

[root@PC ~]# chkconfig nfslock on

 

確認有出現以下徇行完成啟動

[root@PC ~]#cat  /var/log/messages|grep rpc

rpc.statd[3302]: Version 1.2.3 starting

[root@PC ~]# cat  /var/log/messages|grep NFSD

NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory

NFSD: starting 90-second grace period

III. 有新的file 要分享

編輯好/etc/exports  

重新掛載 /etc/exports 檔案

exportfs -arv

全部卸載share 的file

exportfs -auv

 

IV. 防火牆設定

vi /etc/sysconfig/nfs

12 RQUOTAD_PORT=1001

20 LOCKD_TCPPORT=30001

22 LOCKD_UDPPORT=30001

57 MOUNTD_PORT=1002

設定好重新啟動

 /etc/init.d/nfs restart

 


 

Client setting

I. Show server 端PC01  share哪些資料夾

[root@SI06 ~]# showmount -e PC01

2. 開始掛載file

把PC01 的/work1 掛載道 PC02 的WORK1

[root@PC02 ~]# mkdir WORK1 

[root@PC02 ~]# mount -t nfs SI01:/work1 /WORK1

3. 查看掛載是否成功

[root@PC02 ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

PC01:/work1     7.2T   50M  6.8T   1% /WORK1

PC01:/work2     7.2T   50M  6.8T   1% /WORK2

PC01:/work3     7.2T   50M  6.8T   1% /WORK3

 

 

 

 

 

arrow
arrow
    全站熱搜
    創作者介紹

    quantum2nd 發表在 痞客邦 留言(0) 人氣()