AIX 上使用NFS實作AIX之間檔案網絡共享
tomroom.cublog.cn 作者:tomroom 環保男 環境AIX 6.1
AIX 可以使用NFS在AIX之間實作類似window共享檔案夾功能,在多台aix上安裝系統更新檔的時候比較有用隻需要在一台伺服器上FTP上傳,其他AIX通過共享通路(注意不要多台一起通路可能會由于I/O繁忙帶有問題)
注意:
1. 多台AIX之前在同一個區域網路子網段中沒有問題,若跨網段請确認網絡開通NFS端口
2. 下面我都是用root賬戶登入操作
3. 要在A,B兩端的/etc/hosts裡互相都加上彼此的IP位址和hostname(若不用DNS都通過hosts表裡name
l 第一部分在AIX伺服器A 上面建裡要通過NFS共享的目錄比如:根目錄下/test目錄
# ls -l
total 8
-rw-r----- 1 root system 543 Jul 24 03:39 temp.txt
/test目錄中存放一個檔案temp.txt内容如下,後面可以用這個驗證共享成功
# cat temp.txt
SBMJOB CMD(STROBJCVN LIB(*ALLUSR))
LOG(4 0 *SECLVL)
S6564E5B
定時任務 DAILY4 HOLD
錄音帶機中錄音帶 卷标 001176推入錄音帶機TAP07
Opt Queue Manager Port
HHT 1417
MQM HHT
Opt Queue Manager Port
HHT 1414
HHT 1417
A機器上運作# smit nfs
先選擇Network File System (NFS)
NFS
Move cursor to desired item and press Enter.
Configure TCP/IP (If Not Already Configured)
Network File System (NFS)
Network Information Service (NIS)
Configure Secure NFS & NIS
再選擇Add a Directory to Exports List(先Change / Show Attributes of an Exported Directory确認目錄之前沒有被Exported
Network File System (NFS)
Configure NFS on This System
Add a Directory to Exports List
Change / Show Attributes of an Exported Directory
Remove a Directory from Exports List
Add a File System for Mounting
Change / Show Attributes of an NFS File System
Remove an NFS File System
Flush NFS V4 Translation Cache
Add NFSv4 File System FSID Options
Change / Show NFSv4 File System FSID Options
Reset NFSv4 File System FSID Options
下面畫面中* Pathname of directory to export 輸入導出目錄路徑和名稱 [/test]
Add a Directory to Exports List
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[TOP] [Entry Fields]
* Pathname of directory to export [/test]
Anonymous UID [-2]
Public filesystem? no
* Export directory now, system restart or both both
[]
運作完成之後如下提示
COMMAND STATUS
Command: running stdout: yes stderr: no
Before command completion, additional instructions may appear below.
0513-059 The nfsd Subsystem has been started. Subsystem PID is 5505044.
0513-059 The rpc.mountd Subsystem has been started. Subsystem PID is 7077952.
l 第二部分在另外一台伺服器B上
運作smitty nfs選擇Network File System (NFS)
NFS
B機器上選擇Add a File System for Mounting
Pathname of mount point 填B機上mount點
Pathname of remote directory填A機上路徑
Host where remote directory resides填A機主機名(在A機器上運作hostname獲得)
Add a File System for Mounting
* Pathname of mount point [/tmp/test/]
* Pathname of remote directory [/test]
* Host where remote directory resides [svr05427]
Mount type name []
* Security method [sys]
* Mount now, add entry to /etc/filesystems or both? now
* /etc/filesystems entry will mount the directory no
on system restart.
注意: 要在A,B兩端的/etc/hosts裡互相都加上彼此的IP位址和hostname
若提示not in hosts database 需要修改B機器上/etc/hosts檔案增加A伺服器的IP位址和hostname
Command: failed stdout: yes stderr: no
mount: 1831-009 svr05427 not in hosts database
mount: 1831- 008 giving up on:
svr05427:/test
A route to the remote host is not available.
若有如下錯誤可能網絡上沒有開放NFS需要的端口
nfsmnthelp: 1831-019 svr05427: System call error number -1.
System call error number -1.
成功之後可以在B機上smit mount中 List all能看到mount上檔案驗證,并通路共享檔案内容确認可以通路
l 解除安裝
取消在B機上可以用smit umount指定上面B機上mount點可以在B機器上取消該NFS
在A機器上解除安裝,smit nfs選擇Remove a Directory from Exports List 輸入路徑
Add a Directory to Exports List
Change / Show Attributes of an Exported Directory
Change / Show Attributes of an NFS File System
l 權限
我兩台機器都是用root賬戶通路權限兩台都是如下一樣
-rw-r----- 1 root system 543 Jul 24 06:10 temp.txt
l 附錄:
l windows端也能通路AIX NFS ,也有建議window通路aix檔案系統SAMBA比NFS好
比如:http://www.chinaunix.net/jh/9/503373.html
經常碰到一些客戶需要将PC Server的資料定期放到運作AIX作業系統的6000小機的 錄音帶機上備份,做了幾個這樣的案例 Share一下:)
1、下載下傳SFU
SFU是微軟的一款與UNIX系統進行檔案共享的軟體 100M左右。可在Windows端模拟NFS Server 或者使 Windows成為NFS Client。他是免費的。下載下傳時需要.net帳戶(msn的就行)
2、在Windows端安裝SFU軟體。選擇作為NFS Client。安裝時間較長。安裝結束後可以在網路上的芳鄰中發現新增加了一個叫做SFU的 工作組(好像是這個名字)
在上面點選右鍵選擇添加,将6000的IP位址加入。在6000一端開啟NFS服務。重新整理後就可看到該伺服器了
3、身分認證:在兩端建立相同帳号,需要在6000上編輯/etc/hosts檔案。将需要通路NFS路徑的伺服器IP位址與機器名稱加入。這是 在PC Server端就可以通路該共享檔案夾了。在上面還可進行權限的管理 有興趣的自己實驗吧。
本文轉自 Mr_sheng 51CTO部落格,原文連結:http://blog.51cto.com/sf1314/1971766