IBM Support

dfvg - show free space in AIX file systems, but sorted by Volume Group

How To


Summary

A method to show free space in AIX file systems, but sorted by Volume Group

Objective

Banner_AIX

Environment

Here is an AIX shell script to show standard df information, but sorted by Volume Group (VG).
You can use it to find a file system to shrink, in order to free some Physical Partitions (PPs) to enlarge another file system, which is running low on space. The filesystems need to be in the same VG to be able to do that.
##############################################################################
#                                                                            #
# A simple script to estimate disk usage in filesystems in all volume groups #
#                                                                            #
#          Written by Gareth Coates gaz@uk.ibm.com in November 2019          #
#                                                                            #
#                       Copyright (c) IBM 2019                               #
#                                                                            #
##############################################################################

lsvg | while read VG
do

echo "disk usage in $VG filesystems: "
lsvg -l $VG| awk ' !/N\/A|LV|$VG/ { print $7 }' | xargs df -gP
echo
done
This script relies upon sumcol - see this post in this blog.

Steps

And here is the output: 
disk usage in rootvg filesystems:
Filesystem    GB blocks      Used Available Capacity Mounted on
/dev/hd4          18.25      1.15     17.10       7% /
/dev/hd2           6.25      2.54      3.71      41% /usr
/dev/hd9var        4.00      1.89      2.11      48% /var
/dev/hd3           4.00      1.08      2.92      27% /tmp
/dev/hd1          64.00     45.10     18.90      71% /home
/dev/hd10opt       4.00      0.55      3.45      14% /opt
/dev/livedump      0.50      0.00      0.50       1% /var/adm/ras/livedump
/dev/hd11admin      0.25      0.00      0.25       1% /admin

disk usage in scratchvg filesystems:
Filesystem    GB blocks      Used Available Capacity Mounted on
/dev/fslv00       50.00      7.56     42.44      16% /scratch

disk usage in webvg filesystems:
Filesystem    GB blocks      Used Available Capacity Mounted on
/dev/fslv01       96.00     21.47     74.53      23% /webpages
/dev/fslv02        2.00      0.72      1.28      36% /weblogs

disk usage in backupvg filesystems:
Filesystem    GB blocks      Used Available Capacity Mounted on
/dev/fslv03      127.00    119.96      7.04      95% /backup
This script could easily be ported to other flavors of Unix and to Linux. The particular syntax for the Volume Group would need to change and many flavors do not have an option to display the disk free space in GB, so you can change "df -gP". For example, in Linux you might use "df -hP". 

Additional Information

You can contact me: 

Document Location

Worldwide

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"HW1A1","label":"IBM Power Systems"},"Component":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
03 May 2021

UID

ibm11118115