Operating System - HP-UX
1753320 Members
6310 Online
108792 Solutions
New Discussion юеВ

Showing free space in volume group

 
SOLVED
Go to solution

Showing free space in volume group

Goodday,

I'm looking for a script/program to show the free space in a volume group.
vgdisplay will not do because it shows only the allocated space. I want to see what's really in use.
Counting all the free space for filesystems in vg00 is kind of awkward.
Thanks for any help.
12 REPLIES 12
Steven E. Protter
Exalted Contributor

Re: Showing free space in volume group

Shalom,

vgdisplay

This shows free space in PE's not MB or anything.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Torsten.
Acclaimed Contributor

Re: Showing free space in volume group

vgdisplay will show you the free PEs (not allocated to LVOLs).

If you want to know about free space in your certain file systems you should start with bdf or something similar.

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!   

Re: Showing free space in volume group

Thanks for your replies but it's not really what I meant.
When I make a vg of 100GB with an fs of 20GB, my free space in that vg is 70GB. But until I start with wrting to the fs, the free space is still 100GB in the vg.
So: vgdisplay doesn't help and BDF shows no totals for volume groups.
Torsten.
Acclaimed Contributor

Re: Showing free space in volume group

So you are asking for free space in the file systems in a volume group? I don't see a real use of this.

Example: You have a vg01 with let's say 1000 lvols, each file system has 1MB free - so your result would be 1000MB free. IMHO useless.

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!   

Re: Showing free space in volume group

Sorry if I'm being unclear.

Another example.
My vg00 is 70GB. Vgdisplay says I have 10GB free. That wouldn't fit on a 40GB ignite tape. But those 60GB allocated are not really filled with data. Perhaps only 30GB is really used. That would fit a ignite tape.

(Please, don't send replies about ignite :-)
mobidyc
Trusted Contributor
Solution

Re: Showing free space in volume group

Hello,

you'll find it in attachement.

you can add an specific vg in argument

# vgview vg00
/-------------------------------------------------------------------------------\
| vg00 |
|-------------------------------------------------------------------------------|
| TOTAL (Gbytes): 271.6875 |
| (Mbytes): 278208 |
| (Kbytes): 284884992 |
| (PE): 8694 |
| |
| USED (Gbytes): 107.21875 |
| (Mbytes): 109792 |
| (Kbytes): 112427008 |
| (PE): 3431 |
| |
| FREE (Gbytes): 164.46875 |
| (Mbytes): 168416 |
| (Kbytes): 172457984 |
| (PE): 5263 |
|-------------------------------------------------------------------------------|
| - LV Name : /dev/vg00/lvol1 |
| - MountPoint : /stand |
| SIZE (Gb): 1 |
| (Mb): 1024 |
| (Kb): 1048576 |
| Free LE : 32 |
| LE Size (Mb): 32 |
| Free LE (Gb): 1 |
| (Mb): 1024 |
| (Kb): 1048576 |
| |
| - LV Name : /dev/vg00/lvol2 |
| - MountPoint : |
| SIZE (Gb): 11.96875 |
| (Mb): 12256 |
| (Kb): 12550144 |
| Free LE : 383 |
| LE Size (Mb): 32 |
| Free LE (Gb): 11.96875 |
| (Mb): 12256 |
| (Kb): 12550144 |
|{..SNIP..} |
\-------------------------------------------------------------------------------/
pour augmenter un FS:
lvextend -L
fsadm -F vxfs -v -b
pour reduire un FS - pour le faire a chaud, necessite une license JFS
fsadm -F vxfs -v -b
lvreduce -L
Best regards, Cedrick Gaillard
mobidyc
Trusted Contributor

Re: Showing free space in volume group

Note:
the script i posted above does not take care of mirrors.
If you have it, divide the result.

Regards,
Cedrick Gaillard
Best regards, Cedrick Gaillard
Mel Burslan
Honored Contributor

Re: Showing free space in volume group

then you are looking for something like this:

read vg #interactively input vg name here
free=0
bdf | grep "${vg}" | while read line;do
f=`echo $line | awk {'print $4'}`
(( free=$free+$f ))
done
echo "You have " $free " kilobytes in this vg"

to find the space used, replace $4 with $3 on the third line, between the awk brackets.

hope this helps
________________________________
UNIX because I majored in cryptology...
Bill Hassell
Honored Contributor

Re: Showing free space in volume group

> My vg00 is 70GB. Vgdisplay says I have 10GB free. That wouldn't fit on a 40GB ignite tape. But those 60GB allocated are not really filled with data. Perhaps only 30GB is really used. That would fit a ignite tape.

vgdisplay will not report anything about filesystems. When you use Ignite, you are backing up filesystems, not volume group space, so vgdisplay is meaningless for Ignite tape space. bdf will tell you what space is actually used (and therefore backed up with Ignite). Since bdf is in Kbytes and there isn't an option to sum total the filesystem information, I wrote a wrapper script called bdfmegs. To see all the space actually used in vg00, run this script like this:

$ bdfmegs -s -c 3 -V vg00
File-System Mbytes Used Avail %Used Mounted on
/dev/vg00/lvol4 4096 12 3832 1% /tmp
/dev/vg00/lvol1 291 52 210 20% /stand
/dev/vg00/lvol3 2504 543 1960 22% /
/dev/vg00/lvol5 5000 3013 1862 62% /home
/dev/vg00/lvol8 8192 3191 4983 40% /var
/dev/vg00/sybe2 4000 3341 617 85% /sybe2
/dev/vg00/lvol7 9600 4050 5507 43% /usr
/dev/vg00/lvol6 8800 6305 2475 72% /opt
-- sum totals - 41.5g 20.0g 20.9g --- sum totals ---

-s is the option to produce a sum total
-c 3 sorts column 3 (Used)
-V vg00 selects only vg00 volumes

Here is the usage information (bdfmegs -h):

Usage: bdfmegs [ -cghlNPpqstuVv ] [ ]
where:
-c # = Sort on column #
-g = show gigabytes, otherwise megabytes
-h = Usage (return code=0, Usage to stdout)
-l = local (no NFS)
-N = skip one or more volume groups
Repeat -N or use commas: -N vg10,vg24
-p ## = highlight % -ge ##
-P ## = show only % -ge ##
-q = suppress header line and no char enhancements
-s = summarize total, used and available
-t = specifc filesystem: (hfs vxfs nfs cdfs cifs autofs DevFS)
-u = usage (return code=0, Usage to stdout)
-v = verbose (type, version, largefiles)
(version info read permission for mountpoint)
-V = select one or more volume groups
Repeat -V or use commas: -V vg00,vg01

File(s) or dirpath(s) may be specified to reduce the output of bdfmegs:

bdfmegs -vg /usr/contrib/bin /var/tmp

If bdfmegs is run as bdfgigs (ie, a link), then -g is default.
(bdfmegs ver 5.1_Apr2009)


Bill Hassell, sysadmin