1834969 Members
1962 Online
110072 Solutions
New Discussion

Re: Calculate Diskspace

 
SOLVED
Go to solution
Mobeen_1
Esteemed Contributor

Calculate Diskspace

All,
I would need to calculate the total disk space available on a cluster and also the free/used space.

Is there a smart way of doing this? Instead of writing a DCL. I would appreciate if you could share your thoughts. The method that i can think of is

1. Do a $sh dev dsa
2. Output the command above to a file and
make calculations.

I was wondering if there is any other way.

Thanks
Mobeen
16 REPLIES 16
Uwe Zessin
Honored Contributor

Re: Calculate Diskspace

Well, that works if you only have shadow sets. I'm sure it is also possible to hack something togther using the F$DEVICE() lexical function. I haven't looked into any details, but it seems similar to the SYS$DEVICE_SCAN system service and that one is amazing.
.
Antoniov.
Honored Contributor

Re: Calculate Diskspace

Hi Mobeen,
I think is more simple:
$ TOT=F$GETDVI("DSA","MAXBLOCK")
$ FRE=F$GETDVI("DSA","FREEBLOCKS")
then you can make any evaluation you need.

Antonio Vigliotti
Antonio Maria Vigliotti
Jan van den Ende
Honored Contributor

Re: Calculate Diskspace

Mobeen,


instead of writing DCL


well, if you don't object to USING DCL, have a look at
http://dcl.openvms.org/stories.php?story=04/05/27/8944070

hth

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Volker Halle
Honored Contributor

Re: Calculate Diskspace

Mobeen,

still DCL, but using lexical functions:

$ tot_f = 0
$ tot_m = 0
$loop:
$ dev = F$DEVICE("*","DISK")
$ IF dev .EQS. "" THEN $ goto exit
$ IF .NOT. F$GETDVI(dev,"MNT") THEN $ GOTO loop
$ IF F$GETDVI(dev,"SHDW_MEMBER") THEN $ GOTO loop
$ f = F$GETDVI(dev,"FREEBLOCKS")
$ m = F$GETDVI(dev,"MAXBLOCK")
$ WRITE SYS$OUTPUT "''dev' free=''f' max=''m'"
$ tot_f = tot_f + f
$ tot_m = tot_m + m
$ GOTO loop
$!
$exit:
$ SHOW SYMB tot_f
$ SHOW SYMB tot_m

Volker.
Mobeen_1
Esteemed Contributor

Re: Calculate Diskspace

All,
Thanks for all your thoughts. I would now like to add an additional criteria into this calculation -

I would like to divide the disks into 2 categories and find out the total storage on category1 disks and the same with category 2 disks

That is i need to do the following

1. Find out the total disk space cluster
wide

2. Find out the total free space cluster
wide

3. Find out the total used space for
category 1 disks

4. Find out the total used space for
category 2 disks

Category 1 and Category 2 disks are all DSAs and they are fixed. Does this mean that the only way for me is to create 2 files CATEGORY1.TXT and CATEGORY2.TXT and read them from these and calculate using DCL or is there any other way.

I appreciate all your help....

Its really amazing to see the response and the way different people think....

Thanks
Mobeen
Volker Halle
Honored Contributor

Re: Calculate Diskspace

Mobeen,

instead of using files to store the disk names for CATEGORY1 and CATEGORY2 disks, why not use symbols. Then use F$LOCATE(dev,category1) to find out, if a device falls into one category or another.

$ category1="_DSA1:/_DSA2:/..."
$ IF F$LOCATE(dev,category1) .ne. F$LENGTH(category1)
$ THEN
$ ! device belongs into category1
$ ENDIF

Volker.
Antoniov.
Honored Contributor
Solution

Re: Calculate Diskspace

Hi Mobeen,
the Volker's example is like you want. I can't understand which disks are in cat.1 and which in cat.2
$ tot_f = 0
$ tot_m = 0
$ t1_f = 0
$ t1_m = 0
$ t2_f = 0
$ t2_m = 0
$loop:
$ dev = F$DEVICE("*","DISK")
$ IF dev .EQS. "" THEN $ goto exit
$ IF .NOT. F$GETDVI(dev,"MNT") THEN $ GOTO loop
$ IF F$GETDVI(dev,"SHDW_MEMBER") THEN $ GOTO loop
$ f = F$GETDVI(dev,"FREEBLOCKS")
$ m = F$GETDVI(dev,"MAXBLOCK")
$ WRITE SYS$OUTPUT "''dev' free=''f' max=''m'"
$ tot_f = tot_f + f
$ tot_m = tot_m + m
$ if (......)
$ then
$ t1_f = t1_f + f
$ t1_m = t1_m + m
$ else
$ t2_f = t2_f + f
$ t2_m = t2_m + m
$ endif
$ GOTO loop
$!
$exit:
$ t1_used=t1_m - t1_f
$ t2_used=t2_m - t1_f
$ open/write tgt categoy1.txt
$ write tgt "Total space = ''tot_m'"
$ write tgt "Global free space = ''tot_f'"
$ write tgt "Cat.1 used = ''t1_used'"
$ close tgt
$ open/write tgt categoy2.txt
$ write tgt "Total space = ''tot_m'"
$ write tgt "Global free space = ''tot_f'"
$ write tgt "Cat.2 used = ''t2_used'"
$ close tgt

Antonio Vigliotti
Antonio Maria Vigliotti
Mobeen_1
Esteemed Contributor

Re: Calculate Diskspace

Thanks again

Lets say my definition of Category 1 and Category 2 is as follows

Category 1 - All DSAs with a label like
DATA%
Category 2 - All DSA with a label like
MFG%

Yes, i did think about using Symbols as against the files, its probably easier to do this with symbols

regards
Mobeen
Antoniov.
Honored Contributor

Re: Calculate Diskspace

$ tot_f = 0
$ tot_m = 0
$ t1_f = 0
$ t1_m = 0
$ t2_f = 0
$ t2_m = 0
$loop:
$ dev = F$DEVICE("*","DISK")
$ IF dev .EQS. "" THEN $ goto exit
$ IF .NOT. F$GETDVI(dev,"MNT") THEN $ GOTO loop
$ IF F$GETDVI(dev,"SHDW_MEMBER") THEN $ GOTO loop
$ f = F$GETDVI(dev,"FREEBLOCKS")
$ m = F$GETDVI(dev,"MAXBLOCK")
$ WRITE SYS$OUTPUT "''dev' free=''f' max=''m'"
$ tot_f = tot_f + f
$ tot_m = tot_m + m
$ vlbl = F$GETDVI(dev,"VOLNAM")
$ if f$extr(0,4,vlbl).eqs."DATA"
$ then
$ t1_f = t1_f + f
$ t1_m = t1_m + m
$ endif
$ if f$extr(0,3,vlbl).eqs."MFG"
$ then
$ t2_f = t2_f + f
$ t2_m = t2_m + m
$ endif
$ GOTO loop
$!
$exit:
$ t1_used=t1_m - t1_f
$ t2_used=t2_m - t1_f
$ open/write tgt categoy1.txt
$ write tgt "Total space = ''tot_m'"
$ write tgt "Global free space = ''tot_f'"
$ write tgt "Cat.1 used = ''t1_used'"
$ close tgt
$ open/write tgt categoy2.txt
$ write tgt "Total space = ''tot_m'"
$ write tgt "Global free space = ''tot_f'"
$ write tgt "Cat.2 used = ''t2_used'"
$ close tgt

Antonio Vigliotti
Antonio Maria Vigliotti
Mobeen_1
Esteemed Contributor

Re: Calculate Diskspace

A big thanks to all of you who have responded. I think i now have different alternatives to work on this. I appreciate all your help.

I shall work on this tomorrow and will let you know how it went and also post the DCL back here, so that some one who needs the same can use it

Thanks again

Mobeen
Jan van den Ende
Honored Contributor

Re: Calculate Diskspace

Mobeen,

we have a version of SPACE.COM that splits the totals in two groups.
In our case, before we were able to shadow multisite system disks, we had a VAX and an Alpha SYTEM disk at each site, and a locally-attached dump-file-disk at each system.
We wanted them out of the "available" statistics for obvious reasons.
That version of SPACE.COM has two sets of disks; those that are included in the logical name "SYSTEM_DISKS" (comma-separated list), and those that are not.
Of course it can easily adapted for ANY subsetting of the disk-farm.

When I get to work tomorrow I'l post it (now at home).
Jan
Don't rust yours pelled jacker to fine doll missed aches.
Uwe Zessin
Honored Contributor

Re: Calculate Diskspace

I don't know what you cluster looks like, but I want to remind that there can be situations where a disk is not mounted on the system where you run this procedure.
.
Robert Atkinson
Respected Contributor

Re: Calculate Diskspace

Mobeen - the is a Freeware package called 'Free' that does this :-

http://vms.process.com/scripts/fileserv/fileserv.com?FREE

The output looks like this (better formatted on a terminal!):-

ALPHA_ROB$$ freespace
Device Name Volume Label Type Used Blocks Free Blocks Total
---------------- -------------- ------ --------------- --------------- ---------
$1$DGA1: AXPVMSSYS DGX00 15918729 (45%) 19637660 (55%) 35556389
$1$DGA2: SY0 DGX00 16800719 (48%) 18755170 (52%) 35555889
$1$DGA3: SY1 DGX00 17227509 (49%) 18328380 (51%) 35555889
$1$DGA4: SY2 DGX00 19814579 (56%) 15741810 (44%) 35556389
$1$DGA5: SY3 DGX00 19321639 (55%) 16234750 (45%) 35556389
$1$DGA6: SY4 DGX00 18963589 (54%) 16592800 (46%) 35556389
$1$DGA7: SY6 DGX00 17052309 (48%) 18504080 (52%) 35556389
$1$DGA8: SY7 DGX00 16574209 (47%) 18982180 (53%) 35556389
$1$DGA9: SY8 DGX00 19412779 (55%) 16143610 (45%) 35556389
$1$DGA10: SY9 DGX00 22468034 (64%) 13088355 (36%) 35556389
$1$DGA11: RESTORE DGX00 10092314 (29%) 25464075 (71%) 35556389
$1$DGA20: SY5 DGX00 15465199 (44%) 20091190 (56%) 35556389
$1$DGA100: AXPSYS072 DGX00 24521694 (69%) 11034695 (31%) 35556389
$1$DGA101: ROGER DGX00 34162059 (97%) 1394330 ( 3%) 35556389
$1$DGA102: RUSEL DGX00 35411699 (**%) 144690 ( 0%) 35556389
$1$DGA103: GARY DGX00 35159524 (99%) 396865 ( 1%) 35556389
$1$DGA104: CHRISH DGX00 33729844 (95%) 1826545 ( 5%) 35556389
$1$DGA105: DAN DGX00 31409379 (89%) 4147010 (11%) 35556389
$1$DGA106: MIKE DGX00 32601304 (92%) 2955085 ( 8%) 35556389
$1$DGA107: EDDIE DGX00 33001424 (93%) 2554965 ( 7%) 35556389
$1$DGA108: SUPPORT DGX00 33873589 (96%) 1682800 ( 4%) 35556389
$1$DGA109: CONTRACT1 DGX00 34194749 (97%) 1361640 ( 3%) 35556389
$1$DGA110: CHRISF DGX00 34774699 (98%) 781690 ( 2%) 35556389
$1$DGA111: PUBDEV DGX00 34450109 (97%) 1106280 ( 3%) 35556389
$1$DGA112: CONTRACT2 DGX00 26652284 (75%) 8904105 (25%) 35556389
$1$DGA113: JAMIE DGX00 32771439 (93%) 2784950 ( 7%) 35556389
$1$DGA114: OPS DGX00 32747849 (93%) 2808540 ( 7%) 35556389
$1$DGA115: ROBERT DGX00 20237134 (57%) 15319255 (43%) 35556389
$1$DKA0: ARCHIVE1 DKX00 10636290 (60%) 7137234 (40%) 17773524

Totals: 29 mounted disks 373459MB (72%) 145346MB (28%) 518805MB

Rob.
Jan van den Ende
Honored Contributor

Re: Calculate Diskspace

Mobeen,

as promised

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Jan van den Ende
Honored Contributor

Re: Calculate Diskspace

Sorry, I hit SUBMIT too quick.

What this routine needs, is a (proferable clusterwide) logical name with a list of disk labels.
Example: define /table=.. DATA_DISKS ".DATA1,DATA2,EXTRADATA,"
Please note the comma's at begin and end.
Without them, DATA1 would also include DATA10, DATA11 etc!
Of course, you have to change the F$TRNLNM in the procedure from SYSTEMDISKS to use your own logical name.

Success!

Don't rust yours pelled jacker to fine doll missed aches.
Lawrence Czlapinski
Trusted Contributor

Re: Calculate Diskspace

1. You could also define the lists of disks with logicals in a .COM:
$ def/sys backup_device_1 -
condev_axp:,-
dev_disk_1:,dev_disk_2:
$ def/sys backup_device_2 -
condev_vms:,-
condev_utl:,-
dev_disk_3:
2. We write the disk info to a file.
3. For clusters that have disks that tend to fill up, we emailed the disk usage file to the key application person(s) for that cluster. That way they are aware of how much free disk space they have left on their cluster.
Lawrence