Wednesday, May 27, 2015

AIX -- extending Logical Volumes online

In this post, we will extend an Logical Volume size in AIX system.
The AIX system used in this example, is AIX 5.3.
The operation is online, and the effects of it can be seen instantaneously.
We use commands like lsvg, lslv, chfs, chlv and df in this example..
Here is a general information about them:

lsvg: Displays information about volume groups
lslv: Displays information about a logical volume
chfs: Changes attributes of a file system
chlv :Changes only the characteristics of a logical volume
df : Reports information about space on file systems

Also, I will give general information about  the terms used in this example.

LV: Logical Volume
LP: Logical Partition 
PP: Physical Partition
PPSIZE : Physical Partition Size
JFS: journaled file system
JFS2: Enhanced journaled file system. JFS2 is designed to accommodate a 64-bit kernel and larger files

So , lets start..
First, we check the volume groups in this system and then get the information about the relevant volume group ..

ermansrv1: / > lsvg
rootvg
oravg --> this volume group is in our focus..

ermanrv1: / > lsvg oravg

VOLUME GROUP:       oravg                    VG IDENTIFIER:  00c6265000004c0000000116a075433a
VG STATE:           active                   PP SIZE:        256 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1596 (408576 megabytes)
MAX LVs:            256                      FREE PPs:       143 (36608 megabytes)
LVs:                5                        USED PPs:       1453 (371968 megabytes)
OPEN LVs:           5                        QUORUM:         3
TOTAL PVs:          4                        VG DESCRIPTORS: 4
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         4                        AUTO ON:        yes
MAX PPs per VG:     32512
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 1024 kilobyte(s)         AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable

So, "There are 143 PPs, almost 35 GB free area in the volume group."
Okay.. We have free PPs to grow, but do quota to grow?
I mean, If we are not in the limit of max allocations; we can just extent the filesystem.

ermanrv1: / > chfs -a size=+1G /orahome
Filesystem size changed to 44040192
ermandbsrv1: / > df

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/fslv02     44040192   2096832   96%    39495    15% /orahome  (Enlarged)

But if we have reached the max allocation for a logical volume;
We will get error while using chfs;

ermanrv1: / > chfs -a size=+20G /data
0516-787 extendlv: Maximum allocation for logical volume fslv00  is 1000.

If that's the case, we need to increase the max allocation for that volume group reasonably.
To find the correct limit to set the lv; we use lsvg and lslv commands.. ;
(the LV is made up of LPs.  The LP corresponds to 1 or more (in the case of mirroring) PPs.)

lsvg shows us, the PPSIZE;

 lsvg oravg
VOLUME GROUP:       oravg                    VG IDENTIFIER:  00c6265000004c0000000116a075433a
VG STATE:           active                   PP SIZE:        256 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1596 (408576 megabytes)
MAX LVs:            256                      FREE PPs:       39 (9984 megabytes)
LVs:                5                        USED PPs:       1557 (398592 megabytes)
OPEN LVs:           5                        QUORUM:         3
TOTAL PVs:          4                        VG DESCRIPTORS: 4
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         4                        AUTO ON:        yes
MAX PPs per VG:     32512
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 1024 kilobyte(s)         AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable

lslv shows us how much LP corresponds to how much PP and what is our limit is..

Note that: while listing the logical volume information, we need to pass the logical volume name as input.. The logical volume name can be derived using the lsvg command;

ermansrv1: / > lsvg -l oravg    (what logical volumes do we have in our  volume group named oravg)
oravg:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
loglv00             jfs2log    1     1     1    open/syncd    N/A
fslv00              jfs2       1008  1008  4    open/syncd    /data  --> here we have logical volume named fslv00 for the /data mount point, so we will use fslv00 as an input while using lslv and chlv commands.
fslv01              jfs2       336   336   4    open/syncd    /index
fslv02              jfs2       104   104   3    open/syncd    /orahome
fslv03              jfs2       108   108   1    open/syncd    /appl_top

Then we use the lslv command to see the current allocation and quota for our logical volume..

ermansrv1: / > lslv fslv00
LOGICAL VOLUME:     fslv00                 VOLUME GROUP:   oravg
LV IDENTIFIER:      00c6265000004c0000000116a075433a.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            1000                   PP SIZE:        256 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                960                   PPs:            960
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        /data                  LABEL:          /data
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?:     NO

From this ouput , we see the PP size , MAX LPs and current LPs..
So we are now ready to execute chlv to increase our MAX LP limit accordingly..

ermansrv1: / > chlv -x 1100 fslv00   , we change the lp limit (logical partition limit) it makes 256 * 1100 /1024 GB = 275GB
and then execute lslv again..

ermansrv1: / > lslv fslv00
LOGICAL VOLUME:     fslv00                 VOLUME GROUP:   oravg
LV IDENTIFIER:      00c6265000004c0000000116a075433a.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            1100                   PP SIZE:        256 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                1008                   PPs:            1008
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        /data                  LABEL:          /data
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?:     NO

So,the MAX LP value is increased as you see.. Good..
At this point we can execute chfs again.

ermansrv1: / > chfs -a size=+20G /data
Filesystem size changed to 528482304

ermansrv1: / > df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/fslv00      252.00     20.61   92%     2213     1% /data (Enlarged)

That 's all. Note that: this is an online operation.. So Your Oracle Database may be running, your Oracle Applications or any other application may be running during this operation..

Note that: The filesystems used in this example are jfs2.. In jfs2, we can even decrease the filesystem size, but in jfs the filesystem size can not be reduced..

No comments :

Post a Comment