Operating System - HP-UX
1835210 Members
2379 Online
110077 Solutions
New Discussion

Re: Calculating free space

 
SOLVED
Go to solution
Igor Sovin
Super Advisor

Calculating free space

How to make script that calculates free space left on a volume?
6 REPLIES 6
Torsten.
Acclaimed Contributor

Re: Calculating free space

Do a "pvdisplay -v /dev/dsk/cxtxdx" for this disk and note PE Size and Free PE. Now you can calculate. The same for free space available for new or extended LVOL with the "vgdisplay -v" command.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Fabio Ettore
Honored Contributor
Solution

Re: Calculating free space

Hi Igor,

it depends what you mean with volume (logical volume and filesystem or volume group).
If you mean filesystem then in attachment a script. When you launch it then the script will send a mail (to ) if there is a filesystem that take over 90% on bdf. You can schedule it by cron every day to check.

If you mean volume group launch vgdisplay and take two lines:

PE Size (Mbytes) 4
Free PE 413

Here above just an example:
4*413 = 1652 Mb free on volume group

HTH.

Best regards,
Fabio



WISH? IMPROVEMENT!
Igor Sovin
Super Advisor

Re: Calculating free space

Hi Fabio!
Thank you! I think your script can help me greatly, but how to calculate free space in Kbs left on file system?
Fabio Ettore
Honored Contributor

Re: Calculating free space

Hi Igor,

just launch

bdf

and under the column 'avail' you will see the free space available on filesystems. It is in Kbytes!

HTH.

Best regards,
Fabio
WISH? IMPROVEMENT!
spex
Honored Contributor

Re: Calculating free space

Fabio,

bdf | awk '{a+=$4} END {printf "%d\n",a}'

will give you total kbytes free across all volumes. If you want to limit the sum to local volumes, use 'bdf -l' instead of 'bdf'.

PCS
Igor Sovin
Super Advisor

Re: Calculating free space

Thanks Spex, that was exactly what I need.
And thanks to all