Extending a Filesystem in AIX 6.1

Aix allows extending a filesystem on the fly. This feature has been around for over 15 years. I first used it with AIX 3.1. What an AIX system is intalled, it can be set up with minimal requirements and then each filesystem can be grown on the fly as needed. In fact the installer has an option to grow automatically any file system as needed during the install of a new package.

However, there is always a time when the physical limits of the available storage are reached. In that case, it is needed to either add a physical disk to the machine, or add a LUN from the SAN, or add a virtual disk to the LPAR. Next I show what to do once the additional physical storage has been added:

  • First lets make sure that the new storage is recognized:lspv will list the recognized storage units. If the new storage is regocnized, it will be visible on a line like:
    hdiskX               none             none

    “X” is a placeholder for a number, like “hdisk3.” If the new storage isn’t visible yet, then we need to tell AIX to look for it with: cfgmgr this command should take only a few seconds to rescan the system. Once it returns list the physical volumes again, and you should see the new volume.

  • Now we need to decide which logical volume to extend. The list of logical volumes is shown by lsvg. On simple installs, all you will see is rootvg. To extend rootvg all you have to do is:
    extendvg rootvg hdiskX
  • Finally we can grow the file system that we needed to grow either with smit, smitty or the direct command chfs. For example:
    chfs -a size=+1048576 /opt


Adding a second disk to an LVM

In a world of storage on demand and virtualized environments, adding more storage on the fly has become simple even on Linux machines without expensive software like Veritas storage manager.  Here is how to proceed:

  • need to use LVM or LVM 2
  • add the new disk as an LVM capable physical volume: pvcreate /dev/sdb (or hdX)
  • add the new disk to the volume group, e.g. vgextend VolGroup00 /dev/sdb
  • extend the logical volume, e.g. lvextend -L +55G /dev/VolGroup00/LogVol00
  • unmount the volume to resize (this may require stopping services and/or boot into rescue mode)
  • check the partition: e2fsck -f /dev/VolGroup00/LogVol00
  • resizet the partition: resize2fs /dev/VolGroup00/LogVol00

If booting from rescue, before you can act on the partition, you need to enable it with:

  • vgchange -a y VolGroup00
  • lvchange -a y /dev/VolGroup00/LogVol00