DBA Walkthrough - Adding Space on IBM AIX Power Machines

Published on November 2, 2018 by Matt Edwards

Matt Edwards

Topics: Database Management

DBA Walkthrough – Adding space on IBM AIX Power Machines
 
Each Unix flavor has their own method of managing storage / filesystems, and over the decades I have found that DBA’s are 
generally least familiar with managing space on IBM AIX – Power machines. I thought this might be a worthwhile
demo of expanding a filesystem on AIX so that DBA’s get a high level overview of how AIX storage management works.
 
This exercise was done on an IBM S824 Power8 machine, running AIX 7.2. No downtime for the database is required.
 
AIX storage management deals mostly with PV’s (Physical Volumes), VG’s (Volume Groups), and LV’s (Logical Volumes).
 
Your LV is what ends up being mounted as a filesystem. So, to add storage, this is all you need to do:
 
Find out with Logical Volume your filesystem is. I want to expand the /oradata filesystem as it is almost 100% full.
This info can be found in /etc/filesystems or by using lsfs:

# cat /etc/filesystems
 
/oradata:
        dev             = /dev/oradatalvc
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        account         = false
 
# lsfs | grep "oradata"
/dev/oradatalvc --         /oradata               jfs2  22482518016 --         yes  no
 
In the case of /oradata – the logical volume is “oradatalvc”.  Logical Volumes are part of Volume Groups on AIX, so
let’s next find out which VG this filesystem is part of:
 
# lslv oradatalvc
 
LOGICAL VOLUME:     oradatalvc             VOLUME GROUP:   stbydatavg
LV IDENTIFIER:      00fb2ac000004c00000000027f27b443.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            19438                  PP SIZE:        512 megabyte(s)
 
 
The filesystem I want to grow is part of the “stbydatavg” volume group. Let’s get the properties of this volume group
so we can see if there’s any free space in it:
 
# lsvg stbydatavg
 
VOLUME GROUP:       stbydatavg               VG IDENTIFIER:  00fb2ac000004c00000000027f27b443
VG STATE:           active                   PP SIZE:        512 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      19537 (10002944 megabytes)
MAX LVs:            512                      FREE PPs:       0 (0 megabytes)
LVs:                3                        USED PPs:       19537 (10002944 megabytes)
 
 
A PP is a “Physical Partition” – and this size is 512 megabytes. We have 0 free PP’s as you can see, so we must add disks to the Volume Group before we can expand the filesystem.
 
The storage must be presented from the frame and discovered on the AIX machine, and only then it can be added. To see if that is done and
what disks are free use the lspv command (ls physical volume):
 
# lspv
 
hdisk60         00fb2ac07f2960a7                    stbyora01vg     active
hdisk61         00fb2ac098856472                    stbyarchvg      active
hdisk62         00fb2ac098856534                    stbyarchvg      active
hdisk63         00fb2ac0988565f6                    stbyarchvg      active
hdisk64         00fb2ac07d35559a                    none     
hdisk65         00fb2ac07d355654                    none    
hdisk66         00fb2ac07d35570f                    none     
hdisk67         00fb2ac07d3557c6                    none     
hdisk68         00fb2ac07d35587c                    none     
 
Here we have hdisk64 to hdisk68 free and can be added to a VG. Let’s go ahead and do that:
 
# extendvg stbydatavg hdisk64 hdisk65 hdisk66 hdisk67 hdisk68
 
You should now see free partitions available on the volume group:
 
# lsvg stbydatavg
 
VOLUME GROUP:       stbydatavg               VG IDENTIFIER:  00fb2ac000004c00000000027f27b443
VG STATE:           active                   PP SIZE:        512 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      21540 (11028480 megabytes)
MAX LVs:            512                      FREE PPs:       2003  (1025536 megabytes)
LVs:                3                        USED PPs:       19537 (10002944 megabytes)
 
The volume group is now ready ! let’s go back to the logical volume and make sure that we have it configured properly
for the 2003 Physical Partitions we are now going to add to it:
 
# lslv stbydatalvc
 
LOGICAL VOLUME:     oradatalvc             VOLUME GROUP:   stbydatavg
LV IDENTIFIER:      00fb2ac000004c00000000027f27b443.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            20000                  PP SIZE:        512 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                19438                  PPs:            19438
 
No go - we can’t add all the free physical partitions to this volume group as it is capped at 20000 and we
need 21441 total partitions. So let’s increase the max allowed to 22,000:
 
# chlv -x 22000 oradatalvc
# lslv oradatalvc
 
LOGICAL VOLUME:     oradatalvc             VOLUME GROUP:   stbydatavg
LV IDENTIFIER:      00fb2ac000004c00000000027f27b443.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            22000                  PP SIZE:        512 megabyte(s)
 
now our max is set to 22000. Final step ? Expand the filesystem ! Since our Physical Partitions are 512 megabytes
in size and we are adding 2003 PP’s, we will expand by 1025536 megabytes:
 
# chfs -a size=+1025536 /oradata
 
Congrats, the filesystem has now been increased by approximately 1 terabyte. that can be confirmed with a df -g:
 
# df -g
 
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/oradatalvc  10720.50   1093.12   90%      567     1% /oradata
 
- Matt EdwardsSenior Consultant