File System Resizing

When dealing with a JFS or JFS2 filesystem to resize in AIX, it is necessary to determine which volume group requires resizing.

Here will be an example from server1, adding space to filesystem /server1/data:

  • Type df to get a list of all mount points and their sizes:
server1:/roothome# df
Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4         1474560    793664   47%    10062     3% /
/dev/hd2        10682368   3020408   72%    97612     8% /usr
/dev/hd9var      1507328   1187584   22%     1671     1% /var
/dev/hd3         1474560   1390984    6%      489     1% /tmp
/dev/hd1         1769472   1179856   34%     2693     2% /home
/proc                  -         -    -         -     -  /proc
/dev/hd10opt     1933312    940640   52%     9058     2% /opt
/dev/datalv      3276800   1607768   51%      680     1% /server1/data
/dev/usrlocallv    4194304   2236200   47%    19701     8% /usr/local
server1:/roothome#

The /dev/datalv device is mounted at /server1/data and is 51% free.

  • Type lslv datalv (list logical volume datalv) to list the volume group it is in, in this case rootvg:
server1:/roothome# lslv datalv
LOGICAL VOLUME:     datalv                 VOLUME GROUP:   rootvg
LV IDENTIFIER:      xxxxxxxxxxxxxxxxxxx.xx PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs                    WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        16 megabyte(s)
COPIES:             2                      SCHED POLICY:   parallel
LPs:                100                    PPs:            200
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    2
MOUNT POINT:        /server1/data           LABEL:          /server1/data
MIRROR WRITE CONSISTENCY: on/ACTIVE                              
EACH LP COPY ON A SEPARATE PV ?: yes                                    
Serialize IO ?:     NO                                     
server1:/roothome#
  • Type lsvg rootvg
server1:/roothome# lsvg rootvg
VOLUME GROUP:   rootvg                   VG IDENTIFIER:  xxxxxxxxxxxxxxxxxxx
VG STATE:       active                   PP SIZE:        16 megabyte(s)
VG PERMISSION:  read/write               TOTAL PPs:      3803 (60848 megabytes)
MAX LVs:        256                      FREE PPs:       1555 (24880 megabytes)
LVs:            18                       USED PPs:       2248 (35968 megabytes)
OPEN LVs:       16                       QUORUM:         1
TOTAL PVs:      5                        VG DESCRIPTORS: 5
STALE PVs:      0                        STALE PPs:      0
ACTIVE PVs:     4                        AUTO ON:        no
MAX PPs per PV: 2032                     MAX PVs:        16
LTG size:       128 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:      no                       BB POLICY:      relocatable 
server1:/roothome#
  • NOTE: in Linux the commands would be vgdisplay and lvdisplay.*

lsvg rootvg will give you a break down on the file system, including the PP Size, and Free PPs.

Run oslevel -r to check the version of AIX; if it is before 5200, then it is the old style block calculations, later versions permit resizing using sizes expressed in megabytes or gigabytes. Alternatively type man chfs to see if the size command supports +MB or +GB.

To increase the filesystem size under AIX 5.2 or later, type in chfs -a size=+16M mountname (increase filesystem mountname by 16M), for example:

server1:/roothome# chfs -a size=+16M /server1/data
Filesystem size changed to 2230152
server1:/roothome#

If you get an error from the command above like this:

0516-787 extendlv: Maximum allocation for for logical volume rootvg is 550.

This is referring to the index (bitmap) is at its maximum for a PV (Physical Volume). The index is a power of two, take the max PPs per PV to the next power of two and run chlv -x with that number. See the man page for chlv for more details, or use Google to find examples from other admins.

With AIX 5.2 and below, filesystems cannot be resized using +M or +G, it has to be increased by 512 byte blocks. Thus, the calculation for 8 GB (8,589,934,592 bytes) would be:

8589934592 / 512  = 16777216

This above amount has to be divisible by the PP size, or increase/reduce the value until it divisible.

The command to run would then be:

chfs -a size=+ 16777216

Stumbled across this error when attempting to increase the space on server02.

server02:/# chfs -a size=+2G /home/app/rubarb/
0516-404 allocp: This system cannot fulfill the allocation request.
        There are not enough free partitions or not enough physical volumes 
        to keep strictness and satisfy allocation requests.  The command
        should be retried with different allocation characteristics.
server02:/# lslv app1lv
LOGICAL VOLUME:     app1lv             VOLUME GROUP:   appsvg
LV IDENTIFIER:      xxxxxxxxxxxxxxxxxxxx.1 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            1024                   PP SIZE:        128 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                509                    PPs:            509
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    2
MOUNT POINT:        /home/app/rubarb       LABEL:          /home/app/rubarb
MIRROR WRITE CONSISTENCY: on/ACTIVE                              
EACH LP COPY ON A SEPARATE PV ?: yes                                    
Serialize IO ?:     NO

Next, let’s see how many PVs we have, and their utilization:

server02:/# lsvg -p appsvg
javacapsvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdiskpower0       active            269         0           00..00..00..00..00
hdiskpower1       active            269         12          00..00..00..00..12
hdiskpower2       active            67          67          14..13..13..13..14
hdiskpower3       active            67          67          14..13..13..13..14
hdiskpower4       active            67          67          14..13..13..13..14

Now as you can see from looking at the LV, the UPPER BOUND = 2. This means you can only have 2 PVs for this LV. As we have 5 PVs, we would want to change the UPPER BOUND limit to equal 5. This is achieved with the following command:

chlv -u 5 app1lv

Confirm with the following command:
lslv app1lv