Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display the amount of free space available

Status
Not open for further replies.

generaal

Programmer
Jan 11, 2007
58
ZA
I need to work out exactly how much free space is available on our server, but I only know the df - command, which displays how much space is in use by filesystems. Is there any way to determine how much free space each disk has?
 
For all disks used as PVs (PhysicalVolume) in all active VGs (VolumeGroup):
lsvg -o|lsvg -i|grep -E 'VOLUME GROUP|FREE PPs'

(you'll need to cut out part of the data in the output)

Of course, disks that are not yet PVs - not yet allocated to VGs - are not listed/counted...


HTH,

p5wizard
 
Well, you've got lspv and lsvg

To see free space on each disk type lspv, it will show all your disks. For each disk shown by lspv type lspv hdiskX, it will show information about the disk:

Code:
#lspv
hdisk0      00cbc0dc203d98a5      rootvg          active
hdisk1      00cbc0dc2635f7d5      rootvg          active
#lspv hdisk0
PHYSICAL VOLUME:    hdisk0          VOLUME GROUP:     rootvg
PV IDENTIFIER:      00cbc0dc203d98a5 VG IDENTIFIER     00cbc0dc00004c0000000113506d9b32
PV STATE:           active
STALE PARTITIONS:   0                  ALLOCATABLE:      yes
PP SIZE:            128 megabyte(s)    LOGICAL VOLUMES:  10
TOTAL PPs:          546 (69888 megabytes)    VG DESCRIPTORS:   2
[b]FREE PPs:           354 (45312 megabytes)[/b]    HOT SPARE:        no
USED PPs:           192 (24576 megabytes)    MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  109..102..00..34..109
USED DISTRIBUTION:  01..07..109..75..00

There is also lsvg, that can be more useful depending on your needs. Type lsvg, it will show all VGs, and for each VG type lsvg VGNAME, and it will show information about the VG:

Code:
#lsvg
rootvg
#lsvg rootvg
VOLUME GROUP:       rootvg                   VG IDENTIFIER:  00cbc0dc00004c0000000113506d9b32
VG STATE:           active                   PP SIZE:        128 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1092 (139776 megabytes)
MAX LVs:            256                      [b]FREE PPs:       708 (90624 megabytes)[/b]
LVs:                10                       USED PPs:       384 (49152 megabytes)
OPEN LVs:           9                        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): 256 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable
 
print "$(lsvg -Lo |xargs lsvg -L|grep "TOTAL PPs"|awk -F"(" '{print$2}'|sed -e "s/)//g" -e "s/megabytes/+/g"|xargs|sed -e "s/^/(/g" -e "s/+$/)\/1000/g"|bc ) GB"

sub TOTAL for USED or FREE

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Lots of solutions, but I believe the question needs clarification as there's several type of "free" disk space in AIX.

1) There's free filesystem space.
2) There's space allocated to an LV, but not allocated to a filesystem (undesireable, but can happen)
3) There's space free in a volume group.
4) There's space free on a particular physical volume.
5) There's disks not allocated to a volume group.

This doesn't even get into disk virtualization on partitioned P5s.

I think most are going to give you the way to get #4, but I find more often that #3 is what is being asked for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top