Pages

Thursday, February 21, 2013

Extend a AIX LVM Volume

Today I had a customer who asked me to extend a database volume (if possible). The customer couldn't tell me if there is space available for extending the volume. So I had to check by my self again. After logging into the customers machine the first I ran was df to get the current size and usage of the volume:

# df -k /oradata
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/oravol01    47185920   5880024   88%       50     1% /oradata


A closer look at the attributes gave me the following information:

# lslv oravol01
LOGICAL VOLUME:     oravol01               VOLUME GROUP:   oravg
LV IDENTIFIER:      000cc8480000d7000000011d4379fef4.1 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        1024 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                45                     PPs:            45
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    2
MOUNT POINT:        /oradata               LABEL:          /oradata
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?:     NO


Important information for extending the volume are:

VOLUME GROUP:   oravg
COPIES:         1
PP SIZE:        1024 megabyte(s)
TYPE:           jfs2
PPs:            45
MOUNT POINT:    /oradata


45 physical partitions (PP) multiplied by 1GB/PP equals 45GB which is also represented by the df command above. There is only 1 copy which means that the volume is not mirrored (otherwise the PPs would be 90 while the LP's would be 45).
The next thing I needed to know where the free PP's inside the oravg volume group:

# lsvg -p oravg
oravg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
...
hdisk4            active            279         44          00..00..00..00..44
...


hdisk4 was the only disk with some free PPs available. So the customer was lucky and the volume can be increased by 44G. For extending a volume and resizing the filesystem IBM provides the command chfs which can do both:

# chfs -a size=89G /oradata
...


After the volume and the filesystem was resized a final check with df and lslv again:

# df -k /oradata
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/oravol01    93323264  51830128   45%       50     1% /oradata
# lslv oravol01
LOGICAL VOLUME:     oravol01               VOLUME GROUP:   oravg
LV IDENTIFIER:      000cc8480000d7000000011d4379fef4.1 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        1024 megabyte(s)
COPIES:             2                      SCHED POLICY:   parallel
LPs:                89                     PPs:            89
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    2
MOUNT POINT:        /oradata               LABEL:          /oradata
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?:     NO


And the volume oravol01 was successfully resized from 45GB to 89GB.

Links:
AIX Logical Volume Manager from A to Z: Introduction and Concepts