
On AIX, determining how much total disk space is available, how it’s being used, and how much free space is available can be a challenging task. AIX’s logical volume manager (LVM) is one of its most powerful and useful tools, but using it to determine disk usage can be complicated. In this article, I’ll show you how to break down disk space usage and determine how much space is still available. I’ll also explain each level of the LVM and how to understand disk usage at each level.
The AIX LVM has four layers: physical volumes, volume groups, logical volumes, and file systems. There are several places in the LVM where you can monitor total and available disk space. You can use LVM to determine:
- Total space of all physical volumes (hdisks) on the system
- Space from the physical volumes allocated to volume groups
- Used and free space on each volume group
- Used and free space on each file system
- Hidden used and free space, including LVM mirroring and logical volumes without file systems
Figure 1 shows the various levels of the LVM and the places free space can exist. Our example server has 500GB of disk allocated to it, but it’s only using 200GB of this space, leaving 300GB free at the various levels of the LVM.

Physical Volumes
Physical volumes are the lowest levels of the LVM in AIX; they show up as hdisk devices. Physical volumes can be physical disks in a server or LUNs presented on a SAN. In either case, a physical volume can be a member of a single volume group. There are two ways to determine the size of a physical volume: the lspv command and the getconf command. Running the following lspv command:
- # lspv hdisk0
gives you the following output:
- PHYSICAL VOLUME: hdisk0 VOLUME GROUP: rootvg
- PV IDENTIFIER: 00cc202e7db580dd VG IDENTIFIER 00cc202e00004c00000001397db582ca
- PV STATE: active
- STALE PARTITIONS: 0 ALLOCATABLE: yes
- PP SIZE: 32 megabyte(s) LOGICAL VOLUMES: 11
- TOTAL PPs: 639 (20448 megabytes) VG DESCRIPTORS: 2
- FREE PPs: 212 (6784 megabytes) HOT SPARE: no
- USED PPs: 427 (13664 megabytes) MAX REQUEST: 256 kilobytes
- FREE DISTRIBUTION: 84..00..00..00..128
- USED DISTRIBUTION: 44..128..127..128..00
- MIRROR POOL: None
The TOTAL PPs: line shows the size of the disk (in this example, 20,448MB). The lspv output also includes useful information on how much of the disk is used (USED PPs) and how much of the disk is available (FREE PPs) in relation to logical volumes. However, lspv won’t work if you try to find the size of a disk that hasn’t been assigned to a volume group:
- # lspv hdisk10
- 0516-320 : Physical volume hdisk10 is not assigned to
- a volume group.
The second method for determining disk size uses the getconf command:
- # getconf DISK_SIZE /dev/hdisk10
- 256
The getconf command returns the number of megabytes of the disk and will work even if the disk isn’t assigned to a volume group.
- for hdisk in `lsdev -c disk | grep "Available" | awk '{print $1}'`; do printf "%-10s %-12s %-15s\n" $hdisk `getconf DISK_SIZE /dev/$hdisk` `lspv | grep "^$hdisk " | awk '{print $3}'` ; done | awk '{total+=$2} {print} END{print "------------------\nTotal: " total " MB (" total/1024 " GB)"}'
This command can be used to determine the total amount of raw physical disk space available on an AIX server. As you can see in the following command output, the server has a total of 22.375GB of disk space available:
- hdisk0 20480 rootvg
- hdisk1 128 datavg
- hdisk2 256 datavg
- hdisk3 256 datavg
- hdisk4 256 testvg
- hdisk5 256 testvg
- hdisk6 256 appvg
- hdisk7 256 appvg
- hdisk8 256 appvg
- hdisk9 256 appvg
- hdisk10 256 None
- ------------------
- Total: 22912 MB (22.375 GB)
Volume Groups and Logical Volumes
Moving up from physical disks, the next two levels in LVM are volume groups and logical volumes. Volume groups are made up of one or more physical volumes. The total available space in a volume group is the sum of all of the physical volumes that make up the volume group. To view the total size of the volume group and the amount of used and free space, use the lsvg command:
- # lsvg rootvg
to get the following output:
- VOLUME GROUP: rootvg VG IDENTIFIER: 00cc202e00004c00000001397db582ca
- VG STATE: active PP SIZE: 32 megabyte(s)
- VG PERMISSION: read/write TOTAL PPs: 639 (20448 megabytes)
- MAX LVs: 256 FREE PPs: 212 (6784 megabytes)
- LVs: 11 USED PPs: 427 (13664 megabytes)
- OPEN LVs: 10 QUORUM: 2 (Enabled)
- TOTAL PVs: 1 VG DESCRIPTORS: 2
- STALE PVs: 0 STALE PPs: 0
- ACTIVE PVs: 1 AUTO ON: yes
- MAX PPs per VG: 32512
- MAX PPs per PV: 1016 MAX PVs: 32
- LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no
- HOT SPARE: no BB POLICY: relocatable
- PV RESTRICTION: none INFINITE RETRY: no
The used space shows how much of the volume group has been allocated to logical volumes. Most logical volumes have file systems on them. Note that the used/free space listed in “lsvg” doesn't take into account how much is used on a file system—it’s simply the size that has been allocated to the logical volume (i.e., the total size of the file system).
To view a summary of all the volume groups on a server, including the total size, free space, and used space, run the following command:
- printf "Volume Group Total(MB) Free(MB) Used(MB)\n"; for vg in `lsvg -o`; do printf "%-18s" $vg; lsvg $vg | perl -nle 'printf "%-11s", $2 if /.*(TOTAL|FREE|USED) PPs:\s+\d+\s+\((\d+) meg.*/'; echo; done | awk '{total+=$2; free+=$3; used+=$4} {print} END{printf "---------\nTotals: %-10s %-10s %-10s\n", total, free, used}'
Running the above command results in the following output:
- Volume Group Total(MB) Free(MB) Used(MB)
- appvg 736 132 604
- datavg 424 52 372
- testvg 368 4 364
- rootvg 20448 6784 13664
- ---------
- Totals: 21976 6972 15004
File Systems
The next level of the LVM contains the file systems. File systems are created on top of logical volumes, and the file system capacity is the size of the logical volume. The df-tm command can be used to see a report on the size of each file system, the used space, and the free space:
- # df -tm
The output from the df -tm command is:
- File system MB blocks Free %Used Iused %Iused Mounted on
- /dev/hd4 320.00 115.60 64% 10786 23% /
- /dev/hd2 2432.00 279.45 89% 48929 38% /usr
- /dev/hd9var 544.00 171.51 69% 8590 16% /var
- /dev/hd3 8192.00 3577.39 57% 228 1% /tmp
- /dev/hd1 32.00 31.62 2% 11 1% /home
- /dev/hd11admin 128.00 127.63 1% 5 1% /admin
- /proc - - - - - /proc
- /dev/hd10opt 544.00 338.55 38% 8954 10% /opt
- /dev/livedump 256.00 255.64 1% 4 1% /var/adm/ras/livedump
- /dev/fslv00 16.00 0.67 96% 5 3% /data1
- /dev/fslv01 352.00 222.62 37% 5 1% /data2
- /dev/fslv02 260.00 109.63 58% 5 1% /test1
- /dev/fslv03 100.00 29.66 71% 5 1% /test2
- /dev/fslv04 300.00 97.63 68% 5 1% /app1
- /dev/fslv05 100.00 30.66 70% 5 1% /app2
- /dev/fslv06 200.00 0.64 100% 5 3% /app3
The df -tm command is useful, but it doesn't show the entire picture, because it doesn't include some things that take up space (e.g., unmounted file systems, paging space, JFS logs, raw logical volumes). It also doesn't take into account additional space used by mirrored logical volumes.
Estimating Used Space
To estimate the amount of used space in the LVM, add up:
- The amount of file system space used in each logical volume that contains mounted file systems
- The total size of each logical volume that doesn't contain a file system (e.g., JFS log, paging space, raw logical volumes)
- The total size of unmounted file systems (remember that you can only determine file system usage for mounted file systems)
We’ll factor in logical volume mirroring when calculating the used space. For example, if a file system is using 70MB but is on a logical volume that's mirrored, the used space will be reported as 140MB. The script in Listing 1 accomplishes the task of estimating used space.
- #!/usr/bin/ksh
- grandtotal=0
- for vg in `lsvg -o`; do
- vgused=0
- echo $vg
- ppsize=`lsvg $vg | perl -nle 'print $1 if /.*PP SIZE:\s+(\d+) meg.*/'`
- lsvg -l $vg | sed -e '1,2d' | while read line; do
- lvname=`echo $line | awk '{print $1}'`
- type=`echo $line | awk '{print $2}'`
- lps=`echo $line | awk '{print $3}'`
- pps=`echo $line | awk '{print $4}'`
- status=`echo $line | awk '{print $6}'`
- fs=`echo $line | awk '{print $7}'`
- let factor="$pps / $lps"
- mirror="unmirrored"
- if [ "$factor" -gt "1" ]; then mirror="mirrored * $factor"; fi
- if [ "$status" = "open/syncd" -a \( "$type" = "jfs" -o "$type" = "jfs2" \) ]; then
- size=`df -tm $fs | sed -e '1d' | awk '{print $3}'`
- tsize=`echo "scale=2; $size * $factor" | bc`
- printf " %-22s using %-10s MB Mounted Filesystem - $mirror\n" $fs $tsize
- else
- let tsize="pps * ppsize"
- d="$lvname/$type"
- if [ "$type" = "jfs" -o "$type" = "jfs2" ]; then
- printf " %-22s using %-10s MB Unmounted Filesystem - $mirror\n" $fs $tsize
- else
- printf " %-22s using %-10s MB Other LV - $mirror\n" $d $tsize
- fi
- fi
- vgused=`echo "scale=2; $vgused + $tsize" | bc`
- done
- printf " Total: %-10s MB\n" $vgused
- grandtotal=`echo "scale=2; $vgused + $grandtotal" | bc`
- done
- echo "----------------------------------------------"
- printf " Total used space for all VG's: %-10s MB\n" $grandtotal
Listing 1: Calculate Estimated Disk Usage
The output from the script in Listing 1 is:
- appvg
- loglv02/jfs2log using 4 MB Other LV - unmirrored
- /app1 using 202.37 MB Mounted File system - unmirrored
- /app2 using 69.34 MB Mounted File system - unmirrored
- /app3 using 199.36 MB Mounted File system - unmirrored
- loglv03/jfslog using 4 MB Other LV - unmirrored
- /app4 using 3.30 MB Mounted File system - unmirrored
- Total: 482.37 MB
- datavg
- loglv00/jfs2log using 4 MB Other LV - unmirrored
- /data1 using 30.66 MB Mounted File system - mirrored * 2
- /data2 using 352 MB Unmounted File system - unmirrored
- Total: 386.66 MB
- testvg
- loglv01/jfs2log using 4 MB Other LV - unmirrored
- /test1 using 150.37 MB Mounted File system - unmirrored
- /test2 using 100 MB Unmounted File system - unmirrored
- Total: 254.37 MB
- rootvg
- hd5/boot using 32 MB Other LV - unmirrored
- hd6/paging using 1152 MB Other LV - unmirrored
- hd8/jfs2log using 32 MB Other LV - unmirrored
- / using 204.10 MB Mounted File system - unmirrored
- /usr using 2152.55 MB Mounted File system - unmirrored
- /var using 373.07 MB Mounted File system - unmirrored
- /tmp using 4614.61 MB Mounted File system - unmirrored
- /home using .38 MB Mounted File system - unmirrored
- /opt using 205.45 MB Mounted File system - unmirrored
- /admin using .37 MB Mounted File system - unmirrored
- /var/adm/ras/livedump using .36 MB Mounted File system - unmirrored
- /application using 211.02 MB Mounted File system - mirrored * 3
- Total: 8977.91 MB
- ----------------------------------------------
- Total used space for all VG's: 10101.31 MB
Put Your Knowledge to Work
In this article, we examined how to look at total space, used space, and available space at each level of the LVM: physical volumes, volume groups, logical volumes, and file systems. Equipped with this knowledge, you should now be able to better manage available disk space on your AIX systems.
Download AIX User-Related Commands (Infographic) today! This quick guide highlights differences between user administration commands on AIX and other UNIX-derived operating systems.