AIX命令

(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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/27042095/viewspace-751972/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值