AIXFilesystemSize

How to increase the size of a filesystem under AIX

This is a very frequent request by our users: "Could you please add X Gigabytes to filesystem Y?".

Fortunately, this is also a very easy thing to under AIX, with the command chfs:

1. Make sure there is enough disk space

This should be obvious, but you never know... ;-)

For instance, here is how to do it on a production machine that needs more disk space on the filesystem named /accounting:

First things first: how much disk space is left on /accounting?

# df -g /accounting
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/acctlv       19.81      1.65   92%    58627    11% /accounting

The LV (Logical Volume) of /accounting is /dev/acctlv. Now, where is the VG (Volume Group) that contains /dev/acctlv?

# lslv acctlv
LOGICAL VOLUME:     acctslv                VOLUME GROUP:   datavg
LV IDENTIFIER:      0001650f0000d6000000011662730419.4 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        64 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                317                    PPs:            317
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        /accounting            LABEL:          /accounting
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?:     NO

Now, we know that acctlv is in the VG datavg... is there any space left on this VG?

# lsvg datavg
VOLUME GROUP:       datavg                   VG IDENTIFIER:  0001650f0000d6000000011662730419
VG STATE:           active                   PP SIZE:        64 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1598 (102272 megabytes)
MAX LVs:            256                      FREE PPs:       361 (23104 megabytes)
LVs:                8                        USED PPs:       1237 (79168 megabytes)
OPEN LVs:           8                        QUORUM:         1
TOTAL PVs:          2                        VG DESCRIPTORS: 3
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         2                        AUTO ON:        yes
MAX PPs per VG:     32512
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 128 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable

The interesting line in the information above is FREE PPs line above: we have 23 Gigabytes left on the device, or 361 Physical Partitions (PPs).

2. Calculate the new configuration

The magical formula is this one:

Therefore, we can add 10 Gigabytes to /accounting using this formula:

3. Add the disk space to the filesystem

Keeping on with our example, here the chfs command to be issued as root:

# chfs -a size=+20971520 /accounting
Filesystem size changed to 62521344

Give the system a few minutes to add the disk space, and the filesystem should be OK.

4. Check the new size of the filesystem

Compare and contrast with the numbers given above:

# df -g /accounting
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/acctlv       29.81     12.74   58%    58607     2% /accounting

You can also check the size of the datavg VG to make sure it has lost some PPs:

# lsvg datavg
VOLUME GROUP:       datavg                   VG IDENTIFIER:  0001650f0000d6000000011662730419
VG STATE:           active                   PP SIZE:        64 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1598 (102272 megabytes)
MAX LVs:            256                      FREE PPs:       201 (12864 megabytes)
LVs:                8                        USED PPs:       1397 (89408 megabytes)
OPEN LVs:           8                        QUORUM:         1
TOTAL PVs:          2                        VG DESCRIPTORS: 3
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         2                        AUTO ON:        yes
MAX PPs per VG:     32512
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 128 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable

That's all there is to it: hot resizing of the JFS/JFS2 filesystems is -- as far as I am concerned -- one of the strong points of AIX.