AIX命令

perfychi發表於2013-01-01
(1) smitty jfs2 建立檔案系統,同時指定掛載點;然後mount 掛載點。 也可以改變jfs2檔案系統大小。
(2) openssh
檢視openssh是否正在執行:
AIX53:/#lssrc -a | grep ssh
sshd ssh 979088 active
如果是inactive,可透過以下命令啟動ssh服務:
AIX53:/#startsrc -s sshd
停止ssh服務:
AIX53:/#stopsrc -s sshd

//檢視ssh軟體的安裝位置
bash-3.00# lslpp -f | grep sshd
                        /opt/pware/share/man/man8/sshd.8
                        /opt/pware/etc/sshd_config.default
                        /opt/pware/sbin/sshd
                        /opt/pware/share/man/man5/sshd_config.5
(3) smitty user 增加或者修改使用者屬性
  ->Change / Show Characteristics of a User  修改屬性
  -> Add a User 增加使用者
(4) 修改umask值  vi /etc/security/user 檔案
(5) 安裝軟體smit installp
                   
                       
(6)#install_assist 重啟後自動執行的安裝助手
(7) 安裝的時候避免夏時制
#date
結果出現DT就是夏時制
修改時區需要重啟機器,因此最好初次安裝的時候就設定好。                     

(8) smit輸出結果[top -bottom]  Esc + '>' 翻頁到最後(bottom)     ESC + < 翻頁到最前面(top)    '/'是查詢,N是查詢下一個 , 查詢的時候是不區分大小寫的
上面的> 和(9) smit.script. 與smit.transaction 的區別是
smit.script. 裡面的命令,smit不一定真正執行過。但是smit.transaction裡面的命令記錄的一定是smit執行過的命令。
#smit -x 可以做試驗, 沒有執行的命令, 所以在smit.transaction裡面沒有記錄,但是smit.script裡面有
(10) 單獨記錄日誌到別的檔案,不在smit.scipt和smit.log累加
#smit -s /tmp/smit.script. -l /tmp/smit.log

 (11) 安裝補丁
 instfix -k IY68477 -d /dev/cd0  ,從裝置/dev/cd0上安裝補丁IY68477
 instfix -ik IY68477 搜尋是否安裝過IY68477
 instfix -s SCSI  -d /dev/cd0  從裝置/dev/cd0上搜尋帶有SCSI字面的補丁
 instfix -i | grep ML
 
 (12) 檢視執行級別
     who -r
 (13) AIX的啟動模式:
     normal模式、sms模式、maintenance模式、    diagnoistic模式
    
     (14)啟動過程
     poweron ->post->locate os  bootstrap image ->find AIX boot image -> LOAD AIX boot image  RAMDISK created-> configration manage  Phase1-> INIT-> normal IPL
    
    
     (15) 察看architeture type
     [ root@rac1 / ]# bootinfo -p
   chrp (pci model ) comment hardware refrerence
     檢視硬體是多少位的:
[ root@rac1 / ]# bootinfo -y
   64
    檢視記憶體是多少K:
    bootinfo -r
   
    檢視作業系統是多少位的:
    bootinfo -K
   
檢視機器從那塊硬碟引導:
[ root@rac1 / ]# bootinfo -b
hdisk1

(16)系統啟動過程日誌alog命令(analyze log縮寫)
位於/var/adm/ras/***下,透過命令# alog -o -t boot檢視啟動日誌。

       -o
            Lists the contents of the log file. Writes the contents of the log
            file to standard 【output】in sequential order.
             -t 【LogType】
            Identifies a log defined in the alog configuration database. The
            alog command gets the log's file name and size from the alog

            configuration database. If LogFile does not exist, one is created.

列出日誌種類:
[ root@rac2 ppc ]# alog  -L  
boot
bosinst
nim
console
cfg
lvmcfg
lvmt
dumpsymp
           
[ root@rac1 ras ]# pwd
/var/adm/ras
[ root@rac1 ras ]# file errlog
errlog: data or International Language text
日誌檔案不是文字檔案,是資料檔案,所以需要用alog命令檢視

檢視安裝


/etc/inittab
format[ id:runlevel:action:command]
[ root@rac1 ras ]# alog -o -t bosinst | more

            If the alog command cannot get the information for the specified
            LogType from the alog configuration database or if the alog
            command is unable to write to LogFile, it writes to /dev/null.
           
          
          
          
 /etc/inittab用chitab, mkitab, rmitab修改  , lsitab檢視       
[ root@rac1 ras ]# chitab
chitab: 0481-203 Cannot specify more than one parameter.
Usage:  chitab "ident:runlevel:action:command"
[ root@rac1 ras ]# mkitab
mkitab: 0481-203 Cannot specify more than one parameter.
Usage:  mkitab "[-i ident] ident:runlevel:action:command"
[ root@rac1 ras ]# rmitab
rmitab: 0481-203 Cannot specify more than one parameter.
Usage:  rmitab "ident"
[ root@rac1 ras ]#
man rc
man /etc/inittab

[ root@rac2 ras ]# mkitab "tty2:2:respawn:/usr/sbin/getty /dev/tty2"
[ root@rac2 ras ]# lsitab tty2
tty2:2:respawn:/usr/sbin/getty /dev/tty2


(17) SRC: sussystem resource controller
檢視所有的資源:lssrc -a | more
檢視某組資源 :lssrc -g tcpip
停止某組資源:stopsrc -g tcpip
停止某項資源:stopsrc -s lpd
重新整理某項資源(重新讀取配置檔案,不重啟服務):refresh -s lpd

(18)關機
shutdown +2 ....
2min以後關機,提示資訊為。。。。
shutdown -F 關機
shutdown -r 重啟
shutdown -k 假關機
         Allows the administrator to broadcast the shutdown warning messages without causing the system to shut down.
            When the -k flag is used, no other shutdown activity occurs except for sending messages. For example, no
            processes are killed, no activity is logged in /etc/shutdown.log if the -l flag is specified, and if an
            /etc/rc.shutdown script. exists it does not run.
           
           
關機前關閉某些服務:
vi /etc/rc.shudown檔案裡定義

(19) 察看和修改系統環境
 比如語言、時間、桌面GUI
    #smitty system
        change/show characteristic of operation system ->    ARG/ENV list in 4K size blocks、Maximum number of PROCESSES allowed per user \
          Maximum login name length at boot time
         
         
(20) 裝置所在目錄
# ls /dev
[ root@rac1 dev ]# ll scsi*
crw-rw-rw-    1 root     system       14,  2 Sep 24 05:49 scsi0
crw-rw-rw-    1 root     system       14,  3 Sep 24 05:49 scsi1
crw-rw-rw-    1 root     system       14,  4 Sep 24 05:49 scsi2
crw-rw-rw-    1 root     system       14,  5 Sep 24 05:49 scsi3

(21) device configure database:
predefined、 customeried

檢視磁帶機的驅動有那些:
-P 代表prefined , -c class
 root@rac1 dev ]# lsdev -Pc tape
tape ost      fcp   Other FC SCSI Tape Drive
tape scsd     fcp   FC SCSI Tape Drive
tape ost      iscsi Other iSCSI Tape Drive
tape scsd     iscsi iSCSI Tape Drive
tape ost      sas   Other SAS Tape Drive
tape scsd     sas   SAS Tape Drive
tape 1200mb-c scsi  1.2 GB 1/4-Inch Tape Drive
tape 150mb    scsi  150 MB 1/4-Inch Tape Drive
tape 3490e    scsi  3490E Autoloading Tape Drive
tape 4mm2gb   scsi  2.0 GB 4mm Tape Drive
tape 4mm2gb2  scsi  2.0 GB 4mm Tape Drive
tape 4mm4gb   scsi  4.0 GB 4mm Tape Drive
tape 525mb    scsi  525 MB 1/4-Inch Tape Drive
tape 8mm      scsi  2.3 GB 8mm Tape Drive
tape 8mm5gb   scsi  5.0 GB 8mm Tape Drive
tape 8mm7gb   scsi  7.0 GB 8mm Tape Drive
tape 9trk     scsi  1/2-inch 9-Track Tape Drive
tape ost      scsi  Other SCSI Tape Drive
tape scsd     scsi  SCSI Tape Drive
tape 0806500c usbif Other USB Tape Drive
tape ost      vscsi Virtual Tape Drive
tape scsd     vscsi Virtual Tape Drive


-C 代表customeried
-H Displays headers above the column output.
[ root@rac1 dev ]# lsdev -CH | more
name       status    location      description

L2cache0   Available               L2 Cache
aio0       Defined                 Asynchronous I/O (Legacy)
cd0        Available 1G-19-00      IDE DVD-ROM Drive
en0        Available 1L-08         Standard Ethernet Network Interface
en1        Defined   1j-08         Standard Ethernet Network Interface
ent0       Available 1L-08         10/100 Mbps Ethernet PCI Adapter II (1410ff01
)
ent1       Available 1j-08         10/100/1000 Base-TX PCI-X Adapter (14106902)
et0        Defined   1L-08         IEEE 802.3 Ethernet Network Interface
et1        Defined   1j-08         IEEE 802.3 Ethernet Network Interface
fd0        Available 01-D1-00-00   Diskette Drive
fda0       Available 01-D1         Standard I/O Diskette Adapter
hd1        Defined                 Logical Volume
hd2        Defined                 Logical Volume
hd3        Defined                 Logical Volume
hd4        Defined                 Logical Volume
hd5        Defined                 Logical Volume
hd6        Defined                 Logical Volume
hd8        Defined                 Logical Volume
hd10opt    Defined                 Logical Volume
hd9var     Defined                 Logical Volume




[ root@rac1 dev ]# lsdev -PHc tape
class type     subclass description

tape  ost      fcp      Other FC SCSI Tape Drive
tape  scsd     fcp      FC SCSI Tape Drive
tape  ost      iscsi    Other iSCSI Tape Drive
tape  scsd     iscsi    iSCSI Tape Drive
tape  ost      sas      Other SAS Tape Drive
tape  scsd     sas      SAS Tape Drive
tape  1200mb-c scsi     1.2 GB 1/4-Inch Tape Drive
tape  150mb    scsi     150 MB 1/4-Inch Tape Drive
tape  3490e    scsi     3490E Autoloading Tape Drive
tape  4mm2gb   scsi     2.0 GB 4mm Tape Drive
tape  4mm2gb2  scsi     2.0 GB 4mm Tape Drive
tape  4mm4gb   scsi     4.0 GB 4mm Tape Drive
tape  525mb    scsi     525 MB 1/4-Inch Tape Drive
tape  8mm      scsi     2.3 GB 8mm Tape Drive
tape  8mm5gb   scsi     5.0 GB 8mm Tape Drive
tape  8mm7gb   scsi     7.0 GB 8mm Tape Drive
tape  9trk     scsi     1/2-inch 9-Track Tape Drive
tape  ost      scsi     Other SCSI Tape Drive
tape  scsd     scsi     SCSI Tape Drive
tape  0806500c usbif    Other USB Tape Drive
tape  ost      vscsi    Virtual Tape Drive
tape  scsd     vscsi    Virtual Tape Drive
[ root@rac1 dev ]# man lsdev

                     Commands Reference, Volume 3, i - m

lsdev Command

Purpose

       Displays devices in the system and their characteristics.


(21) 檢視裝置的屬性

 The lsdev command displays information about devices in the Device Configuration database. You can display information
       about all devices in the Customized Devices object class using the -C flag. Any combination of the -c Class, -s Subclass,
       -t Type, -l Name, -p Parent, and -S State flags selects a subset of the customized devices. You can display information
       about all devices in the Predefined Devices object class using the -P flag. Any combination of the -c Class, -s Subclass,
       and -t Type flags selects a subset of the predefined devices.


檢視cpu屬性: 主頻是多少等等、型別是什麼
[ root@rac1 dev ]# lsdev -CH | grep -i proc
proc1      Available 00-01         Processor

[ root@rac1 dev ]# lsattr -El proc1
frequency   1000000000     Processor Speed       False
smt_enabled false          Processor SMT enabled False
smt_threads 1              Processor SMT threads False
state       enable         Processor state       False
type        PowerPC_POWER4 Processor type        False



檢視硬碟hdisk0屬性:
[ root@rac1 dev ]# lsattr -El hdisk0
clr_q         no                               Device CLEARS its Queue on error True
max_transfer  0x40000                          Maximum TRANSFER Size            True
maxlun        31                               BLOCK size                       True
pvid          0059141f611f063e0000000000000000 Physical volume identifier       False
q_err         yes                              Use QERR bit                     True
q_type        none                             Queuing TYPE                     True
queue_depth   1                                Queue DEPTH                      True
reassign_to   120                              REASSIGN time out value          True
rw_timeout    30                               READ/WRITE time out value        True
start_timeout 60                               START unit time out value        True

[ root@rac1 dev ]# lsattr -EHl hdisk0
attribute     value                            description                      user_settable

clr_q         no                               Device CLEARS its Queue on error True
max_transfer  0x40000                          Maximum TRANSFER Size            True
maxlun        31                               BLOCK size                       True
pvid          0059141f611f063e0000000000000000 Physical volume identifier       False
q_err         yes                              Use QERR bit                     True
q_type        none                             Queuing TYPE                     True
queue_depth   1                                Queue DEPTH                      True
reassign_to   120                              REASSIGN time out value          True
rw_timeout    30                               READ/WRITE time out value        True
start_timeout 60                               START unit time out value        True



記憶體:
[ root@rac1 dev ]# lsdev -CH | grep -i mem
mem0       Available               Memory

[ root@rac1 dev ]# lsattr -EHl mem0
attribute value description                                user_settable

goodsize  2048  Amount of usable physical memory in Mbytes False
size      2048  Total amount of physical memory in Mbytes  False

 【-E
            Displays effective values (valid only for customized devices
            specified with the -l flag).
           
   -l Name
            Specifies the device logical name in the Customized Devices object
            class whose attribute names or values you want displayed.
   -H
            Displays headers above the column output. The -O and -R flag take precedence over the -H flag.         

       
       
       
       
       
(22)備份系統到那個地方
[ root@rac1 dev ]# smit mksysb

                                   Back Up This System to Tape/File or UDFS capable media

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

                                                        [Entry Fields]
    WARNING:  Execution of the mksysb command will
              result in the loss of all material
              previously stored on the selected
             
       
 (23)
 [ root@rac1 / ]# man rmdev

                     Commands Reference, Volume 4, n - r

rmdev Command

Purpose

Syntax

       rmdev { -l | -p }Name [ -d | -S ] [ -f File ] [ -h ] [ -q ] [ -R
         -d
            Removes the device definition from the Customized Devices object
            class. This flag cannot be used with the -S flag.
     -l Name
            Specifies the logical device, indicated by the Name parameter, in
            the Customized Devices object class. This flag cannot be used with
            the -p flag.
           
 (34) AIX 上檢視記憶體:
 $ svmon -G  -O unit=GB,timestamp=on  
[oracle@guangdong_rac1 ~]$svmon -G  -O unit=GB,timestamp=on
Unit: GB                                                   Timestamp: 14:40:29
-------------------------------------------------------------------------------
               size       inuse        free         pin     virtual  available
memory       249.50      216.28        33.2        35.3        84.2     116.82
pg space       8.00        0.20

               work        pers        clnt       other
pin            27.0           0        0.01        8.30
in use         84.2           0      132.12
           
           
           
           
           
           
  (35) 從卷組中減少PV
  reducevg rootvg hdisk1
  (36)從卷組中增加PV
  extendvg rootvg hdisk1
 
  (37)
  檔案系統部分
  bosboot -a  建立啟動盤 (boot部分)
  close /syncd
  open /syncd
  close,open表示磁碟是否被掛載可用 ,syncd和stale是相反的意思,表示LP有多個PP鏡系的時候,每個PP是否一致,不一致
  就是stale,都一致就是syncd.
 
  #做映象的命令
  smitty mklvcopy
 
 
 
  #同步那些是stale的命令
  syncvg -v rootvg
 
  (38) 檢視機器微碼
  uname -m
 
  (前八位是識別符號)
 
  (39)從磁碟中讀取標識(自解釋)
   chdev -l hdisk0 -a pv=yes
  
   [ root@rac1 / ]# chdev -l hdisk0 -a pv=yes
    hdisk0 changed
    [ root@rac1 / ]# lspv
    hdisk0          000c935fb65a16e8                    None           
    hdisk1          000c935fe54f7d84                    rootvg          active
  
    從磁碟中清除識別符號
    chdev -l hdisk0 -a pv=clear
    [ root@rac1 / ]# chdev -l hdisk0 -a pv=clear
    hdisk0 changed
    [ root@rac1 / ]# lspv
    hdisk0          none                                None           
    hdisk1          000c935fe54f7d84                    rootvg          active
    [ root@rac1 / ]#
 
  (39)  檔案系統掛載的配置檔案
  /etc/filesystem


/:
        dev             = /dev/hd4
        vfs             = jfs2
        log             = /dev/hd8
        mount           = automatic
        check           = false
        type            = bootfs
        vol             = root
        free            = true

/home:
        dev       = /dev/hd1
        vol       = "/home"
        mount     = true
        check     = true
        free      = false
        vfs       = jfs2
        log       = /dev/hd8


(40) 掛載光碟機
[ root@rac2 / ]# mount /dev/cd0 /mnt
mount: 0506-322 Cannot determine log device to use for /dev/cd0 (/mnt).
報告需要寫日誌,所以要read only方式掛載

如下:
[ root@rac2 / ]# mount -rv cdrfs /dev/cd0 /mnt


(41) 40#是每次都需要手動掛載,如果讓系統開機自動掛載,可以用smitty做到
[ root@rac2 / ]# smitty cdrfs->   Add a CDROM File System

會在/etc/filesystems中增加掛載光碟機的配置:


/mnt:
        dev             = /dev/cd0  #裝置
        vfs             = cdrfs     #檔案系統型別
        mount           = true      #true: 開機自動掛載,  false:開機不自動掛載  automatic:mount 命令時候用的
        options         = ro        # 選項:readonly
        account         = false


 這樣配置以後就可以開機自動掛載(因為mount=true)。
另外,“mount + 掛載點” 命令會掃描/etc/filesystems配置進行掛載,例如: mount /mnt 或者mount -a


(42)lsfs 命令
列印出格式化過的/etc/filesystems,可讀性更好。
[ root@rac2 / ]# lsfs
Name            Nodename   Mount Pt               VFS   Size    Options    Auto Accounting
/dev/hd4        --         /                      jfs2  524288  --         yes  no
/dev/hd1        --         /home                  jfs2  262144  --         yes  no
/dev/hd2        --         /usr                   jfs2  3932160 --         yes  no
/dev/hd9var     --         /var                   jfs2  786432  --         yes  no
/dev/hd3        --         /tmp                   jfs2  262144  --         yes  no
/proc           --         /proc                  procfs --      --         yes  no
/dev/hd10opt    --         /opt                   jfs2  786432  --         yes  no
/dev/cd0        --         /mnt                   cdrfs --      ro         no   no


(43)檢視卷組裡的邏輯卷
[ root@rac2 / ]# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     16      16      1    open/syncd    N/A
hd8                 jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       2       2       1    open/syncd    /
hd2                 jfs2       15      15      1    open/syncd    /usr
hd9var              jfs2       3       3       1    open/syncd    /var
hd3                 jfs2       1       1       1    open/syncd    /tmp
hd1                 jfs2       1       1       1    open/syncd    /home
hd10opt             jfs2       3       3       1    open/syncd    /opt

需要提醒的是type,不一定是檔案系統的真實型別,此處的type僅是一個標籤而已。換句話說,邏輯卷的真實檔案系統是A, 透過lsvg -l 看到的type卻是B,是有可能不一樣。不過一般都是一樣的,除非情況比較特殊。

N/A,標示沒有掛載點,對應的LV不是檔案系統

(44) 邏輯卷製造映象
smitty mklvcopy

製作映象後,如果邏輯卷狀態是stale 的時候,可以用syncvg -v 卷組名 ,同步資料,邏輯卷使狀態變為sync.

注意狀態出現stale ,不是好現象,很可能說明有一定問題,因為映象之間的資料不同步麼。

[ root@rac2 / ]# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     16      16      1    open/syncd    N/A
hd8                 jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       2       2       1    open/syncd    /
hd2                 jfs2       15      15      1    open/syncd    /usr
hd9var              jfs2       3       3       1    open/syncd    /var
hd3                 jfs2       1       1       1    open/syncd    /tmp
hd1                 jfs2       1       3       1    open/stale    /home  ####stale
hd10opt             jfs2       3       3       1    open/syncd    /opt

[ root@rac2 / ]# syncvg  -v rootvg

 【-v Specifies that the Name parameter represents a volume group device name】

[ root@rac2 / ]# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     16      16      1    open/syncd    N/A
hd8                 jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       2       2       1    open/syncd    /
hd2                 jfs2       15      15      1    open/syncd    /usr
hd9var              jfs2       3       3       1    open/syncd    /var
hd3                 jfs2       1       1       1    open/syncd    /tmp
hd1                 jfs2       1       3       1    open/syncd    /home   ###同步以後,狀態變為sync
hd10opt             jfs2       3       3       1    open/syncd    /opt


(45)   檢視邏輯卷的資訊lslv 命令
lslv    # 檢視邏輯卷lv#的一些屬性
lslv -l # 檢視邏輯卷lv#的pp copy分佈概要
lslv -m   #檢視lv#的詳細pp copy 分佈列表

Flags

       -L
            Specifies no waiting to obtain a lock on the Volume group. Note: If the volume group is being changed, using the -L
            flag gives unreliable date.
       -l
            Lists the following fields for each physical volume in the logical volume:
              PV
                   Physical volume name.
              Copies
                   The following three fields:
                     *    The number of logical partitions containing at least one physical partition (no copies) on the physical
                          volume
                     *    The number of logical partitions containing at least two physical partitions (one copy) on the physical
                          volume
                     *    The number of logical partitions containing three physical partitions (two copies) on the physical
                          volume
              In band
                   The percentage of physical partitions on the physical volume that belong to the logical volume and were
                   allocated within the physical volume region specified by Intra-physical allocation policy.
              Distribution
                   The number of physical partitions allocated within each section of the physical volume: outer edge, outer
                   middle, center, inner middle, and inner edge of the physical volume.
       -m
            Lists the following fields for each logical partition:

              LPs
                   Logical partition number.
              PV1
                   Physical volume name where the logical partition's first physical partition is located.
              PP1
                   First physical partition number allocated to the logical partition.
              PV2
                   Physical volume name where the logical partition's second physical partition (first copy) is located.
              PP2
                   Second physical partition number allocated to the logical partition.
              PV3
                   Physical volume name where the logical partition's third physical partition (second copy) is located.
              PP3
                   Third physical partition number allocated to the logical partition.

[ root@rac2 / ]# lslv -l hd6
hd6:N/A
PV                COPIES        IN BAND       DISTRIBUTION 
hdisk0            016:000:000   100%          000:016:000:000:000
[ root@rac2 / ]# lslv -m hd6
hd6:N/A
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0110 hdisk0           
0002  0111 hdisk0           
0003  0112 hdisk0           
0004  0113 hdisk0           
0005  0114 hdisk0           
0006  0115 hdisk0           
0007  0116 hdisk0           
0008  0117 hdisk0           
0009  0118 hdisk0           
0010  0119 hdisk0           
0011  0120 hdisk0           
0012  0121 hdisk0           
0013  0122 hdisk0           
0014  0123 hdisk0           
0015  0124 hdisk0           
0016  0125 hdisk0    



(46) lsvg -l  卷組
檢視卷組裡的邏輯卷的時候,也會訪問/etc/filesystems,用來填寫mount point屬性。

(47) 邏輯卷可以用來做
  jfs/jfs2 filesystem、boot logical volume 、paging space  、raw space 、journal log、dump space

(48)
  1)邏輯卷管理器 LVM
  [ root@rac2 home ]# smitty lvm

  2)卷組 VG
  [ root@rac2 home ]# smitty vg

  3)物理卷 PV
  [ root@rac2 home ]# smitty pv

  4)邏輯卷 LV
  [ root@rac2 home ]# smitty lv



(49)
[ root@rac2 home ]# lsvg rootvg
VOLUME GROUP:       rootvg                   VG IDENTIFIER:  0059141f00004c000000013b927926c9
VG STATE:           active                   PP SIZE:        128 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      545 (69760 megabytes)
MAX LVs:            256                      FREE PPs:       500 (64000 megabytes)
LVs:                9                        USED PPs:       45 (5760 megabytes)
OPEN LVs:           8                        QUORUM:         2 (Enabled)
TOTAL PVs:          1                        VG DESCRIPTORS: 2
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         1                        AUTO ON:        yes
MAX PPs per VG:     32512                                    
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable


注意 :
STALE PVs:          0,如果不是0,就得注意了。
AUTO SYNC:      no, 表示PV有stale的時候是否自動同步。
BB POLICY:      relocatable,表示有壞塊的時候,重新分配空間


(50) 打補丁的命令
[ root@rac2 home ]# smitty update_all

(51) 建立邏輯卷命令:
smitty mklv

(52) lsvg -l rootvg  檢視rootvg上的邏輯卷
      lsvg -p rootvg  檢視rootvg上的物理卷

(53) LTG: logical Track Group Size
LTG is the maximum transfer size of a logical volume

AIX 5.3 can dynamically sets the LTG size (calculated at each volume group active)

 聽說LTG size 大點好些,在啟用的時候可以讓BG自動調整(磁碟最大支援多大,這個值就設多大),也可以用下面命令手工調整:
LTG size can be changed with the command: varyonvg -M
但是LTG size 也不是越大越好,看一下對的大小解釋:man varyonvg
       -M LTGSize
            Statically sets the LTGSize of the volume group. Valid values for LTGSize include 4K, 8K, 16K, 32K, 64K, 128K, 1M, 2M,
            4M, 8M, 16M, 32M, and 128M. If any disk in the volume group is not configured with a max transfer of LTGSize or
            greater, the varyonvg will fail.

LTG 需要底層磁碟I/O效能的支援,如果 LTG size 超過磁碟的I/O 能力,會導致varyonvg will fail.
所以LTG 是受磁碟效能影響的。
AIx 5.3以後因為可以自動調整,所以不需要格外留意和特殊設定,因為他會根據磁碟的效能自動調整到最大值。 AIX 5.3以前就不行。

(54) Display the LTG size of a disk with the command:
  #lquerypv -M

 For example:
 [ root@rac2 / ]# lquerypv -M hdisk

(55) AIX檢視磁碟空間大小和剩餘空間大小
command: lspv

[ root@rac2 / ]# lspv hdisk0
PHYSICAL VOLUME:    hdisk0                   VOLUME GROUP:     rootvg
PV IDENTIFIER:      0059141fc1b1fc36 VG IDENTIFIER     0059141f00004c000000013b927926c9
PV STATE:           active                                    
STALE PARTITIONS:   0                        ALLOCATABLE:      yes
PP SIZE:            128 megabyte(s)          LOGICAL VOLUMES:  9
TOTAL PPs:          545 (69760 megabytes)    VG DESCRIPTORS:   2
FREE PPs:           500 (64000 megabytes)    HOT SPARE:        no
USED PPs:           45 (5760 megabytes)      MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  108..93..81..109..109                     
USED DISTRIBUTION:  01..16..28..00..00 

總的大小:PP size * Total pps = 128 M * 545= 68.125G 
(這是系統層面上看到的是68G,因為拋去了磁碟頭部和檔案系統佔用的一些資訊;磁碟實際物理空間其實是70G)

空閒空間大小: PP size * Free pps = 128 M * 500 = 62.5G

(56) Hot spare
Hot spare 是用來以後做備用的。如果卷組資料有多份資料映象,如果其中一份有壞掉的,那麼會從其他正常的資料映象copy到hot spare 的LV上。 其他的情況用不著hot spare.
值得注意的是hot spare 是在VG組內的概念,不能出組。


現在的資料可以做多份,提供保護,其實壞掉一份資料,也沒關係,還有其他的麼。所以hot space的意義不是太大。
另外,寫多份資料映象的時候,寫的效能相對沒有映象的情況會略有下降,但是讀的效能會增加。

(57) extend or reduce volume Group
 extendvg    # 把以前從沒加入過任何VG的加入到
 reducevg    # 把上面沒有任何LV的 Pv從卷組VG#裡給刪除掉。如果上還有LV,是不允許這樣刪除的,需要提前使用rmlv刪除上的LV才可以。

 extendvg  -f    # 如果 以前屬於某VG,後來被這個VG給刪除了。《hdisk#》會保留原卷組的一些資訊,extendvg會提示警告。所以要加 -f

 reducevg  -df    #即使上有LV,也會把刪除(上面的LV會一起被刪除)


 提示:卷組VG中最後一個PV被刪除的時候,VG也會被刪除掉,因為VG裡再也沒有PV了。


(58) active or deactive a volume group
Active a volume group (make it avaiable):
# varyonvg #當下的所有磁碟PV,都是可用的時候。 這個命令可以成功。如果其中有一塊盤壞掉了,那麼這個命令就會失敗。也算是一種保護措施。

# varyonvg -f   # 如果其中有一塊盤壞掉了,可以使用-f,強制active.這樣還可以使用其他盤上的資料。不至於都不能用。

Deactive a volume group (make it unavaiable):
# varyoff


(59) export or import vg
exportvg   # 提示:這個命令需要提前把給varyoff掉,才能執行成功
smitty exportvg

exportvg做的事情就是把資訊從系統中(也就是ODM庫)中抹掉,但磁碟上的VGDA資訊依然存在。


importvg
smitty importvg

importvg做的事情就是把磁碟上的VGDA資訊讀到系統中(也就是ODM庫),使vg能夠為系統所識別。

再一個就是卷組名稱是儲存在系統上(ODM),這個是磁碟上的VGDA上沒有的東東,VGDA上有的是VGDA的標示符(VGDA  identier),這個得清楚。所以在importvg從磁碟中的VGDA讀資訊到ODM的時候,可以給VG命名,不一定是之前exportvg 的時候的磁碟組名了,磁碟組名是可以改變的。


[ root@rac2 / ]# man importvg
importvg Command

Purpose

       Imports a new volume group definition from a set of physical volumes.

Syntax

       importvg [ -V MajorNumber ] [ -y  VolumeGroup ] [ -f ] [ -c ] [ -x ] | [ -L VolumeGroup ] [ -n ] [ -F ] [ -R ] [ -I ]
       PhysicalVolume

Description

       The importvg command makes the previously exported volume group known to the system.【 The PhysicalVolume parameter specifies
       only one physical volume to identify the volume group; any remaining physical volumes (those belonging to the same volume
       group) are found by the importvg command and included in the import. An imported volume group is automatically varied
       unless the volume group is Concurrent Capable. You must use the varyonvg command to activate Concurrent Capable volume
       groups before you access them.】

       【When a volume group with file systems is imported, the /etc/filesystems file is updated with values for the new logical
       volumes and mount points. After importing the volume group and activating it with the varyonvg command, you must run the
       fsck command before the file systems can be mounted.】【 However, the mount point information would be missing from the LVCB
       (logical volume control block) if it is longer than 128 characters. In this case, the importvg command will not be able to
       update the /etc/filesystems file with the stanza for the newly imported logical volume. You should manually edit the
       /etc/filesystems file to add a new stanza for this logical volume.】

       【The importvg command changes the name of a logical volume if the name already exists in the system. 】【It prints a message and
       the new name to standard error, and updates the /etc/filesystems file to include the new logical volume name. If the
       importvg command renames any filesystem log logical volumes, you must manually update any file systems using that log
       device to know about the renamed device.】

            Notes:
       1    To use this command, you must either have root user authority or be a member of the system group.
       2   【 AIX Version 4 changed the behavior. of importvg so that as part of the importvg process, the volume group is
            automatically varied on by the system after it is imported. However, if the volume group is Concurrent Capable then
            the importvg command prompts you to varyonvg the imported volume group manually.】
       3    A volume group with a mirrored striped logical volume cannot be back ported into a version older than AIX 4.3.3.

       You can use the Volumes application in Web-based System Manager (wsm) to change volume characteristics. You could also use
       the System Management Interface Tool (SMIT) smit importvg fast path to run this command.





       [ root@rac2 / ]# man exportvg

                                               Commands Reference, Volume 2, d - h

exportvg Command

Purpose

       Exports the definition of a volume group from a set of physical volumes.

Syntax

       exportvg VolumeGroup

Description

       【The exportvg command removes the definition of the volume group specified by the VolumeGroup parameter from the system.
       Since all system knowledge of the volume group and its contents are removed, an exported volume group can no longer be
       accessed. The exportvg command does not modify any user data in the volume group.】

       A volume group is a nonshared resource within the system; it should not be accessed by another processor until it has been
       explicitly exported from its current processor and imported on another. The primary use of the exportvg command, coupled
       with the importvg command, is to allow portable volumes to be exchanged between processors. Only a complete volume group
       can be exported, not individual physical volumes.

       Using the exportvg command and the importvg command, you can also switch ownership of data on physical volumes shared
       between two processors.

            Note: To use this command, you must either have root user authority or be a member of the system group.

       You can use the Volumes application in Web-based System Manager (wsm) to change volume characteristics.

       You can use the Web-based System Manager Volumes application (wsm lvm fast path) to run this command. You could also use
       the System Management Interface Tool (SMIT) smit exportvg fast path to run this command.

            Notes:
       1  【  A volume group that has a paging space volume on it cannot be exported while the paging space is active. Before
            exporting a volume group with an active paging space volume, ensure that the paging space is not activated
            automatically at system initialization, and then reboot the system.】
       2    【The mount point information of a logical volume would be missing from the LVCB (logical volume control block) if it is
            longer than 128 characters. Please make a note of the mount points that are longer than 128 characters as you will
            need to edit the /etc/filesystems file manually upon executing importvg command to import this volume group
            completely.】

Exit Status

       This command returns the following exit values:
       0
            Successful completion.
       >0
            An error occurred.

Examples

      【 To remove volume group vg02 from the system, enter:

       exportvg vg02

            Note: The volume group must be varied off before exporting.】

       The definition of vg02 is removed from the system and the volume group cannot be accessed.




(60)建立LV, 在LV上建立系統(分兩步做;其實也看可以一起做,一步到位)
  新建立的LV 她的type型別預設是jfs。可以修改成jfs
  smitty chlv(或者smitty lv)  -> Change  a logical Volume -> Logical volume type(jfs2)
  type只是個標示而已,其實這上面現在還沒有檔案系統。

  在建立的LV上建立檔案系統:
  smitty jfs2(或者smitty fs) ->  Add an Enhanced Journaled File System on a Previously Defined Logical Volume(這個地方要注意別選錯了,一定不要選擇“Add an Enhanced Journaled File System”)->...

(61) Advanced Raid Support:
Check all disks in a volume group if they have grown    in size :
  #chvg -g

Turn on bad block relocation policy of a volume group:
  #chvg -b y

Turn off  bad block relocation policy of a volume group:
  #chvg -b n

man chvg:
         -g
            Will examine all the disks in the volume group to see if they have grown in size. If any disks have grown in size
            attempt to add additional PPs to PV. If necessary will determine proper 1016 multiplier and conversion to big vg.
            Notes:
              1   【 The user might be required to execute varyoffvg and then varyonvg on the volume group for LVM to see the size】
              2   【 There is no support for re-sizing while the volume group is activated in classic or enhanced concurrent mode.】
              3    【There is no support for re-sizing for the rootvg.】


(61) Mirror:
  Mirroring is when a logical partition maps to more than one physical partition of the same volume group

  映象是在同一個卷組裡做的,不能出卷組。這一點跟hot spare特性一致,都不能出卷組。

  scheduling policy:(多個映象的時候,讀寫的策略:並行和序列兩種方式)
    parallel: physical partitions written simultaneouly
    sequence: physical partitions written in sequence

  Write contency:
  為了避免像掉電這種導致各個映象資料不一致的情況發生,可以在寫完每個映象的時候,在VGSA(磁碟外邊緣部分)中做個標記,說明這份映象已經寫完了,以後就不需要被同步了。這就保證了寫一致性。所以磁碟映象最好放在離磁碟外邊緣比較近的地方能好些。

多映象的LV讀效能比較好,寫的效能略差一寫(畢竟要寫多份資料麼),所以這樣的LV不太適合頻繁寫的資料庫(OLTP系統); 而用來做系統分割槽還不錯,讀的效能會提高。


(62) LV邏輯卷striping:  條帶化
  定義:consecutive strip units are created on different physical volumes(也就是磁碟).

  sripe unit size is specified  at creating time
  在建立條帶的時候,頻寬就已經被決定了。

  優點:(連續的讀寫操作能夠均勻的分佈在不同的磁碟上,提高了I/O效能)
  Striping increases read/write sequential throughout  by enenly distributing stripe units among disks.

  缺點:條帶化以後,資料安全性就降低了。一塊盤壞了,有可能所有的資料就不完整了。
  為了避免這個缺點,提高安全性,往往在條帶化以後,再做磁碟映象(不是PP映象,不要混淆了)。

  還有個缺點:條帶化以後, 邏輯卷LV不好移動。

(63)檢視物理卷的情況
lspv   #主要是檢視物理卷PV的一些屬性資訊
lspv -p   # 主要是檢視物理捲上的物理分割槽PP的分佈情況
lspv -l   #檢視物理卷(磁碟)上的邏輯卷LV的情況

lspv  #檢視系統上有多少物理卷pv
lsvg  #檢視系統上有多少卷組vg
lsvg -l   # 檢視vg#上有多少邏輯卷lv
lsvg -p   #檢視vg#上有多少物理卷pv


 [ root@rac2 / ]# lspv hdisk1
PHYSICAL VOLUME:    hdisk1                   VOLUME GROUP:     vg00
PV IDENTIFIER:      0059141fc2c180e3 VG IDENTIFIER     0059141f00004c000000013bc2e9623a
PV STATE:           active                                    
STALE PARTITIONS:   0                        ALLOCATABLE:      yes
PP SIZE:            64 megabyte(s)           LOGICAL VOLUMES:  4
TOTAL PPs:          1089 (69696 megabytes)   VG DESCRIPTORS:   2
FREE PPs:           1004 (64256 megabytes)   HOT SPARE:        no
USED PPs:           85 (5440 megabytes)      MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  158..213..197..218..218                   
USED DISTRIBUTION:  60..05..20..00..00     

[ root@rac2 / ]# lspv -p hdisk1
hdisk1:
PP RANGE  STATE   REGION        LV NAME             TYPE       MOUNT POINT
  1-158   free    outer edge                                  
159-218   used    outer edge    lv02                jfs2       N/A
219-221   used    outer middle  lv01                jfs2       /test2
222-222   used    outer middle  loglv00             jfs2log    N/A
223-223   used    outer middle  fslv00              jfs2       /test
224-436   free    outer middle                                
437-456   used    center        lv02                jfs2       N/A
457-653   free    center                                      
654-871   free    inner middle                                
872-1089  free    inner edge

[ root@rac2 / ]# lspv -l hdisk1
hdisk1:
LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
fslv00                1       1       00..01..00..00..00    /test
lv02                  40      80      60..00..20..00..00    N/A
lv01                  3       3       00..03..00..00..00    /test2
loglv00               1       1       00..01..00..00..00    N/A

(64) LV increase or decrease:

 increase 很容易的,但是一般不能decrease ,除非是比較特殊的jfs2,paging space是可以減小的。
 increase : smitty lv->Set Characteristic of a Logical Volume->  Increase the Size of a Logical Volume
 或者直接smitty extendlv

(65)
jfs :日誌檔案系統簡稱。分為三種:

  Add a Standard Journaled File System    #標準的,檔案能達到2G
  Add a Compressed Journaled File System  #標準的,檔案能達到2G
  Add a Large File Enabled Journaled File System #大檔案系統, jfs:64G , jfs2:1T

  --------------------------------------------------------------------------------------------
                                            JFS                        |JFS2
  --------------------------------------------------------------------------------------------
    maximum file architecture/test:         |64G/64G                   |1T/1T
    Maximum file system architecture/test:  |1T/1T                     |4T/1T
    inode size:                             |128 Byte                  |512 Byte
    Number of inodes:                       |Fixed, set at creation    |Dynamic
    directory file access:                  |sequential                | B-tree
    Journal log support:                    |External JFSLOG only      |inline or external JFS2LOG
    Compress:                               |Yes                       |No
    Quotas:                                 |Yes                       | AIX L 5.3
    ---------------------------------------------------------------------------------------------

JFS2 :uses extent based allocation for high performance and large file size

JFS -> JFS2轉換:AIX 5.3不支援直接轉換,需要bakcup ,刪除,重建,然後resotore回來。

(65) 增加,刪除,修改是是檔案系統:
#smitty manfs

(66) 

Disk Input/Output History

       To improve performance, the collection of disk input/output statistics has been disabled. To enable the collection of this
       data, type:

       chdev -l sys0 -a iostat=true

       To display the current settings, type:

       lsattr -E -l sys0 -a iostat

       If the collection of disk input/output history is disabled and iostat is called without an interval, the iostat output
       displays the message Disk History Since Boot Not Available instead of disk statistics.


(67) 改變檔案系統(jfs2型別的檔案系統)大小:


smitty jfs2 -> Change / Show Characteristics of an Enhanced Journaled File System ->...
或者直接:smitty chfs

可以把檔案系統減小。但是檔案系統是在邏輯捲上,一個邏輯卷LV只能被一個檔案系統使用。所以剩餘的空間都閒著了。


提示:1)smitty選單在LV上建立檔案系統的時候,是使用了LV的全部空間來建立檔案系統的,沒有尺寸大小選項可供選擇。
但是檔案系統以後是可以調節的,比如減小啦,擴大了等等。
      2) jfs 檔案系統不能縮小,jfs2檔案系統可以縮小。
      3) 當檔案系統佔用了LV的所有空間的時候,如果此時檔案系統擴大,那麼檔案系統所在的LV會被檔案系統撐大。也就是說跟著檔案系統一起變大,LV會適應檔案系統的變話。同樣道理,如果檔案系統現在縮小,那麼檔案系統所在的LV也會跟著LV一起縮小,來適應檔案系統的變話。這點我是驗證過的。
      當然,沒有檔案系統的 single LV 自己也可以變大,而且非常容易,但是single LV縮小不是很容易。



 改變檔案系統大小命令:chfs
 例如:chfs -a size='+100M'  /test
       chfs -a size='-100M'  /test
       chfs -s size="300M"   /test  # 單位M需要大寫


       -a Attribute=Value
              -a size=NewSize
                   Specifies the size of the Enhanced Journaled File System in 512-byte blocks, Megabytes or Gigabytes. If Value
                   has the M suffix, it is interpreted to be in Megabytes. If Value has a G suffix, it is interpreted to be in
                   Gigabytes. If Value begins with a +, it is interpreted as a request to increase the file system size by the
                   specified amount. If Value begins with a -, it is interpreted as a request to reduce the file system size by
                   the specified amount.

                   If the specified size does not begin with a + or -, but it is greater or smaller than the file system current
                   size, it is also a request to increase or reduce the file system size.  

(68) 刪除檔案系統:
smitty rmfs
 刪除檔案系統,需要首先解除安裝umount檔案系統,然後才能刪除檔案系統,刪除檔案系統的時候檔案系統所在的LV會被刪除掉。(rmlv).

   67# , 68#可以看出:在LV 上建立檔案系統後,基本上可以理解成檔案系統就是LV的代名詞。檔案系統幹啥,LV 就幹啥。


 (69) 掛載檔案系統:
 smitty mount

 子選單下的mount group 是指 /etc/filesystems 檔案中的type欄位的那個值。

 (70) 檔案系統入口:
 smitty fs

 (71) 建立記憶體檔案系統:
 >create a RAM disk of 10M
 mkramdisk 20M
 
 > create a jfs file system on this disk
 mkfs -V jfs /dev/ramdisk0

 > create a mount point
 mkdir /ramdisk
 
 >mount a RAM  file system
 mount -V jfs -o nointegrity  /dev/radmdisk0 /ramdisk

 建立記憶體檔案系統的原因是I/O太頻繁,而磁碟的讀取太慢;記憶體容易掉電丟資料,而且容量有限,價格昂貴。
 在記憶體中建立檔案系統來模擬硬碟這種方法比較適合只讀。當把磁碟上的資料讀入到記憶體中去,以後讀資料只需要從記憶體中讀取,訪問速度會大大提高。同時因為是隻讀資料,所以掉電從記憶體中丟失,因為硬碟上也有麼。

(72)
 1)增加檔案系統的時候,LV也會增加。但是增加LV的時候,檔案系統大小是不變的。
 2)刪除檔案系統的時候,LV會一起被刪掉。但是刪除LV,LV上的檔案系統在系統配置/etc/filesystem和df 命令上還有保留。所以乾淨的刪除應該是刪除檔案系統,而不是刪除檔案系統所在LV.

(73)Move the contents of a physical volume:

The migratepv command moves allocated physical partitions and the data they contain from the SourcePhysicalVolume to one or
       more other physical volumes.


migratepv 【-l 】 sourcePV  targetPV
For eample: migratepv -l lv02 hdisk01 hdisk02
提示:1)-l引數是可選的,如果不帶-l 引數,就是指把sourcePV上的所有內容(或者說所有LV)都挪移到targetPV上去
      2)挪移PV上的內容,只能在同一個卷組內完成,不能跨越卷組。
      3) 注意挪移過程中資料I/O會比較大


挪移的目的:1)可以騰空sourcePV, 更換硬碟
            2)可以把sourcePV上的一部分內容,挪地到其他PV上,分散集中讀一個PV的I/O


Examples
       1    To move physical partitions from hdisk1 to hdisk6 and hdisk7, enter:

            migratepv hdisk1 hdisk6 hdisk7

            Physical partitions are moved from one physical volume to two others within the same volume group.
       2    To move physical partitions in logical volume lv02 from hdisk1 to hdisk6, enter: migratepv -l lv02 hdisk1 hdisk6

            Only those physical partitions contained in lv02 are moved from one physical volume to another.

(74)更加細粒度的移動:
  挪移LP : migratelp

       migratelp LVname/LPartnumber[ /Copynumber ] DestPV[/PPartNumber]

Description

       The migratelp moves the specified logical partition LPartnumber of the logical volume LVname to the DestPV physical volume.
       If the destination physical partition PPartNumber is specified it will be used, otherwise a destination partition is
       selected using the intra region policy of the logical volume. By default the first mirror copy of the logical partition in
       question is migrated. A value of 1, 2 or 3 can be specified for Copynumber to migrate a particular mirror copy.

       Notes:
       1    You must consider the partition usage, reported by lvmstat, on the other active concurrent nodes in case of a
            concurrent volume group.
       2    Strictness and upper bound settings are not enforced when using migratelp.

       The migratelp command fails to migrate partitions of striped logical volumes.

Security

       To use migratelp, you must have root user authority.

Examples
       1    To move the first logical partitions of logical volume lv00 to hdisk1, type:

            migratelp lv00/1 hdisk1
       2    To move second mirror copy of the third logical partitions of logical volume hd2 to hdisk5, type:

            migratelp hd2/3/2 hdisk5
       3    To move third mirror copy of the 25th logical partitions of logical volume testlv to 100th partition of hdisk7, type:

            migratelp testlv/25/3 hdisk7/100




直接敲命令,會出usage提示:
[ root@rac2 ramdisk ]# migratepv
0516-612 migratepv: Source physical volume name not entered.
Usage: migratepv [-i] [-l LVname] SourcePV DestinationPV...
Migrates all logical partitions off a physical volume.
[ root@rac2 ramdisk ]# migratelp
Usage: migratelp lvname/lpartnum[/copynum] destpv[/ppartnum]
Migrates a single logical partition.



(75)
  # lscfg  -v -l ent0

[ root@rac2 ramdisk ]# man lscfg
     lscfg [ -v ] [ -p ] [ -s ] [ -l Name ]
        If you run the lscfg command with the -p flag, it displays device information stored in the platform. specific data areas.
       When used with the -v flag, VPD data stored for these devices is also displayed. This information is obtained on a Common
       Hardware Reference Platform. (CHRP) system from the open firmware device tree.
       -l Name
            Displays device information for the named device.
       -p
            Displays the platform-specific device information. This flag only applies to AIX 4.2.1 or later.
       -v
            Displays the VPD found in the Customized VPD object class. Also, on AIX 4.2.1 or later, displays platform. specific VPD
            when used with the -p flag.
       -s
            Displays the device description on a separate line from the name and location.



       3    To display the name, location, and description for devices specified by the logical name proc without VPD, enter:

            lscfg -lproc\*

            The system displays information for all devices with logical names beginning with proc, as follows:

              proc0            U1.1-P1-C1  Processor
              proc1            U1.1-P1-C1  Processor
              proc2            U1.1-P1-C1  Processor
              proc3            U1.1-P1-C1  Processor
              proc4            U1.1-P1-C2  Processor
              proc5            U1.1-P1-C2  Processor
              proc6            U1.1-P1-C2  Processor
              proc7            U1.1-P1-C2  Processor
       4    To display the VPD for a specific device specified by the logical name ent0, enter:

                     lscfg  -v -l ent0

            The system displays the following:

             ent0             U0.1-P1-I2/E1   Gigabit Ethernet-SX PCI Adapter (14100401)
                    Network Address.............0004AC7C00C4
                    Displayable Message.........Gigabit Ethernet-SX PCI Adapter (14100401)
                    EC Level....................E77998
                    Part Number.................07L8916
                    FRU Number..................07L8918
                    Device Specific.(YL)........U0.1-P1-I2/E1
       5    To display the VPD in the open firmware device tree for the corresponding node to the ent0 device, enter:

             lscfg -vp -lent0

            The following is displayed:

              ent0             U0.1-P1-I2/E1  Gigabit Ethernet-SX PCI Adapter (14100401)
                    Network Address.............0004AC7C00C4
                    Displayable Message.........Gigabit Ethernet-SX PCI Adapter (14100401)
                    EC Level....................E77998
                    Part Number.................07L8916
                    FRU Number..................07L8918
                    Device Specific.(YL)........U0.1-P1-I2/E1
              PLATFORM. SPECIFIC
              Name:  ethernet
                Model:  Galaxy, EtherLink 1000-SX-IBM
                Node:  ethernet@1
                Device Type:  network



(76) 檢視硬碟大小:
getconf DISK_SIZE /dev/hdisk1

(77) 經常檢視可能比較大的檔案:
/var/adm/wtmp  #登陸日誌檔案
/var/adm/sulog # su 日誌檔案
/etc/security/failedlogin #登陸失敗日誌檔案

(78) Cleans up file systems by removing unwanted files:

for example: *.bak, .*.bak, a.out, core, proof, galley, ...*, ed.hup files

# skulker
            Attention: Because the skulker command is run by a root user, and its whole purpose is to remove files, it has the
            potential for unexpected results. Before installing a new skulker command, test any additions to its file removal
            criteria by running the additions manually using the xargs -p command. After you have verified that the new skulker
            command removes only the files you want removed, you can install it.

       The skulker command is used for periodically purging obsolete or unneeded files from file systems. Candidate files include
       files in the /tmp directory, files older than a specified age, and the following file types: *.bak, a.out, core, proof,
       galley, ...*, ed.hup, and files that are more than one day old.

       The skulker command is normally invoked daily, often as part of an accounting procedure run by the cron command during
       off-peak periods. Modify the skulker command to suit local needs following the patterns shown in the distributed version.
       Local users should be made aware of the criteria for automatic file removal.

(79) du   
  -x
            When evaluating file sizes, evaluates only those files that reside on the same device as the file or directory
            specified by the File parameter. For example, you may specify a directory that contains files on several devices. In
            this case, the -x flag displays block sizes for all files that reside on the same device as the directory.

[ root@rac2 etc ]# du /etc | sort -r -n  #按從大到小檢視
3
[ root@rac2 etc ]# du -xm /   #只檢視/


(80) 去碎片
去碎片的時候檔案系統需要處於mount 狀態

defragfs Command

Purpose

       Increases a file system's contiguous free space.
       Syntax

       defragfs [ -q | -r | -s] { Device | FileSystem }

Description

       The defragfs command increases a file system's contiguous free space by reorganizing allocations to be contiguous rather
       than scattered across the disk. The file system to be defragmented can be specified with the Device variable, which is the
       path name of the logical volume (for example, /dev/hd4). It can also be specified with the FileSystem variable, which is
       the mount point in the /etc/filesystems file.

       The defragfs command is intended for fragmented and compressed file systems. However, you can use the defragfs command to
       increase contiguous free space in nonfragmented file systems.

       You must mount the file system read-write for this command to run successfully. Using the -q flag, the -r flag or the -s
       flag generates a fragmentation report. These flags do not alter the file system.

       The defragfs command is slow against a JFS2 file system with a snapshot due to the amount of data that must be copied into
       snapshot storage object. The defragfs command issues a warning message if there are snapshots. The snapshot command can be
       used to delete the snapshots and then used again to create a new snapshot after the defragfs command completes.

(81) Verify filesystem 檢查檔案系統:
  fsck
  > check journal log
  > check inodes, indirect blocks, data blocks,  freelist

  > orphan files   are placed  int the lost+found directory
  > umount the filesystem before running fsck
  > If no filesystem name is specified ,   the fsck cmmand will check all filesystems which have the check=true
  attribute set in the /etc/filesystems .
  >  The fsck command checks and interactively repairs inconsistent file systems. You should run this command before mounting any file system. You must be able to read the device file on which the file system resides (for example, the /dev/hd0 device).

Examples
       1    To check all the default file systems, enter:

            fsck

            This command checks all the file systems marked check=true in the /etc/filesystems file. This form. of the fsck command
            asks you for permission before making any changes to a file system.
       2    To fix minor problems with the default file systems automatically, enter:

            fsck -p
       3    To check a specific file system, enter:

            fsck /dev/hd1

            This command checks the unmounted file system located on the /dev/hd1 device.


提示:出現lost+found的目錄,一般都是檔案系統,不僅僅是目錄。


(82) 檢視換頁空間:
lsps -a

(83) 改變換頁空間大小
chps  -s  4  hd6  #   This adds four logical partitions to the hd6 paging space.

       -d LogicalPartitions(減小換頁空間的選項)
            Specifies the number of logical partitions to subtract.

       -s LogicalPartitions(增大換頁空間的選項)
            Specifies the number of logical partitions to add.

       -a
            Specifies to use a paging space at the next system restart.
              y
                   Specifies that the paging space is active at subsequent system restarts.
              n
                   Specifies that the paging space is inactive at subsequent system restarts.

Examples
       1    To change the size of the myvg paging space, enter: chps -s4 myvg

            This adds four logical partitions to the myvg paging space.
       2    To define the PS02 paging space as configured and active at subsequent system restarts, enter: chps -a y PS02

            This specifies that the PS02 paging space is to be active at subsequent system restarts.
       3    To change the size of the myvg paging space using helper program foo enter: chps -t foo -s4 myps

            This adds four logical partitions to myps by calling the helper program foo.


原則:only one paging space per disk;
      use disk  with the least activity;
      paging spaces roughly the same size
      don't extend paging space to multilple physical volumes
      use multiple disk controllers



提示:AIX 機器啟動的時候必須用到換頁空間,並且不能小於64M,否則機器啟動不起來。預設的換頁空間是/dev/hd6.
換頁空間(包括/dev/hd6)都可以增大,也可以減小


(84) Checking paging space actived at startup

系統啟動的時候會讀取/etec/swapspaces檔案,讀到的換頁空間就啟用
  [ root@rac2 / ]# more /etc/swapspaces
* /etc/swapspaces
*
* This file lists all the paging spaces that are automatically put into
* service on each system restart (the 'swapon -a' command executed from
* /etc/rc swaps on every device listed here).
*
* WARNING: Only paging space devices should be listed here.
*
* This file is modified by the chps, mkps and rmps commands and referenced
* by the lsps and swapon commands.

hd6:
        dev = /dev/hd6


(85) 增加換頁空間個數
smitty mkps

(86) 刪除換頁空間
1)刪除之前,必須deative 換頁空間(active的換頁空間,是不允許刪除的)
[ root@rac2 / ]# lsps -a
Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type
paging01        hdisk1            datavg        2048MB     1   yes   yes    lv
paging00        hdisk1            datavg        2048MB     1   yes   yes    lv
hd6             hdisk0            rootvg        2048MB     1   yes   yes    lv
[ root@rac2 / ]# swapoff /dev/paging01
[ root@rac2 / ]# lsps -a
Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type
paging01        hdisk1            datavg        2048MB     1  no     yes    lv
paging00        hdisk1            datavg        2048MB     1   yes   yes    lv
hd6             hdisk0            rootvg        2048MB     1   yes   yes    lv
2)刪除換頁空間
rmps paging01


(86)換頁空間管理選單入口:
smitty lvm -> Paging Space -> ...
或者直接 smitty pgsp

(87) Remove Paging Space
To make an active paging space:
make inactive:
#swapoff /dev/paging00

remove inactive paging space
# rmps paging00

Note: /dev/hd6 cannot be removed using this process

作業系統至少要保留/dev/hd6換頁空間,這個是不能刪除的



(88) oslevel  -rl 5300-01    #查詢比5300-01早的fileset

[ root@rac2 / ]# man oslevel

                                            Commands Reference, Volume 4, n - r

oslevel Command

Purpose

       Reports the latest installed level (technology level, maintenance level and service pack) of the system.

Syntax

       oslevel [ -l Level | -g Level | -q ] [-r | -s ] [-f]

Description

       The oslevel command reports the technology level and service pack of the operating system using a subset of all
       filesets installed on your system. These filesets include the Base Operating System (BOS), base devices, base
       printers, and X11.

       The oslevel command also prints information about the technology levels, including which filesets are not at a
       specified technology level or service pack.

Flags

       -l Level
            Lists filesets that are earlier (less) than the technology level or service pack specified by the Level
            parameter.
       -f
            Forces the oslevel command to rebuild the cache for this operation.
       -g Level
            Lists filesets that are later (greater) than the technology level or service pack specified by the Level
            parameter.
       -q
            Lists names of known technology levels (when used with the -r flag) or service packs (when used with the -s
            flag) that can be specified using the -l or -g flag.
       -r
            Applies all flags to technology levels.
       -s
            Applies all flags to service packs.

       If no flags are specified, the base system software is entirely at or above the level that is listed in the output
       of the oslevel command.

Examples
       1    To determine the base level of the system, type:

            oslevel

            The output will be similar to the following:

            5.3.0.0
       2    To determine the highest technology level reached for the current version of AIX on the system, type:

            oslevel -r
       3    To list all known technology levels on the system, type:

            oslevel -rq
            The levels returned can be used with the [ -r -l ] or [ -r -g ] flags, and will be similar to the following:

            Known Recommended Maintenance Levels

            ------------------------------------
            5300-02
            5300-01
            5300-00
       4    To list which software is below AIX Version 5.3 technology level 1, type:

            oslevel -r -l 5300-01
       5    To list which software is at a level later than AIX Version 5.3 technology level 1, type:

            oslevel -r -g 5300-01
       6    To determine the highest service pack reached for the current technology level on the system, type:

            oslevel -s
       7    To list the known service packs on a system, type:

            oslevel -sq
            The levels returned can be used with the [ -s -l ] or [ -s -g ] flags, and will be similar to the following:

            Known Service Packs
            -------------------
            5300-06-02-0727
            5300-06-01-0722
            5300-06-00-0000

Files

       /usr/bin/oslevel
            Contains the oslevel command.

Related Information

       The lslpp command.


(89)
instfix -l | grep ML  #查詢關於ML的補丁補丁資訊


                                            Commands Reference, Volume 3, i - m

instfix Command

Purpose

       Installs filesets associated with keywords or fixes.

Syntax

       instfix [ -T [ -M Platform. ] ] [ -s String ] [ -S ] [ -k Keyword | -f File ] [ -p ] [ -d Device ] [ -i [ -c ] [ -q ]
       [ -t Type ] [ -v ] [ -F ] ] [ -a ]

Description

       The instfix command allows you to install a fix or set of fixes without knowing any information other than the
       Authorized Program Analysis Report (APAR) number or other unique keywords that identify the fix.

       Any fix can have a single fileset or multiple filesets that comprise that fix. Fix information is organized in the
       Table of Contents (TOC) on the installation media. After a fix is installed, fix information is kept on the system
       in a fix database.

       The instfix command can also be used to determine if a fix is installed on your system.

            Note: Return codes for the instfix command are documented in the /usr/include/inuerr.h file, which is shipped
            with the bos.adt.include fileset. There is also a general failure code of 1 and a single reference to EACCES
            (13) from /usr/include/errno.h.

Flags

       -a
            Displays the symptom text associated with a fix. Can be combined with the -i, -k, or -f flag.
       -c
            Displays colon-separated output for use with -i flag. Output includes keyword name, fileset name, required
            level, installed level, status, and abstract. To display filesets that are not installed, the -v flag must also
            be used. Status values are:
              -
                   Down level
              =
                   Correct level
              +
                   Superseded
              !
                   Not installed
       -d Device
            Specifies the input device. Not valid with the -i and -a flags.
       -F
            Returns failure unless all filesets associated with the fix are installed.
       -f File
            Specifies the input file containing keywords or fixes. Use - (dash) for standard input. The -T flag produces a
            suitable input file format for -f.
       -i
            Displays whether fixes or keywords are installed. Use this flag with the either the -k or the -f flag.
            Installation is not attempted when the -i flag is used. If you do not specify the -k or the -f flag, all known
            fixes are displayed.
       -k Keyword
            Specifies an APAR number or keyword to be installed. Multiple keywords can be entered. A list of keywords
            entered with the -k flag must be contained in quotation marks and separated with spaces.

       -M Platform
            Specifies that any of the Platform. values may be used to list the fixes for that particular platform.
              R
                   Specifies POWER-based platform. fixes only.
              N
                   Specifies neutral fixes, that is, fixes that are not restricted to the POWER-based platform.
              A
                   Specifies all fixes.
       -p
            Displays filesets associated with keywords. This flag is used with either the -k or the -f flag. Installation
            is not attempted when the -p flag is used.
       -q
            Specifies quiet mode. Use this flag with the -i flag. If you use the -c flag, no heading is displayed,
            otherwise there is no output.
       -s String
            Searches for and displays fixes on media containing a specified string.
       -S
            Suppresses multiple volume processing when the installation device is a CD-ROM. Installation from a CD_ROM is
            always treated as a single volume, even if the CD-ROM contains information for a multiple volume CD set. This
            same suppression of multiple volume processing is performed if the INU_SINGLE_CD environment is set.
       -T
            Displays the entire list of fixes present on the media.
       -tType
            Used with the -i flag to limit searches to a given type. Valid types are:
              f
                   fix
              p
                   preventive maintenance
       -v
            Used with the -i flag to specify verbose mode. Displays information about each fileset associated with a fix or
            keyword. Use this flag with the -i flag to display filesets that are not installed. An uninstalled fileset is
            indicated by an ! (exclamation point).

Security

       Privilege Control: You must be the root user to install using the instfix command, but any user can run the instfix
       command to query the fix database.

Examples
       1    To install all filesets associated with fix IX38794 from the tape mounted on /dev/rmt0.1, type: instfix -k
            IX38794 -d /dev/rmt0.1

       2    To install all fixes on the media in the tape drive, type: instfix -T -d /dev/rmt0.1 | instfix -d /dev/rmt0.1
            -f-

            The first part of this command lists the fixes on the media, and the second part of this command uses the list
            as input.
       3    To list all keyword entries on the tape containing the string SCSI, type: instfix -s SCSI -d /dev/rmt0.1

       4    To inform. the user on whether fixes IX38794 and IX48523 are installed, type: instfix -i -k "IX38794 IX48523"

       5    To create a list of filesets associated with fix IX12345 for bffs in the /bffs directory, type: instfix -p -k
            IX12345 -d /bffs | installp -acgX -f- -d /bffs

            This sequence passes the list of fixes to the installp command to be applied and committed. The installp
            command extends filesystems as needed with the flags shown. This example shows that you can select other
            installp flags. The instfix command calls installp if the -p flag is not used.
       6    To list all of the fixes that are not restricted to the POWER-based platform, type: instfix -T -MN -d /dev/cd0

Files

       /usr/sbin/instfix
            Contains the instfix command.
       /usr/lib/objrepos/fix
            Specifies the path to the Object Data Manager database.

Related Information

       The installp command.



(90) installp -C  #清理之前沒有安裝成功的一些檔案

If a previously interrupted installation leaves any software in a state of either applying or committing, it is
       necessary to perform. cleanup with the -C flag before any further installations are allowed. Although the installp -C
       command accepts software product names on the command line without returning an error, an attempt is always made to
       clean up all products when the -C flag is used. An attempt is made to clean up any incomplete installations by
       removing those parts that were previously completed.
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-751972/,如需轉載,請註明出處,否則將追究法律責任。