一台AIX小机因生产需要对/sapdata目录进行扩容,由原来的90G扩容到210G,增加120G的空间.AIX小机后端通过光纤交换机连的EMC存储。首先在EMC存储上把空闲的硬盘做RAID,划分LUN,映射到生产AIX小机。

 EMC
划完LUN映射完后,在AIX小机上执行cfgmgr ,然后lspv看是否认到新扩容的硬盘.
# cfgmgr  -i  disk
# lspv
hdisk0          00c6abdfc094f4e8                    rootvg          active
hdisk1          00c6abcfc4edbd87                    rootvg          active
hdisk6                                                           oravg           active
hdisk7                                                           oravg           active

注意HDISK后的16位数字,如果没有请执行
#chdev 
l  hdisk6 a  pv=yes (以使物理卷为LVM所用)。
#chdev 
l  hdisk7 a  pv=yes (以使物理卷为LVM所用)。

pv加入到vg

Extendvg datavg hiskpower60


#lspv
hdisk0          00c6abdfc094f4e8                    rootvg          active
hdisk1          00c6abcfc4edbd87                    rootvg          active
hdisk6          00c6abcf1d17f7bf                     oravg           active
hdisk7          00c6abcf1d189c64                    oravg           active

(如果是HA架构,在A节点上识别到后执行#rmdev Rd1 hdisk6然后在B节点上cfgmgr扫再认)--检查两节点LSPV是否一致和HDISK是否一致。

原文件目录大小
#df -g
/dev/sapdata    90.00    84.80   94%       26     1% /oracle/sapdata

然后执行smitty hacmp--- System Management (C-SPOC)-- HACMP Logical Volume Management--- Shared Volume Groups-- Set Characteristics of a Shared Volume Group-- Add a Volume to a Shared Volume Group--选择需要扩容的VG--回车,然后选择添加的硬盘---确定。然后进行扩容文件系统。#smitty chfschange/show charactertistics of an enhanced journaled file system—选择要扩的文件系统—然后回车继续.

如果文件系统扩容出错,一般是文件系统的Block size或卷的LV原大小限制了最大扩容空间,可以# smitty hacmp--- System Management (C-SPOC)-- HACMP Logical Volume Management--- Shared file systems---enhanced journaled file systems---change/show characteristics of a shared enhanced journaled file system—选择文件系统来修改块大小,之后就可以成功扩文件系统。注:修改LV的大小,可以通过#smitty chlv来进行。

原参数:
Type or select values in entry fields. 
Press Enter AFTER making all desired changes.

                                                    [Entry Fields]
  File system name                                    /oracle/sapdata
  NEW mount point                                    [/oracle/sapdata]
  SIZE of file system
          Unit Size                                      512bytes                               +
          Number of units                           [188743680]                         #
  Mount GROUP                                        []
  Mount AUTOMATICALLY at system restart?              no                +
  PERMISSIONS                                         read/write                       +
  Mount OPTIONS                                      []                                     +
  Start Disk Accounting?                              no                                     +
  Block Size (bytes)                                  256
  Inline Log?                                               no
  Inline Log size (MBytes)                           [0]                                     #
  Extended Attribute Format                          [v1]
  Enable Quota Management?                            no                               +
  Allow Small Inode Extents?                          no                                  +          

现参数:
Type or select values in entry fields. 
Press Enter AFTER making all desired changes.

                                                    [Entry Fields]
  File system name                                    /oracle/sapdata
  NEW mount point                                    [/oracle/sapdata]
  SIZE of file system
          Unit Size                                   512bytes                             +
          Number of units                         [440401920]                      #
  Mount GROUP                                        []
  Mount AUTOMATICALLY at system restart?              no                        +
  PERMISSIONS                                         read/write                               +
  Mount OPTIONS                                      []                                            +
  Start Disk Accounting?                              no                                            +
  Block Size (bytes)                                  2048
  Inline Log?                                         no
  Inline Log size (MBytes)                           [0]                                          #
  Extended Attribute Format                          [v1]
  Enable Quota Management?                            no                                     +
  Allow Small Inode Extents?                        no                                +            

然后再扩,就正常了出现如下提示Filesystem size changed to 440401920   
注:扩容后包含已有空间的容量
验证一下
#df -g
/dev/sapdata    210.00    84.80   40%       26     1% /oracle/sapdata

 

 

 

 

 

 

aix的文件系统扩容是非常灵活的,如果不涉及加硬盘的硬件操作,只要通过aix里面的命令或者smitty菜单就行了,当然做好数据备份在任何情况下都是必要的。

1、因为数据库归档日志目录空间较小,而日志增长又比较快,因归档日志满很容易造成数据库挂起,所以准备对文件系统进行扩容。
# df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           5.00      4.90    3%     7024     1% /
/dev/hd2          20.00     14.77   27%    57946     2% /usr
/dev/hd9var       10.00      9.37    7%     7454     1% /var
/dev/hd3          15.00     14.41    4%     3290     1% /tmp
/dev/hd1           6.00      5.01   17%     1873     1% /home
/proc                 -         -    -         -     -  /proc
/dev/hd10opt      15.00     14.62    3%    10242     1% /opt
/dev/lv00          0.25      0.24    4%       18     1% /var/adm/csd
/dev/fslv00       10.00      9.20    8%     2876     1% /sapmnt/BWP
/dev/lv_oracle      0.50      0.50    1%       47     1% /oracle
/dev/BWP           5.00      4.55    9%    12334     2% /oracle/BWP
/dev/BWP_102_64      9.00      4.84   47%    22062     2% /oracle/BWP/102_64
/dev/BWP_mirrlogA      0.50      0.40   20%        6     1% /oracle/BWP/mirrlogA
/dev/BWP_mirrlogB      0.50      0.40   20%        6     1% /oracle/BWP/mirrlogB
/dev/BWP_oraarch     50.00     38.82    93%      279     1% /oracle/BWP/oraarch
/dev/BWP_origlogA      0.50      0.36   29%        9     1% /oracle/BWP/origlogA

2、查看当前活动的卷,只有两个,经与工程师确认数据库归档日志目录在ORAVG卷上。
# lsvg -o
oravg
rootvg
进一步详细查看ORAVG卷的信息
# lsvg -l oravg
oravg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
lv_oracle           jfs2       2       2       1    open/syncd    /oracle
client              jfs2       2       2       1    open/syncd    /oracle/client
stage_102_64        jfs2       28      28      1    open/syncd    /oracle/stage/102_64
BWP                 jfs2       20      20      1    open/syncd    /oracle/BWP
BWP_102_64          jfs2       36      36      1    open/syncd    /oracle/BWP/102_64
BWP_origlogA        jfs2       2       2       1    open/syncd    /oracle/BWP/origlogA
BWP_origlogB        jfs2       2       2       1    open/syncd    /oracle/BWP/origlogB
BWP_mirrlogA        jfs2       2       2       1    open/syncd    /oracle/BWP/mirrlogA
BWP_mirrlogB        jfs2       2       2       1    open/syncd    /oracle/BWP/mirrlogB
BWP_oraarch         jfs2       200     200     1    open/syncd    /oracle/BWP/oraarch
发现当前目录的PPS大小为200
3
# lsvg oravg
VOLUME GROUP:       oravg                    VG IDENTIFIER:  00c6abcf00004c000000012d038039cb
VG STATE:           active                   PP SIZE:        256 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      7191 (1840896 megabytes)
MAX LVs:            512                      FREE PPs:       2589 (582912 megabytes)
LVs:                18                       USED PPs:       4602 (1257984 megabytes)
OPEN LVs:           18                       QUORUM:         5 (Enabled)
TOTAL PVs:          9                        VG DESCRIPTORS: 9
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         9                        AUTO ON:        no
MAX PPs per VG:     130048                                   
MAX PPs per PV:     1016                     MAX PVs:        128
LTG size (Dynamic): 1024 kilobyte(s)         AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable
查看oravg卷组信息可知每个PPS大小为256M,目前oravg还剩2589PPS,共计662784M

4
扩展文件系统的空间
扩大 pp extendlv lv_appdata1 200 

smit chlv==>Change a logical Volume==>Logical volume name==>F4(选择你要修改的lvname)回车
MAXIMUM NUMBER of LOGICAL PARTITIONS [1024] 把数值一改,回车后,见到左上角“OK


使用命令 # chfs -a size=+78G /oracle/BWP/oraarch #意思是给/oracle/BWP/oraarch增加78G的空间(注意G是大写)
执行完再lsvg 发现free pp size 没有增加,但是用smitty chfs 来做的时候
发现,增加的 size /oracle/BWP/oraarch上已经体现了。

使用smitty chfs来扩容的过程:

#smitty chfs回车后选择这一项Change/Show Characteristics of an Enhanced Journaled File System,然后在目录列表里找到需要扩容的目录按回车。

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

                                                    [Entry Fields]
  File system name                                    /oracle/BWP/oraarch
  NEW mount point                                    [/oracle/BWP/oraarch]
  SIZE of file system
          Unit Size                                   Megabytes                                  +
          Number of units                            [79872]                                     #
  Mount GROUP                                        []
  Mount AUTOMATICALLY at system restart?              no                                         +
  PERMISSIONS                                         read/write                                 +
  Mount OPTIONS                                      []                                          +
  Start Disk Accounting?                              no                                         +
  Block Size (bytes)                                  4096
  Inline Log?                                         no
  Inline Log size (MBytes)                           [0]                                          #
  Extended Attribute Format                          [v1]
  Enable Quota Management?                            no                                         +
  Allow Small Inode Extents?                          no                                         +


we will see result:

                                           COMMAND STATUS

Command: OK            stdout: yes           stderr: no

Before command completion, additional instructions may appear below.

Filesystem size changed to 131072   #扩容后包含已有空间的容量

5、再检查一下看新增上没有

# df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           5.00      4.90    3%     7024     1% /
/dev/hd2          20.00     14.77   27%    57935     2% /usr
/dev/hd9var       10.00      9.37    7%     7454     1% /var
/dev/hd3          15.00     14.41    4%     3381     1% /tmp
/dev/hd1           6.00      5.01   17%     1873     1% /home
/proc                 -         -    -         -     -  /proc
/dev/hd10opt      15.00     14.62    3%    10242     1% /opt
/dev/lv00          0.25      0.24    4%       18     1% /var/adm/csd
/dev/fslv00       10.00      9.20    8%     2876     1% /sapmnt/BWP
/dev/lv_oracle      0.50      0.50    1%       47     1% /oracle
/dev/BWP           5.00      4.55   10%    12348     2% /oracle/BWP
/dev/BWP_102_64      9.00      4.84   47%    22069     2% /oracle/BWP/102_64
/dev/BWP_mirrlogA      0.50      0.40   20%        6     1% /oracle/BWP/mirrlogA
/dev/BWP_mirrlogB      0.50      0.40   20%        6     1% /oracle/BWP/mirrlogB
/dev/BWP_oraarch    128.00     99.82   23%      663     1% /oracle/BWP/oraarch

好了,一切正常,扩容成功。

 

总结

chfs -a size=+xxG /文件系统


extendlv lv00 xx--->
指扩展的PP
chfs -a size=+xxG /
文件系统

 

l        #lspv 找到新增加的物理卷(逻辑驱动器,以hdisk8为例)。

l        #chdev –l hdisk8 –a pv=yes写入新的物理卷的pvid

l        #extendvg cwdatavg hdisk8,扩展卷组的空间,将新的物理卷添加到卷组中。

l        #lslv fslv02检查文件系统所在的逻辑卷fslv02,查看是否已经达到最大的pp扩展

    数,如果达到则需执行smit chlvMAXIMUM NUMBER of LOGICAL PARTITIONS的数值进行修改。

         

l        #chfs –a size=+50G/cwdatacwdata文件系统增加50G的空间,注意“G”要大写。

    l    #df –g查看文件系统cwdata的空间已经增加