aix system basic concept and administration · 2017-07-01 · 4 aix系統的主要特點 • system...

176
1 AIX System Basic Concept and Administration Mars Chung

Upload: others

Post on 11-Mar-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

1

AIX System

Basic Concept and

Administration

Mars Chung

Page 2: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

3

AIX系統概述

Page 3: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

4

AIX系統的主要特點• System Management Interface Tools smit and smitty. These are very

good system admin tools and cover 95% of your admin work.

• Logical Volume Manager (LVM)

• AIX has a Journaling Filesystem (JFS2) which supports multi-TB filesystems.

• Logical Partitions (LPARs) - machines with POWER4 and POWER5 CPUs can be partitioned to run multiple copies of AIX (and/or Linux) at the same time

• Micro-partitioning - LPARs can share CPUs, which the Hypervisor time-slices. (Requires AIX V5.3 or the Linux 2.6 kernel.)

• Virtualization - LPARs can share disks (and disk & network adapters) to reduce costs. (Requires AIX V5.3 or the Linux 2.6 kernel.)

Page 4: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

5

系統管理工具

Page 5: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

6

System Management Interface Tool

Page 6: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

7

使用smit

Schedule a Job

Type or select values in entry fields.Press Enter AFTER making all desired changes.

[Entry Fields]

YEAR [09] #

MONTH [Aug] +

DAY (1-31) [22] #

* HOUR (0-23) [] #

* MINUTES (0-59) [] #

SHELL to use for job execution Korn (ksh) +

*COMMAND or SHELL SCRIPT (full pathname) []

F1=Help F2=Refresh F3=Cancel F4=List Esc+5=Reset

Esc+6=Command Esc+7=Edit Esc+8=Image

Esc+9=Shell Esc+0=Exit Enter=Do

*必要輸入

#輸入數字範圍

/輸入路徑

X輸入16進位的值

?輸入的值不會顯示

+ F4或Esc+4可挑選

SMIT常用hot key

F3或ESC + 3 取消

F4或ESC + 4 顯示列表

F6或ESC + 6 顯示命令

F8或ESC + 8 顯示快速路徑

F9或ESC + 9 啟動shell

F10或ESC + 0 退出smit

Page 7: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

8

• Command 欄位表示smit當前的狀態

▪ running 目前正在執行中

▪ ok 執行已完成

▪ failed 執行失敗

smit命令狀態

COMMAND STATUS

Command: running stdout: yes stderr: no

Before command completion, additional instructions may appear below.

Page Space Physical Volume Volume Group Size %Used Active Auto Type

hd6 hdisk0 rootvg 768MB 1 yes yes lv

Page 8: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

9

smit的log

$HOME/smit.log

紀錄SMIT的過程包括錯誤訊息

HOME/smit.script

紀錄SMIT的命令

Page 9: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

10

Web-based System Manager

• 啟動wsmserver

• 關閉wsmserver

root@P550aix:/> /usr/websm/bin/wsmserver -enable#wsmserver 9090/tcp # WebSMroot@P550aix:/> netstat -an |grep 9090tcp4 0 0 *.9090 *.* LISTEN

root@P550aix:/> /usr/websm/bin/wsmserver -disable#wsmserver 9090/tcp # WebSMroot@P550aix:/> netstat -an |grep 9090root@P550aix:/>

Page 10: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

11

Page 11: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

12

作業系統安裝

Page 12: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

13

安裝前準備

• 至少需256MB~512MB的記憶體

• 至少需2.2GB的磁碟空間大小

• 確認韌體最低版本

• 任何必要硬體都必須實際連接

• 設定從安裝媒體的裝置上開機

Page 13: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

14

ASCII終端機設定

p5之前9600 bit p5之後19200 bit

Page 14: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

15

基本作業系統(BOS)的安裝模式

1. New and Complete Overwrite installation

▪ 新安裝或重新安裝覆蓋現有BOS版本

2. Preservation installation

▪ 此安裝模式會保留於rootvg中的使用者資料

3. Migration installation

▪ 升級AIX BOS版本所使用

Page 15: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

16

New and Complete Overwrite Installation

• 新機並未安裝AIX作業系統

• 目前系統需重新安裝因為:

▪ rootvg損毀且無任何系統備份

▪ rootvg分散在多個硬碟上需要重新分配並縮小rootvg的大小

• 預設安裝並不會啟用TCB模式,如需要TCB模式需重新安裝

• 安裝完成後系統會重新開機並進入輔助配置選單進行安裝後的設定作業

Page 16: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

17

Preservation installation

• 會取代舊的BOS版本

• /usr、/var、/tmp、 /opt及" / " (root)檔案系統會被覆蓋並改寫

• /etc/preserve.list中包含使用此安裝模式時會保留的設定檔

• 系統中的應用程式及檔案配置資料會遺失

• 安裝後需重新安裝及配置應用程式

• 安裝後需重建使用者及群組

• 安裝後需重新配置裝置

Page 17: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

18

Migration installation

• 用於移轉(升級)AIX到不同版本

• 會保留rootvg上的所有檔案系統,除了/tmp

• rootvg之外的volume groups不受影響

• 進行移轉安裝前請確定已完成系統備份

Page 18: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

19

Configuration Assistant

• 系統安裝完成後重新開機後出現

▪ 設定日期、時間及時區

▪ 設定root密碼

▪ 配置網路設定

▪ 設定Web-based System Management

Page 19: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

21

AIX BOS安裝方式一覽表

安裝步驟新安裝並覆寫

New and Complete Overwrite

保留安裝Preservation

移轉安裝Migration

建立rootvg ●

建立檔案系統 /、/usr、/var ● ●

建立檔案系統 /home ●

儲存配置設定 ●

還原BOS ● ● ●

安裝其他檔案集 ● ● ●

還原配置 ●

Page 20: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

22

安裝媒體及方式

• CDROM、DVDROM

• 備份媒體(磁帶裝置)

• 網路安裝(NIM)

• iSCSI磁碟安裝

Page 21: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

23

機型 / CPU頻率

• 目前機型及CPU頻率

▪ lsconf or prtconf

root:55a@/>lsconfSystem Model: IBM,9133-55AMachine Serial Number: 06D8E8GProcessor Type: PowerPC_POWER5Processor Implementation Mode: POWER 5Processor Version: PV_5_2Number Of Processors: 4Processor Clock Speed: 1499 MHzCPU Type: 64-bitKernel Type: 64-bitLPAR Info: 1 06-D8E8GMemory Size: 11920 MBGood Memory Size: 11920 MB

Page 22: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

24

AIX版本?

• 目前AIX版本及 Technology Level (TL) ?

▪ oslevel -r

• 目前的Technology Level (TL) ?

▪ instfix -i | grep ML

root:55a@/>oslevel –r (s)5300-10

root:55a@/>instfix -i |grep MLAll filesets for 5.3.0.0_AIX_ML were found.All filesets for 5300-01_AIX_ML were found.All filesets for 5300-02_AIX_ML were found.All filesets for 5300-03_AIX_ML were found.All filesets for 5300-04_AIX_ML were found.All filesets for 5300-05_AIX_ML were found.

Page 23: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

25

系統是何時安裝的?

• 使用lslpp 指令查看bos.rte的安裝日期

▪ lslpp -h bos.rteroot:55a@/> lslpp -h bos.rte

Fileset Level Action Status Date Time ----------------------------------------------------------------------------

Path: /usr/lib/objreposbos.rte 5.3.10.0 COMMIT COMPLETE 05/11/10 10:46:39

Path: /etc/objreposbos.rte 5.3.10.0 COMMIT COMPLETE 05/11/10 10:46:39

Page 24: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

26

安裝後配置系統

• 設定時間、時區

• root密碼

• 配置網路

• 安裝常用套件

• 更新Technology Level (TL or ML)

• 依照需求調整檔案系統大小

• 調整分頁空間大小

• 調整系統參數、環境變數

Page 25: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

27

軟體安裝及維護

Page 26: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

28

軟體套件命名規則

Product Name •Package

Name • Fileset Name • extension

bos.terminfo.print.data• LPPs (Licensed Program Products)

▪ 版權完整的產品

▪ 為多個package的集合

• Package

▪ 套裝軟體,為多個功能相同的fileset的集合

• Fileset(optional)

▪ 檔案集,安裝程式的最小單位,包含執行單一程式的多個檔案

Page 27: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

29

• Extension(optional)

▪ 記載套件更進一步的說明

Extension Name Fileset Description

.adt Application development toolkit

.com Common code required by similar filesets

.compat Compatibility code that may be removed in a future release

.diag Diagnostics support

.fnt Fonts

.help.Language Common Desktop Environment (CDE) help files for a particular language

.loc.Language Locale

.msg.Language Message files for a particular language

.rte Run-time environment or minimum set for a product

.ucode Microcode

Page 28: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

30

Bundles

• 包含package或是fileset的檔案列表,用於安裝特定的環境

• 以下列出部分系統預設的bundles▪ All Devices Kernels Alt_Disk_Install App-Dev

▪ CC_Eval.Graphics CDE GNOME

▪ Graphics KDE Kerberos_5

▪ Media-Defined Mozilla PerfTools

▪ Server cas_client cas_server

▪ devices Infocenter

▪ openssh_client and openssh_server

▪ wsm_remote

Page 29: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

31

驅動軟體的命名規則

devices • BusTypeID • CardID • extension

devices.pci.1410ff01.rte

• devices

▪ 此開頭表示為裝置驅動軟體

• BusTypeID

▪ 特定類型的裝置名稱

• CardID

▪ 以16進位的方式表示符合的卡片類型

Page 30: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

32

軟體套件命名規則

LPP:bos

package:bos.INed

fileset:bos.INed

package:bos.adt

fileset:bos.adt.lib

fileset:bos.adt.prof

Page 31: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

33

oslevel

Version版本

Release版次

Modification修改

Fix修正

5. 3. 0. 0Kernel重大更新 大功能的變動 小功能加強 修正Bug

Migration installation smitty update_all

需付費購買 不需收費

• 執行oslevel指令可列出目前系統版本root:55a@/> oslevel 5.3.0.0

Page 32: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

34

Version Release Modification Fix(VRMF) Changes

Page 33: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

35

軟體套件的安裝模式

• Applied

• Committed

Fileset 5.3.0.1(舊版本保留)

AppliedFileset 5.3.0.3

Fileset 5.3.0.3(新版本)

Fileset 5.3.0.1(回復舊版本)

Commit

Reject

CommittedFileset 5.3.0.3

Page 34: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

36

軟體套件的安裝模式

• Applied安裝模式▪ 安裝新的但也保留舊的,之後可還原成舊版

▪ 原本版本保留在 /usr/lpp/PackageName

▪ Applied的程式執行commit後舊版本就被刪除,而套件狀態也變為Committed

▪ Applied的程式執行reject後新版本就被刪除

• Committed安裝模式▪ 安裝新的AP不保留舊的

▪ 無法還原,只能移除重灌

※建議先執行系統備份後再進行安裝動作

Page 35: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

37

Commit or Apply?

Fileset level 安裝方式 移除方式 移除後狀態

Base level fileset Commit Remove/reinstall Removed

Update of filesetCommit Remove/reinstall Removed

Apply Reject Rejected

Page 36: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

38

安裝軟體套件

• smitty install

▪ Install and Update Software

▪ List Software and Related Information

▪ Software Maintenance and Utilities

▪ Software Service Management

▪ Network Installation Management

▪ EZ NIM (Easy NIM Tool)

▪ System Backup Manager

▪ Alternate Disk Installation

Page 37: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

39

IBM Fix Central websitehttp://www-933.ibm.com/support/fixcentral/

Page 38: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

40

IBM Fix Level Recommendation Toolhttp://www-304.ibm.com/webapp/set2/flrt/

Page 39: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

41

smit fast path• Fast path to menu: install操作內容 快速路徑

Install and Update SoftwareInstall SoftwareUpdate Installed Software to Latest Level (Update All)Install Software BundleUpdate Software by Fix (APAR)Install and Update from ALL Available Software

install_updateinstall_latestupdate_allinstall_bundleupdate_by_fixinstall_all

List Software and Related InformationList Installed Software and Related InformationList Installed SoftwareList Applied but Not Committed Software UpdatesShow Software Installation HistoryShow Fix (APAR) Installation StatusList Fileset RequisitesList Fileset DependentsList Files Included in a FilesetList Fileset Containing FileShow Installed License Agreements

list_softwarelist_installedlist_installed_swlist_applied_swshow_historyshow_apar_statlist_requisiteslist_dependentslist_fileswhat_filesetinstalled_license

Page 40: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

42

操作內容 快速路徑

List Software on Media and Related InformationList Filesets in a BundleList Software on Installation MediaList Software Fixes (APARs) on Installation MediaList Supplemental Fileset Information on Installation MediaShow License Agreements on Installation Media

list_medialist_bundlelist_media_swlist_media_fixeslist_media_infolicense_on_media

Software Maintenance and UtilitiesCommit Applied Software Updates (Remove Saved Files)Reject Applied Software Updates (Use Previous Version)Remove Installed SoftwareCopy Software to Hard Disk for Future InstallationCheck Software File Sizes After InstallationVerify Software Installation and Requisites

maintain_softwarecommitrejectremovebffcreatecheck_filesverify_install

Page 41: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

43

操作內容 快速路徑Network Installation Management

Configure Network InstallationManagement Client Fileset Install and Update SoftwareList Software on Media and Related InformationList Filesets in a BundleList Software on Installation MediaList Software Fixes (APARs) on Installation MediaManage Network Install PermissionsManage Network Install Resource Allocation

nim_clientniminitnim_client_instnim_client_listnim_c_list_bundlenim_c_list_swnim_c_list_fixesnim_permsnim_c_mac_res

System Backup ManagerBack Up the SystemBack Up This System to Tape/FileCreate a Generic Backup CDList Files in a System ImageRestore Files in a System Image

backsyssysbackupmksysbmkcdgenericlsmksysbrestmksysb

Page 42: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

44

系統啟動與關閉

Page 43: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

45

AIX開機過程

• POST後分為三個階段

▪ Read Only Storage (ROS) Kernel Init phase

▪ Base Device Configuration phase

▪ System Boot phase

POSTLoad BLV and pass control

Configure base devices

Init processes /etc/inittab

Page 44: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

46

系統開機程序(PCI架構)

Power OnPower On Self Test

load bootstrap

建立RAMFS

init(rc.boot)

Boot phase 1

Boot phase 2

Boot phase 3

載入讀取/etc/inittab

Page 45: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

47

LED codes

• 223-229▪ 檢查系統開機裝置

• 551、555 、 557▪ 檔案系統有問題▪ 日誌檔有問題

• 552 、 554 、 556▪ Super block損壞▪ 檔案系統▪ 開機磁區

• 553▪ 檢查/etc/inittab

• 581▪ 檢查網路相關

• c31▪ 等待定義console

• c32▪ console為LFT

• c33▪ console為tty

Page 46: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

48

啟動模式

1. 多用戶模式2. 啟動服務與process3. 正常對外服務狀態

1. 單用戶模式2. 重設root密碼3. 系統修復、維護

1. 做系統和硬體診斷

1. 沒有啟動AIX系統2. 從Firmware啟動3. 設定bootlist

Normal SMS

Maintenance Diagnostics

Page 47: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

50

bootlist

• 顯示或修改目前開機順序

▪ 檢視目前開機順序

▪ 更改目前開機順序

root:55a@/>bootlist -om normal hdisk0 rmt0hdisk2 ent0 speed=auto duplex=auto bserver=000.000.000.000 client=000.000.000.000

root:55a@/>bootlist -om normal hdisk0 hdisk2 rmt0 cd0hdisk0 blv=hd5hdisk2 rmt0cd0root:55a@/>

Page 48: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

51

/etc/inittab

• init之後系統會開啟此檔逐一讀取• 格式如下,使用":"分隔

▪ ID 用於識別,最多14個字元▪ Run Level

• 0、1保留,2預設, 3~9可自訂, a~c專用

▪ Action • respawn 程序不存在則啟動• wait 啟動程序並等待處理程序結束後才執行下一程序• once 啟動程序,如果程序終止則不重新啟動

▪ Command 執行的命令

• 編修後重新讀取使用指令telinit q

ID:Run Level:Action:Command

fmc:2:respawn:/opt/IBM/db2/V9.7/bin/db2fmcd

Page 49: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

52

rc.* files

在系統啟動的過程中,rc開頭的檔案會做

檔案名稱 說明

rc.boot varyon vg啟動paging spaceconfig dump devicescheck filesystemmount filesystem

rc.net 主要為network configuration

rc.tcpip 啟動tcpip的服務

Page 50: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

53

系統關機程序

• 關閉系統而不重開機

▪ shutdown

• 重開機

▪ shutdown -r

• 不通知使用者立即關閉系統並重開機

▪ shutdown -Fr

※如果/etc/rc.shutdown存在則關機前會去執行

Page 51: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

54

使用者管理

Page 52: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

55

使用者帳戶

• 每個使用者有獨立的帳戶名稱、UID及密碼

• 檔案的擁有者依據UID來決定

▪ UID為0的帳戶為系統的superuser(通常是root)

• 通常建立的使用者為檔案的擁有者;只有root可變更檔案存取權

※具有相同 ID 的帳戶基本上是相同的帳戶

root

系統管理者admin=true

一般使用者

Page 53: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

56

系統特殊帳戶• adm

▪ 用來對系統做診斷及統計

• bin▪ 主用途為避免任何東西由root或sys帳戶獨佔,通常擁有大部分使用者指令的可執行檔

• deamon▪ 保證處理程序以適當的許可權執行

• nobody▪ NFS啟用遠端列印時所用

• root▪ UID為0

• sys▪ 擁有DFS的預設掛載點

• system群組▪ 具有專用權以執行某些系統維護作業而不需root權限

Page 54: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

57

群組

• 一個群組可包含一個或多個帳戶

• 每個帳戶都必須屬於至少一個群組

• 一個帳戶可屬於多個群組

Page 55: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

58

管理使用者及群組

• 管理群組

▪ smitty group

• 管理使用者

▪ smitty user

• 設定密碼

root:52A@/ #passwd rootChanging password for "root"root's New password: Enter the new password again:

Page 56: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

59

su

• 於系統中切換帳戶的指令

• 使用su指令時有帶標記" - " 表示讀取該帳戶的環境設定,並切換至該帳戶家目錄下

• su指令的記錄於/var/adm/sulog中

• 使用其他帳戶權限執行命令▪ 權限不足時系統會提示輸入密碼

▪ 並不會切換成為該帳戶

root:52A@/ #su - mars$ iduid=203(mars) gid=1(staff)$ pwd/home/mars

root:52A@/ #su username "-c tar -cvf /dev/rmt0 ./*.log"

Page 57: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

60

登入過程getty

驗證不通過

/etc/security/login.cfg

/etc/security/failedlogin 設定環境變數

/etc/environment/etc/security/environ/etc/security/limits/etc/security/user顯示

/etc/motd

shell

/etc/passwd/etc/security/passwd

登入

帳號/密碼

/etc/environment/etc/profile$HOME/.profile

Page 58: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

61

/etc/environment

• 登入時第一個使用的檔案

• 設定格式為 name=value

▪ 路徑 PATH=/usr/bin:/etc:/usr/sbin

▪ 時區 TZ=TAIST-8

▪ 語系 LANG=en_US

Page 59: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

62

/etc/profile

• 登入後第二個使用的檔案

• 影響系統中的所有使用者

• $HOME/.profile的設定會覆蓋其中的變數

▪ 終端機類型

▪ 郵件訊息(新郵件到達的時間)

Page 60: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

63

安全性相關的記錄檔

• /var/adm/sulog▪ 記錄su的動作

• /var/adm/wtmp▪ 使用者的連線記錄

• /etc/utmp▪ 目前登入系統的使用者

• /etc/security/faillogin▪ 登入失敗的記錄

• /etc/security/lastlog▪ 登入相關的屬性

Page 61: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

64

相關設定檔

• /etc/group▪ 基本群組屬性

• /etc/passwd▪ 基本帳戶屬性

• /etc/security/group▪ 群組詳細屬性

• /etc/security/limits▪ 程序的資源限制設定檔

• /etc/security/login.cfg▪ 設定系統預設登入參數

• /etc/security/passwd▪ 加密過的密碼檔

• /usr/lib/security/mkuser.default▪ 建立新使用者時所用的樣本檔

• /etc/security/user▪ 使用者的屬性

Page 62: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

65

只能執行shutdown指令的使用者

• 在/etc/passwd新增以下▪ shutdown:!:0:0::/u/shutdown:/usr/sbin/shutdown -Fr +1

root:p650@/> cat /etc/passwd |grep -i shutdownshutdown:!:0:0::/u/shutdown:/usr/sbin/shutdown -Fr +1root:p650@/> su - shutdown 3004-614 Unable to change directory to "/u/shutdown".

You are in "/home/guest" instead.

SHUTDOWN PROGRAMTue Jun 29 16:32:29 TAIST 2010

Wait for 'Rebooting...' before stopping. Error reporting has stopped.

Page 63: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

66

逾時自動登出

• 設定TMOUT參數

• 逾時最少為60秒

root:52A@/ #export TMOUT=61root:52A@/ #echo $TMOUT61root:52A@/ #Shell will time out in 60 seconds.ksh: Timed out waiting for input.

Page 64: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

67

禁止非root用戶登入系統

• 於/etc/下建立nologin檔案,檔案內容可以寫入提示訊息

root:52A@/ #echo "\n\nSystem is in maintainence, could not login now!" > /etc/nologin

AIX Version 6Copyright IBM Corporation, 1982, 2009.login: marsmars's Password:

System is in maintainence, could not login now!

Page 65: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

68

登入時不顯示帳戶名稱

• 使用以下指令將 /etc/security/login.cfg中參數usernameecho設為false

• 還原設定

root:52A@/ # chsec -f /etc/security/login.cfg -s default -a usernameecho=false

AIX Version 6Copyright IBM Corporation, 1982, 2009.login: ****'s Password:

root:52A@/ # chsec -f /etc/security/login.cfg -s default -a usernameecho=true

AIX Version 6Copyright IBM Corporation, 1982, 2009.login: rootroot's Password:

Page 66: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

69

變更密碼提示

• 使用以下指令自訂 /etc/security/login.cfg中參數pwdprompt

root:52A@/ # chsec -f /etc/security/login.cfg -s default -a usernameecho=true

AIX Version 6Copyright IBM Corporation, 1982, 2009.login: ****'s Password:

Page 67: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

70

密碼長度超過8個字元

• 使用以下指令自訂 /etc/security/login.cfg中參數pwd_algorithm

※需支援LPA(AIX 5.3 TL7、AIX 6.1之後)

root:52A@/ # chsec -f /etc/security/login.cfg -s usw -a pwd_algorithm=smd5

Page 68: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

71

smit fast path

• Fast path to menu: security

操作內容 快速路徑Users

Add a UserChange a User’s PasswordChange/Show Characteristics of a UserLock/Unlock a User’s AccountReset User’s Failed Login CountRemove a UserList All Users

usersmkuserpasswdchuserlockuserfailed_loginsrmuserlsuser

GroupsList All GroupsAdd a GroupChange/Show Characteristics of a GroupRemove a Group

groupslsgroupmkgroupchgrouprmgroup

Page 69: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

72

操作內容 快速路徑PasswordsChange a User’s PasswordChange/Show Password Attributes for a User

passwordspasswdpasswdattrs

Login ControlsChange/Show Login Attributes for a UserChange/Show Login Attributes for a Port

loginslogin_userlogin_port

Page 70: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

73

儲存體管理

Page 71: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

74

Logical Volume Manager

AIX的一部分,不需額外費用

• 優點

▪ 跨磁碟

▪ 動態擴增容量(硬碟/磁碟)

▪ 空間可重新調配

▪ 解決空間不連續的問題

▪ 可做鏡像

• 缺點

▪ 災難復原難度提高

Page 72: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

75

LVM基本概念

• PV = Physical Volume▪ 磁碟裝置(DASD)▪ 在AIX系統上看到名稱為hdisk#

• VG = Volume Group▪ 一個或多個磁碟的集合▪ 第一個VG稱為rootvg

• LV = Logical Volumes▪ 可做RAID 0或RAID 1

• PP = Physical Partition▪ PV的最小分割單位,同一PV/VG上PP大小必為相同

• LP = Logical Partition▪ 邏輯空間,至少對應至 1個以上的PP

Page 73: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

76

Physical Volume

• 下列儲存方式在AIX系統上皆稱為PV

▪ SCSI

▪ Fibre

▪ SSA

▪ SATA

▪ SAS

• 在AIX上以hdiskn命名

hdisk0 hdisk1 hdisk2 hdisk3 hdisk4

Page 74: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

77

Volume Group

• 使用PV前必須先加入一個VG中

• 一個PV同一時間內只能屬於一個VG

• 不同規格、大小的硬碟可存在於同個VG中

hdisk0 hdisk1 hdisk2 hdisk3 hdisk4

VG type Max PVs Max LVs Max PPs per VG Max PP size

Normal VG 32 256 32512 (1016*32) 1 GB

Big VG 128 512 130048 (1016*128) 1 GB

Scalable VG 1024 4096 2097152 128 GB

Page 75: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

78

Physical Partition & Logical Partition

• PP size == LP size

• LP是對應至PP(1:1、1:2、1:3)

LP1 LP8 LP9

PP8PP38

PP42

LV - normal

Page 76: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

79

Physical Partition & Logical Partition

• PP size == LP size

• LP是對應至PP(1:1、1:2、1:3)

LP1 LP8 LP9 LP8 LP9

PP8PP38

PP42

PP13

PP98

PP13

PP98

LV - normal LV - mirror

Page 77: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

80

Logical Volume

• 由一個以上的LP組合而成

• 用途

▪ filesystem

▪ raw device for database

▪ paging space

▪ jfs log

Page 78: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

81

Page 79: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

82

Application Layer

LogicalVolume

Manager(Logical Layer)

Physical Layer

LVM Architecture

Physical Disk

Adapter

(SCSI / HBA …)Device Driver

(3)?

Logical Volume Device Driver

(1)? (2)?

RAW deviceFile System

(4)? (5)?

Physical Disk

Storage

(6)?

Page 80: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

83

VGDA

• 包含一切關於VG的重要資訊

Page 81: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

84

Quorum

• LVM用來確定VG已經準備好可使用且VGDA中資料為一致的機制

• 當VGDA的數量無法超過51%時候VG無法varyon,也就是Quorum為遺失的狀態

Page 82: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

85

Logical Volume Control Block(LVCB)

• LV前的512的位元組

• 保留LV的中的重要資訊

▪ 建立日期

▪ copy的資訊

▪ 關於mount point的資訊

Page 83: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

86

新增磁碟至系統時該考慮?

• 加入現有VG或是建立新的VG ? (mkvg or extendvg)

• PP size

Page 84: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

87

匯入磁碟區群組(importvg)

1. cfgmgr

2. importvg -y [vgname] hdisk#

3. mount

Page 85: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

88

匯出磁碟區群組(exportvg)

1. umount

2. varyoffvg [vgname]

3. exportvg [vgname]

4. rmdev -dl hdisk#

Page 86: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

89

變更磁碟區群組名稱

1. umount

2. varyoffvg [vgname]

3. exportvg [vgname]

4. importvg -y [new_vgname] hdisk#

5. mount

Page 87: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

90

移動LV至不同VG(cplv)

• umount

• smitty cplv

Page 88: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

91

mirroring

• mirror是作用在LV的部分(並非硬碟)

• 每個LV可有2或3個copy

• 越簡單越好

220

223 234 235

190 191 192 193

← LP number

PP number →

mirrored LV : hd9var

1 2 3 4

mapping

Page 89: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

92

越簡單越好

jfslog /fs

/fs/data /fs/orig

/fs/logs /fs/bak

/fs/… /fs/…

jfslog

/fs

LVs

Page 90: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

93

Striping

• RAID 0

• 將資料切成小段

• non-redundancy

PV1 PV2 PV3

stripe LV1 2 3 4

Page 91: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

95

smit fast path• Fast path to menu: storage操作內容 快速路徑Logical Volume Manager lvm

Volume GroupsList All Volume GroupsAdd a Volume GroupsSet Characteristics of a Volume GroupList Contents of a Volume GroupRemove a Volume GroupActivate a Volume GroupDeactivate a Volume GroupImport a Volume GroupExport a Volume GroupMirror a Volume GroupUnmirror a Volume GroupSynchronize LVM MirrorsBack Up a Volume GroupRemake a Volume GroupList Files in a Volume Group BackupRestore Files in a Volume Group Backup

vglsvg2mkvgvgsclsvg1reducevg2varyonvgvaryoffvgimportvgexportvgmirrorvgunmirrorvgsyncvgvgbackuprestvglsbackvgrestsavevg

Page 92: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

96

操作內容 快速路徑Logical Volumes

List All Logical Volumes by Volume GroupAdd a Logical VolumeSet Characteristics of a Logical VolumeShow Characteristics of a Logical VolumeRemove a Logical VolumeCopy a Logical Volume

lvlsvgmklvlvsclslvrmlvcplv

Physical VolumesAdd a DiskChange Characteristics of a Physical VolumeList Contents of a Physical VolumeMove Contents of a Physical Volume

pvmakdskchpvlspvmigratepv

Page 93: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

97

檔案系統

Page 94: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

98

檔案

• 指令是可執行的檔案

• 系統權限的控制大部分是由限制檔案的存取來達成

Page 95: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

99

目錄及i-node

# mode user group date size location

36946 755 root system 090806 13:23 256 data block

36947 444 root system 090806 13:23 30788 data block

i-node type

#36946 dir

#36947 file

• 目錄也是一種特殊格式的檔案

• 目錄中的項目包含檔案或子目錄名稱,與一索引節點參考號碼 (i-node 號碼)

• inode 號碼會記錄檔案的其他相關資訊,包括修改與存取時間、存取模式、鏈結數目、檔案擁有者和檔案類型、資料區塊位置。

Page 96: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

100

檔案/目錄權限

• 執行script時shell必須讀取檔案內容並直譯,所以同時需要讀取權以及執行權。

• 對於程式,只需要執行權(執行時直接載入記憶體中),並不需要讀取權。

• 對目錄來說,進入目錄只需要有執行權,列出目錄就必須加上讀取權。

• 刪除目錄中的檔案同時需要寫入權及執行權。

存取動作 對一般檔案的意義 對目錄的意義

r 檢視檔案內容 檢視目錄內容(使用指令ls)

w 修改檔案內容 修改目錄內容(刪除檔案)

x 執行可執行檔 切換、搜尋目錄 (使用指令 cd)

Page 97: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

101

變更權限

• 更改多個檔案權限:# chmod g+w file1 file2

• 對於目錄移除讀取權限加入執行權限:# chmod go-w+x mydir

• 給予檔案擁有者有讀取、寫入、執行權限重設群組及其他權限:# chmod u=rwx,go= cmd

• 使用數字表示法授予檔案擁有者讀取寫入權,群組及其他為讀取權:# chmod 644 file

※不指定存取等級時,預設為a並使用系統umask

※預設檔案權限為644,目錄權限為755

使用命令 存取等級 算符 存取權限 目標

chmod

u(user)

g(group)

o(others)

+ (加入設定) r w x filenameor

directory- (移除設定)

a(代表上面3個)

4 2 1= (重新設定)

Page 98: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

102

umask

• 系統預設 022

• 檔案預設權限 666 - 022 = 644

▪ -rw-r--r--

• 目錄預設權限 777 - 022 = 755

▪ drwxr-xr-x

Page 99: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

103

變更所有權

• 變更檔案使用者權限為jim:# chown jim filename

• 要將filename文件或目錄的組所有權更改為群組staff# chgrp staff filename

• 將mydir下所有文件或子目錄變更所有權為群組staff# chgrp -R staff mydir/

• 將目錄mydir下文件或子目錄變更為使用者jim及群組為staff:# chown jim:staff mydir/

# chown jim.staff mydir/

※只有root能使用chown變更所有權

Page 100: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

104

檔案系統

• 不同檔案系統是透過目錄結構串連起來

• 檔案與目錄結構的階層式結構

• 位於單一邏輯磁碟區(Logic al Volume)上

• AIX 支援的檔案系統

▪ JFS

▪ JFS2

▪ CDRFS、UDFS

▪ NFS

▪ GPFS

Page 101: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

105

檔案系統結構

/ (根)檔案系統

檔案系統

/home /usr /tmp /var /proc

目錄

/dev /lib /etc /dev /bin /sbin

Page 102: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

106

檔案系統結構說明

Logical Volume 檔案系統/目錄 說明

/dev/hd4 / 檔案系統目錄頂端

/dev/hd1 /home 使用者的起始目錄

/dev/hd2 /usr 使用者可以用的指令,共用函式庫..等

/dev/hd3 /tmp 讓系統或是使用者暫存資料

/dev/hd9var /var 包含常需要變動的資料

/proc /proc 包含系統中處理程序及執行緒狀態的資訊

/dev 包含特殊的輸入/輸出 (I/O) 裝置檔案。

/lib 公用的函式庫

/etc 系統配置檔、設定工具、系統管理程式

/bin 連結至/usr/bin中,包含一些shell script及公用程式

/sbin 系統配置檔、設定工具、系統管理程式

Page 103: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

107

JFS及JFS2的比較

功能 JFS2 JFS

最大檔案系統大小 32TB 1TB

最小檔案系統大小 16MB 不適用

最大檔案大小 16TB 64GB

i-node的數目 動態,受磁碟空間限制 固定,建立時設定

目錄組織 B-tree 線性

建立時的預設權限 root.system sys.sys

壓縮 否 是

限額 是 是

錯誤記載 是 是

※搭配32bit kernel時系統會對LV上的大小採取限制、最大檔案大小及最大檔案系統大小限制為1TB - 實體分割區大小。

Page 104: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

109

掛載/卸載檔案系統

• 檔案、目錄、裝置透過掛載成為檔案系統是可存取的唯一方法。

• 對被裝載的裝置或目錄需存取權限及對裝載點的寫入許可權,則可裝載。

# mount /dev/lv00 /mydir

# monut -a

# umount /mydir

Page 105: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

110

建立檔案系統

1. 直接建立檔案系統

2. 建立檔案系統於已定義的LV上

▪ 可調整LV的相關參數

▪ 如該LV內有資料會遺失

Page 106: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

111

擴大檔案系統的空間

• smitty chfs

Page 107: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

112

可否縮小檔案系統?

• AIX 5.3之前不論jfs或是jfs2都不行

• AIX 5.3之後只有jfs2才可動態縮小

• 所指定的檔案系統大小不能小於1個PP大小

• smitty chfs

Page 108: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

113

移除檔案系統

• smitty rmfs

Page 109: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

114

檔案系統及目錄相關指令指令名稱 使用範例 指令說明

cat cat file 顯示檔案內容

cd cd / , cd - , cd ~ 變更當前目錄

cp cp file file.bak 複製檔案或資料夾

df df -k 顯示已掛載檔案系統空間資訊

find find / -name filename 尋找檔案

grep grep string filename 於內容中尋找字串

mkdir mkdir /dir , mkdir -p /dir/dir2 建立目錄

more ls -l |more 每次一屏(screen)顯示內容

mv mv file file.bak 變更/搬移檔案或資料夾

pwd pwd 顯示當前目錄

rm rm file , rm -rf mydir/ 移除檔案或資料夾

※使用man command查看上述命令詳細用法

Page 110: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

115

smit fast path操作內容 快速路徑File Systems

List All File SystemsList All Mounted File SystemsAdd/Change/Show/Delete File SystemsMount a File SystemMount a Group of File SystemsUnmount a File SystemUnmount a Group of File SystemsVerify a File SystemBackup a File SystemRestore a File SystemList Contents of a Backup

fslsfsmountmanfsmountfsmountgumountfsumountgfsckbackfilesysrestfilesyslisttoc

Files & DirectoriesBackup a File or DirectoryRestore a File or DirectoryList Contents of a Backup

filemgrbackfilerestfilelisttoc

Page 111: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

124

系統服務與排程管理

Page 112: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

125

System Resource Controller (SRC)

• 提供指令便於系統管理者控制系統服務,機制如下

▪ 啟動、停止及狀態查詢

▪ 記載子系統的異常終止

▪ 追蹤子系統、子系統群組或子伺服器

▪ 支援遠端控制系統的上的作業

▪ 配置資料變更後重新整理子系統

• 由/etc/inittab中帶起srcmstr 的服務

Page 113: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

126

啟動、停止及狀態查詢

root:55a@/> startsrc -s snmpd0513-059 The snmpd Subsystem has been started. Subsystem PID is 94.

root:55a@/> startsrc -g nfs0513-059 The biod Subsystem has been started. Subsystem PID is 9178.0513-059 The nfsd Subsystem has been started. Subsystem PID is 3290.0513-059 The rpc.mountd Subsystem has been started. Subsystem PID is 299178.0513-059 The nfsrgyd Subsystem has been started. Subsystem PID is 270504.0513-059 The gssd Subsystem has been started. Subsystem PID is 8676.0513-059 The rpc.lockd Subsystem has been started. Subsystem PID is 209034.0513-059 The rpc.statd Subsystem has been started. Subsystem PID is 307366.

• startsrc [-s subsystem_name | -g group_name]

Page 114: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

127

• stopsrc [-s subsystem_name | -g group_name]root:55a@/> stopsrc -s snmpd0513-044 The snmpd Subsystem was requested to stop.

root:55a@/> stopsrc -g nfs0513-044 The biod Subsystem was requested to stop.0513-044 The nfsd Subsystem was requested to stop.0513-044 The rpc.mountd Subsystem was requested to stop.0513-044 The rpc.statd Subsystem was requested to stop.0513-044 The rpc.lockd Subsystem was requested to stop.

Page 115: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

128

• lssrc [-a | -s subsystem_name | -g group_name]

root:55a@/> lssrc -aSubsystem Group PID Status syslogd ras 241784 activesendmail mail 245882 activeportmap portmap 237696 activeinetd tcpip 229502 activeroot:55a@/> lssrc -g nfsSubsystem Group PID Status biod nfs 389178 activenfsd nfs 303290 activerpc.mountd nfs 299178 activerpc.lockd nfs 209034 activerpc.statd nfs 307366 activenfsrgyd nfs inoperativegssd nfs inoperative

Page 116: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

129

重新整理子系統

• refresh [-s subsystem_name | -g group_name]

root:55a@/>refresh -s inetd0513-095 The request for subsystem refresh was completed successfully.

root:55a@/>refresh -g nfs0513-005 The Subsystem, biod, only supports signal communication.0513-005 The Subsystem, nfsd, only supports signal communication.0513-005 The Subsystem, rpc.statd, only supports signal communication.0513-005 The Subsystem, rpc.lockd, only supports signal communication.0513-005 The Subsystem, rpc.mountd, only supports signal communication.0513-036 The request could not be passed to the nfsrgyd subsystem.Start the subsystem and try your command again.0513-036 The request could not be passed to the gssd subsystem.Start the subsystem and try your command again.

Page 117: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

130

啟動、停止及狀態查詢

指令名稱 參數 說明

startsrc -s subsystem_nameor

-g group_name

啟動服務

stopsrc 停止服務

lssrc 列出服務狀態

Page 118: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

131

$HOME/.profile

• 使用者的個人設定檔

▪ PATH的變數

▪ PS1=`whoami`:`hostname`@'$PWD>'

▪ set -o vi

Page 119: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

132

cron daemon

• cron daemon可在指定的日期、時間執行crontab中的排程工作

• 每個使用者的crontab放在/var/spool/cron/crontabs/$USER

• cron daemon於系統啟動時帶起

• cron daemon 的log放在/var/adm/cron/log

root:55a@/>cat /etc/inittab |grep -i croncron:23456789:respawn:/usr/sbin/cron

Page 120: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

133

crontab format

• 每個cron排程包含6個欄位使用空白隔開

▪ minute 0 到59

▪ hour 0 到23

▪ day_of_mouth 1 到31

▪ mouth 1 到12

▪ weekday 0 到6 (星期日開始至星期六)

▪ command shell 命令

0 15 * * * /usr/lib/ras/dumpcheck >/dev/null 2>&1

Page 121: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

134

crontab format

• 必須為每個欄位指定一個值

▪ 要在三月時執行一個指令,月欄位指定3

▪ 星期一至星期四,週欄位指定1-4

▪ 每月1日及31日執行,日欄位指定1,31

▪ * (星號)表示允許所有的值

• 使用crontab -l 列出目前使用者的排程

• 使用crontab -e 編輯目前使用者的排程

* * * 3 * /usr/lib/ras/dumpcheck >/dev/null 2>&1

* * * 3 1-4 /usr/lib/ras/dumpcheck >/dev/null 2>&1

* * 1,31 3 1-4 /usr/lib/ras/dumpcheck >/dev/null 2>&1

Page 122: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

135

備份及回復

Page 123: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

136

備份原則

• 資料多久變更一次

• 重建資料有多困難

• 確定可從嚴重的資料損壞(毀)事件下回復

• 定期檢查備份

• 保留舊的備份

• 備份之前先檢查檔案系統

▪ 確定備份期間檔案不在使用當中

▪ 對系統進行重大變更之前先作備份

Page 124: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

137

備份媒體

• 磁帶

▪ 4mm DAT (DDS2,3,4,5)

▪ 8mm DAT (2.3GB、5GB、20GB、40GB)

▪ LTO (100GB、200GB、400GB、800GB)

• 光碟

• 其他

▪ 遠端磁碟機

Page 125: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

138

備份系統( rootvg )

使用mksysb

• 只備份rootvg

• 只備份rootvg中掛載(mount)的檔案系統

• 備份的裝置可用來開機、還原系統

• 可用來回復單一或多個檔案

• 備份時會保留系統paging space的定義

• 備份時會保留系統Logical Volume的定義

• 實際備份是使用backup指令完成

Page 126: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

139

mksysb 的格式

kernel

device driver

./image.data

./tapeblksz

./bosinst.data

rootvg mounted filesystem

使用backup指令

Block Size 512 Block Size 512 Block Size 512Block size

define by device

BOS Bootimage

mkinsttapeimage

dummy .toc rootvg data …

Page 127: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

140

還原rootvg

• 使用系統備份帶開機或是AIX系統光碟開機

• 進入系統維護模式進行系統還原

Page 128: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

141

從mksysb中還原檔案

• 使用指令restorevgfiles從系統備份帶中還原檔案

root:55a@/> restorevgfiles -r -f /dev/rmt0 ./bosinst.dataNew volume on /dev/rmt0.1:Cluster size is 51200 bytes (100 blocks).The volume number is 1.The backup date is: Thu May 20 18:34:46 GMT+08:00 2010Files are backed up by name.The user is root.x 5988 ./bosinst.dataThe total size is 5988 bytes.The number of restored files is 1.

Page 129: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

142

備份使用者Volume Group

使用savevg指令

• VG需varyon

• 要備份的檔案系統需掛載

• 備份datavg至磁帶中

• 如果備份時需要排除某些檔案,建立/etc/exclude.vgname檔案

• 備份datavg至磁帶中,但忽略/etc/exclude.datavg中所包含的內容

root:55a@/> savevg -if /dev/rmt0 datavg

root:55a@/> savevg -ief /dev/rmt0 datavg

Page 130: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

143

還原使用者Volume Group

• 使用smitty resetvg

Page 131: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

144

備份檔案/檔案系統

• 備份檔案 smitty backfile

• 備份檔案系統 smitty backfilesys

• 備份所有檔案及子目錄 (backup指令)

• 備份所有檔案及子目錄 (tar指令)

▪ 注意絕對路徑及相對路徑的差別(建議使用相對路徑)

▪ tar 有檔案大小的限制(8G)

root:55a@/> find /home -print | backup -if /dev/rmt0

root:55a@/> tar -cvf /dev/rmt0 ./home

Page 132: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

145

還原檔案/檔案系統

• 還原檔案 smitty restfile

• 還原檔案系統 smitty restfilesys

• 查看backup指令所產生的檔案格式

• 使用restore指令還原backup所備份的所有檔案

root:55a@/> restore -Tvf /dev/rmt0

root:55a@/> restore -rvf /dev/rmt0

Page 133: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

146

• 檢視tar指令所產生的檔案格式

• 還原tar指令所產生的檔案格式

▪ 還原時需注意路徑

root:55a@/> tar -tvf /dev/rmt0

root:55a@/> tar -xvf /dev/rmt0

Page 134: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

147

其他備份指令

• cpio

▪ 將檔案複製到保存儲存體,或從其中複製檔案

• dd

▪ 轉換及複製檔案

• pax

▪ 讀取及寫入 tar 及 cpio 保存檔

Page 135: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

148

Common backup and restore errorsError Code 說明 可能原因及處理方式

0512-016 Attempt to create a bootable tape failed

Ensure media not write protected.Check and extend file system space if necessary.Ensure enough space in /tmp and /usr.Check status of tape drive.Restore the original directories.Check and recreate missing /unix link.

0503-350 Error occurred while running the restore command

installp fails due to a damaged tape or drive.installp fails due to insufficient space in /var, /tmp.installp fails due to insufficient paging space.

0511-051 Read failed Block size of restore device incorrect;incorrect value specified with bs, ibs or obs flag;incorrect value specified with fskip flag;tape is damaged.

0511-080 Path name is too long During the backup process, the find commandcould not locate data because the path namespecified was too long.

Page 136: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

149

設備管理

Page 137: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

150

Object Data Manager

• AIX用來儲存系統資料的管理程式

▪ 裝置配置資訊

▪ SMIT(功能表、選擇器及對話框)的顯示資訊

▪ 安裝及更新程序的重要產品資料

▪ 通訊配置資訊

▪ 系統資源資訊

Page 138: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

151

Devices

• Physical Devices

• Ports

• Device Drivers

• Logical Devices

• /dev Directory

Page 139: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

152

types of devices

1. block device

▪ 通常支援隨機存取和定址,並使用緩衝區;像是檔案系統

2. character (raw) device

▪ 通常不支援隨機存取,存取時候不使用緩衝區

3. pseudo-devices

▪ 沒有裝置及物理設備對應關係的

Page 140: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

153

block devices

• cd0 CD-ROM

• fd0, fd0l, fd0h Diskette

• hd1, lv00 Logical volume

• hdisk0 Physical volume

Page 141: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

154

character (raw) device

• console, lft, tty0 Terminal

• lp0 Printer

• rmt0 Tape drive

• tok0, ent0 Adapter

• kmem, mem, null Memory

• rfd0, rfd0l, rfd0h Diskette

• rhd1, rlv00 Logical volume

• rhdisk0 Physical volume

Page 142: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

155

pseudo-devices• /dev/null

▪ 接受和丟棄所有輸入;即不產生任何輸出。

• /dev/full▪ 永遠在被填滿狀態的設備。

• /dev/loop▪ Loop設備

• /dev/zero▪ 產生連續的NUL字元的串流(數值為0)。

• /dev/random▪ 產生一個虛假隨機的任意長度字元串流。(Blocking)

• /dev/urandom▪ 產生一個虛假隨機的任意長度字元串流。(Non-

Blocking)

Page 143: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

156

裝置狀態

• Undefined (未定義)

▪ 系統中未儲存設備的有關記錄

• Available (可用)

▪ 設備已定義並且已經就緒,能夠為系統所用,邏輯設備名允許存取

• Defined (已定義)

▪ 系統儲存了設備的邏輯設備名、連接設備的port以及其他屬性,但是設備還不能使用,並且邏輯設備名不可存取

Page 144: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

157

cfgmgr

• 偵測及配置新裝置

• parallel、serial port的裝置要需手動config

• 使用cfgmgr -l [parent-adapter]可針對特定裝置執行偵測

Page 145: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

158

查看目前裝置的設定

• lscfg

▪ 顯示系統的配置信息、診斷信息和重要產品數據(VPD)信息。

• lsdev

▪ 顯示系統中的設備及其特徵。

• lsattr

▪ 顯示系統中設備的屬性特徵和可能的屬性值。

Page 146: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

159

如何將設備從系統中完全刪除?

• 使用命令將與該設備及相關的子設備從系統中刪除

▪ rmdev -dl [device_name] -R

root:55a@/> rmdev -dl fcs0 -Rfcnet0 deleteddac0 deleteddac1 deletedfscsi0 deletedfcs0 deleted

Page 147: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

160

實體移除裝置(hot-plug)

• 使用diag中的Hot Plug Task來進行

Page 148: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

161

smit fast path

• Fast path to menu: dev

Page 149: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

162

網路管理

Page 150: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

163

網路服務啟動過程

systempoweded on

1

cfgmgr2

run-time init

3

system ready to login

4

/etc/rc.net

rc.tcpip:/etc/rc.tcpip

syslogdlpdroute or gatedsendmailportmapinetd…..

Page 151: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

164

名稱解析

• 搜尋順序:

1. DNS Server (/etc/resolve.conf )

2. NIS

3. /etc/hosts

• 建議:

1. /etc/hosts

2. DNS Server

3. NIS

Page 152: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

165

/etc/netsvc.conf

• 設定名稱解析順序

• 加入hosts=local,bind於檔案中

• 加入NSORDER=local,bind於/etc/environment

※NSORDER變數會覆蓋etc/netsvc.conf的設定

root:52A@/ # cat /etc/netsvc.confhosts=local,bind

Page 153: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

166

/etc/resolv.conf

• 定義DNS Server的檔案

root:52A@/ # echo "nameserver 168.95.1.1" >/etc/resolv.confroot:52A@/ # nslookup> set allDefault server: 168.95.1.1Address: 168.95.1.1#53...> test.123.twServer: 168.95.1.1Address: 168.95.1.1#53

Non-authoritative answer:Name: test.123.twAddress: 61.999.66.140

Page 154: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

167

/etc/hosts

• 記錄IP對應主機名稱的檔案

root:52A@/ # cat /etc/hosts

127.0.0.1 loopback localhost # loopback (lo0) name/address192.168.1.222 52A 52A.test.123.tw

root:52A@/ # ping 52a PING 52A: (192.168.1.222): 56 data bytes64 bytes from 192.168.1.222: icmp_seq=0 ttl=255 time=0 ms64 bytes from 192.168.1.222: icmp_seq=1 ttl=255 time=0 ms

root:52A@/ # ping 52a.test.123.twPING 52A: (192.168.1.222): 56 data bytes64 bytes from 192.168.1.222: icmp_seq=0 ttl=255 time=0 ms64 bytes from 192.168.1.222: icmp_seq=1 ttl=255 time=0 ms

Page 155: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

168

/etc/inetd.conf

• 網路服務inetd的定義檔

▪ ftpd

▪ telnetd

▪ rshd

▪ rlogin

• 修改後使用refresh -s inetd重新讀取,目前session不受影響

Page 156: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

169

增加靜態路由(static route)

• smitty route

Page 157: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

170

配置網路設定

• smitty tcpip

Page 158: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

171

smit fast path

• Fast path to menu: commo

操作內容 快速路徑TCP/IP tcpip

Minimum Configuration & Startup mktcpip

Further ConfigurationHostnameStatic RoutesNetwork InterfacesName ResolutionClient Network ServicesServer Network ServicesManage Print ServerSelect BSD style rc ConfigurationAuthentication Configuration

configtcphostnameroutenetinterfacenamerslvclientnetruserserversetbootup_optionauth_config

Page 159: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

172

操作內容 快速路徑Use DHCP for TCPIP Configuration & Startup usedhcp

IPV6 ConfigurationIPV6 Static RoutesIPV6 Network InterfacesIPV6 Daemon/Process Configuration

configtcp6route6inet6daemon6

Quality of Service Configuration & StartupStart Using the QoS SubsystemStop Using the QoS Subsystem

configqosstartqosstopqos

NFS nfs_menus

Configure TCP/IP (If Not Already Configured) tcpip

Network File System (NFS)Configure NFS on This SystemAdd a Directory to Exports ListChange/Show Attributes of an Exported DirectoryRemove a Directory from Exports ListAdd a File System for Mounting Change/Show Attributes of an NFS File SystemRemove Remove an NFS File System

nfsnfsconfiguremknfsexpchnfsexprmnfsexpmknfsmntchnfsmntrmnfsmnt

Page 160: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

173

AIX commands for management

Page 161: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

174

Manage Processor Description

vmstat Virtual Memory Management stats

sar System Activity Reporter

tprof and gprof CPU utilization

topas and nmon Top Applications stats

wlmsat Workload Manager stats

bindprocessor Bind a process to a processor

xmperf GUI Performance monitor

smtctl SMT control

procmon Process monitor

schedo Process scheduler

nice Process nice value

Manage Network Description

netstat Network stats

no Network options

nfso NFS options

nfsstat NFS Stats

topas and nmon Top Applications stats

netpmon Network monitor

wlmstat Workload Manager stats

iptrace Network trace

ifconfig Interface management

chdev Tune physical device

fcstat HBA stats

Manage Memory Description

vmstat Virtual Memory Management stats

sar System Activity Reporter

vmo Virtual Memory Tuning

svmon System Virtual Memory Monitor

rmss Reduced Memory System Simulator

topas and nmon Top Applications stats

xmperf GUI Performance monitor

wlmstat Workload Manager stats

ps Process memory utilization

pagesize Page size management

Manage Virtualization Description

schedo Processor scheduling

lparstat LAPR Stats

mpstat PHYP stats

topas Top Applications stats

hpmcount Hardware Performance Monitoring

hpmstat Hardware Performance Monitoring

Page 162: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

175

Manage LVM, JFS2 and I/O Description

vmstat Virtual Memory Management stats

sar System Activity Reporter

chdev AIO, physical and logical devices

ioo I/O tuning

iostat I/O stats

vmstat I/O stats

topas and nmon Top Applications stats

filemon File I/O monitor

Lsps, chps Paging space management

lvmstat or lvmo Logical Volume stats

wlmstat WLM Stats

fileplace Placement of a file in a filesystem

ncheck Inode check

lsps Paging space monitoring

df Filesystem management

xmperf GUI Performance monitor

Manage Kernel Description

ipcsInterprocess communications (shared memory,

queue and semaphore)

schedo Processor scheduling

schedtune Process scheduling tuning

ps Process state

ncheck Kernel tuning

chdev –l sys0 Tune kernel parameters

pstat Various kernel inf.

trace System trace

sysdumpdev Manging system dump device

curt CPU Utilization Reporting Tool

splat Simple Performance Lock Analysis Tool

procmon View and manage processes

tunchange, tuncheck,

tunrestore, tunsave,

tundefault

Update tunable stanzas

raso RAS tuning

Manage Application Description

emstat Emulated instruction stats

gprof Application profiling

truss Application profiling

probevue Application profiling

timing Application profiling

prof Application profiling

tprof Application profiling

Page 163: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

181

Shell

Page 164: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

182

shell

• 使用者跟作業系統溝通的介面

• 登入時從/etc/passwd中載入設定的shell

使用者/ AP

Shell

AIX Kernel

Hardware

Page 165: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

183

shell的種類

• Bourne shell

▪ 使用時會讀取/etc/profile中找到的指令,及$HOME/.profile (若有的話)

• C shell

▪ 語法和 C 語言相似

▪ 使用時讀取/etc/csh.cshrc 、 /etc/csh.login、/etc/csh.cshrc及$HOME/.cshr

• Korn shell(AIX預設shell)

▪ 使用時候讀取/etc/profile、$HOME/.profile、$HOME/.kshrc

Page 166: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

184

Korn shell常用內建指令指令名稱 說明

alias 在標準輸出上列印一個別名清單。

bg 將指定的工作置於背景。

cd 將現行目錄改變成指定的目錄,或將現行字串替換成指定的字串。

echo 將字元字串寫入標準輸出。

fc自最後在終端機上鍵入的 HISTSIZE 變數指令中選取一個指令範圍。在執行新舊 替代之後,重新執行指定的指令。

fg 將指定的工作帶至前景。

jobs 列出指定工作的資訊。

kill 傳送 TERM (終止) 信號給指定的工作或處理程序。

print 會將 shell 列印輸出。

pwd 相當於 print -r -$PWD 指令。

unalias 從別名清單中移除名稱清單的參數。

*只列出常使用部分

Page 167: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

185

Korn shell常用的變數

• PATH▪ 指出指令的搜尋路徑,是以冒號隔開的目錄路徑名稱之依序清單

• PS1▪ 指定用來作為主要系統提示的字串。依預設值為 $

• PS2▪ 指定第二個提示字串的值,根據預設值,這是 >

• PS3▪ 指定 select 迴路中使用的選項提示字串的值,根據預設值,它是 #?

• TMOUT▪ 於規定的秒數之內未輸入指令的話, shell 將會結束

Page 168: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

186

Korn shell的指令紀錄

• 預設存放於$HOME/.sh_history

• 使用內建指令history來列出歷史指令

root:55a@/>history747 ps -fl |grep 495796748 clear749 ps -hef |grep 495796750 man ps751 ps -ef -o pid ppid |grep 495796752 ps -ef -o=pid |grep 495796753 ps -ef -o=pid -o=ppid |grep 495796754 clear755 clear756 echo $$

Page 169: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

187

輸入輸出及導向

使用方式 說明

cmd > file 標準輸出導向至file

cmd >> file 標準輸出附加至file

cmd 1>file 標準輸出導向至file

cmd > file 2>&1 標準輸出、錯誤輸出導向至file

cmd 2>file 錯誤輸出導向至file

cmd < file >file2 cmd命令從file中當作標準輸入,輸出導向至file2

cmd < file cmd命令從file中當作標準輸入

cat <> file 讀寫方式打開 file

cmd >/dev/null 將輸出導向至/dev/null

stdin0

command

stdout1

stderr2

Page 170: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

188

pipe管線

• |

• 左到右將指令的輸出轉向成為另一個指令的輸入

• ||

• 第一個指令傳回值<>0時執行

root:55a@/>ls -l |pgtotal 42656-rw------- 1 root system 77 Aug 12 10:40 .TTauthority-rw------- 1 root system 196 Aug 12 10:40 .Xauthoritydrwxr-xr-x 2 root system 256 May 08 12:01 .ccache

root:55a@/>fffff || df -kksh: fffff: not found.Filesystem 1024-blocks Free %Used Iused %Iused Mounted on/dev/hd4 524288 180340 66% 5475 12% //dev/hd2 3801088 802428 79% 53252 23% /usr

Page 171: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

189

Process(處理程序)• 是指令、Shell程式或另一個處理程序在系統中的一種活動

• 處理程序有下列屬性內容:▪ pid▪ pgid▪ uid▪ gid▪ environment▪ cwd▪ file descriptors▪ signal actions▪ process statistics▪ nice

Page 172: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

190

PID & PPID

root:55a@/>echo $$

442562

root:55a@/>ksh

# echo $$

495800

# ps -ef|grep 495800

root 495800 442562 0 21:49:22 pts/0 0:00 ksh

root 401474 495800 0 21:49:36 pts/0 0:00 grep 495800

root 544854 495800 1 21:49:36 pts/0 0:00 ps -ef

442562

495800

401474

544854

Page 173: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

191

處理程序的工作控制命令 意義 範例

& 於背景執行 $ cmd &

ctrl + Z 停止前景程序 $ ^Z

jobs 列出背景程序 $ jobs

fg 把背景程序帶到前景 $ fg %1

bg 重新開始背景程序 $ bg

kill 結束程序 $ kill %1

%Number 第n個背景程序

%String 指定任何以String 變數作為指令開頭的程序 $ fg %String

%?String 指定指令行中含有 String 變數的任何程序

%% 指定現行工作 $ fg %%

%%+ 相當於 %% $ fg %%+

%%- 指定上一個工作 $ fg %%-

Page 174: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

192

監看處理程序

• ps -ef

▪ 列出所有非核心處理程序

• ps -fu userid

▪ 列出該使用者所有處理程序

root:55a@/>ps -ef | egrep -v "STIME|$LOGNAME" | sort +3 -r | head -n 15

db2inst1 487658 491704 0 Aug 11 - 3:28 db2sysc 0

db2inst1 520398 491704 0 Aug 11 - 0:30 db2acd 0

db2inst1 372854 1 0 Aug 10 - 0:32 /opt/IBM/db2/V9.7/ud/bin/kuddb2/db2inst1

daemon 417904 209084 0 Aug 10 - 0:00 /usr/sbin/rpc.statd -d 0 -t 50

dasusr1 360466 1 0 Aug 10 - 0:00 /db2home/dasusr1/das/adm/db2dasrrm

Page 175: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

193

終止處理程序

• kill -term ProcessID

▪ 要求程式終止(如果程式具有SIGTERM 的處理程式),可能沒有作用

• kill -kill ProcessID

▪ 立即結束處理程序

• kill -l

▪ 列出系統定義的信號代碼及名稱

Page 176: AIX System Basic Concept and Administration · 2017-07-01 · 4 AIX系統的主要特點 • System Management Interface Tools smit and smitty.These are very good system admin tools

194