Operating System - OpenVMS
1829586 Members
1998 Online
109992 Solutions
New Discussion

Re: Total Number of Files and Blocks inside savesets

 
SOLVED
Go to solution
Kenneth Toler
Frequent Advisor

Total Number of Files and Blocks inside savesets

I need to calculate the total number of files and total number of blocks in a savset. How do I do this?
10 REPLIES 10
Richard Whalen
Honored Contributor

Re: Total Number of Files and Blocks inside savesets

Savesets are designed to be read serially (think of tapes) and hence need to be read entirely to find out this information.

$ pipe saveset/sav/list | search sys$input Total,of,files,blocks/match=and
Hoff
Honored Contributor

Re: Total Number of Files and Blocks inside savesets

If you're trying to size the remaining space on sequential (tape) media, that's a comparatively tough nut to crack due to various factors including the particular drive-level compression efficiency with your file data.

There's a section in the OpenVMS FAQ on sizing the remaining space on a tape. Short version of that section: "tough nut to crack."

What gets written to the tape is usually smaller than the total number of blocks written, but there are degenerate cases where the output might be larger. Most compression tools are smart enough to shut off data compression if it isn't providing benefit, but...



Kenneth Toler
Frequent Advisor

Re: Total Number of Files and Blocks inside savesets

I am not concerned about tapes. My savesets are on a serial hard drive. I have eight savesets on a seperate source HD that I need to check to know if my initialized target disk can hold the data before expansion begins. How do I perform this task with multiple savesets?
Ian Miller.
Honored Contributor

Re: Total Number of Files and Blocks inside savesets

If you list the saveset then is the information you want at the end if the listing?
____________________
Purely Personal Opinion
Kenneth Toler
Frequent Advisor

Re: Total Number of Files and Blocks inside savesets

Yes, it is. But how would I extract this information and pass it to a .C file?
Jon Pinkley
Honored Contributor

Re: Total Number of Files and Blocks inside savesets

Richard Whalen has the right idea, but had a typo in his response (left out backup).

Assuming you can come up with a wildcard selection for your savesets, then you can use the following (this assumes *.BCK on current default device/diretory)

$ pipe backup *.bck/save/list | search sys$input /nowin "Total of","Save set:"

Add all the files up, add all the blocks up.

Add #of files to blocks (this is for the file headers that may need to be created), but if the indexf.sys file is already extended, then the heaaders will only used space that has already been allocated. Also, you need to allow for the unused space due to cluster sizes that are greater than one. With random file size distribution, you will "waste" number_of_files*(clustersize-1)/2 blocks.

So if your cluster size is 16, and you are restoring 15000 files with a random distribution of size mod(clustersize), you would expect to waste 15000*15/2 or around 112500 blocks. If files are all 1 block in size, you will waste 15/16 of every cluster. You can eliminate this waste by initializing with a clustersize of 1, but that probably isn't what you want to do unless your files have a small average size.

Also I will recommend that you use /truncate when you restore, if the clustersize of the original disk was different than the target disk. Otherwise the files will grow to the next cluster boundry. For example: original disk clustersize 9, a one block file will allocate 9 blocks, restoring to disk with cluster size 8 without specifying /truncate the 1 block file will now use 16 blocks. If /truncate is used, the new file's allocation is based on the "used" blocks, not the "allocated" blocks, and it will use only 8 blocks.
Richard Whalen has the right idea, but had a typo in his response (left out backup).

Assuming you can come up with a wildcard selection for your savesets, then you can use the following (this assumes *.BCK on current default device/diretory)

$ pipe backup *.bck/save/list | search sys$input /nowin "Total of","Save set:"

Add all the files up, add all the blocks up.

Add #of files to blocks (this is for the file headers that may need to be created), but if the indexf.sys file is already extended, then the heaaders will only used space that has already been allocated. Also, you need to allow for the unused space due to cluster sizes that are greater than one. With random file size distribution, you will "waste" number_of_files*(clustersize-1)/2 blocks.

So if your cluster size is 16, and you are restoring 15000 files with a random distribution of size mod(clustersize), you would expect to waste 15000*15/2 or around 112500 blocks. If files are all 1 block in size, you will waste 15/16 of every cluster. You can eliminate this waste by initializing with a clustersize of 1, but that probably isn't what you want to do unless your files have a small average size.

Also I will recommend that you use /truncate when you restore, if the clustersize of the original disk was different than the target disk. Otherwise the files will grow to the next cluster boundry. For example: original disk clustersize 9, a one block file will allocate 9 blocks, restoring to disk with cluster size 8 without specifying /truncate the 1 block file will now use 16 blocks. If /truncate is used, the new file's allocation is based on the "used" blocks, not the "allocated" blocks, and it will use only 8 blocks.
it depends
Jon Pinkley
Honored Contributor
Solution

Re: Total Number of Files and Blocks inside savesets

To pass to C program just specify an output file, and open that with your program.

$ pipe backup *.bck/save/list | search sys$input /nowin "Total of","Save set:"/out=tempfile.lis
it depends
Jon Pinkley
Honored Contributor

Re: Total Number of Files and Blocks inside savesets

Sorry, somehow I pasted the same thing twice into my response dated Apr 25, 2007 20:28:03 GMT.
it depends
Richard Whalen
Honored Contributor

Re: Total Number of Files and Blocks inside savesets

As Jon Pinkley pointed out I left out a key word in my example in my rush to be the first to respond (and hopefully get points).
Jan van den Ende
Honored Contributor

Re: Total Number of Files and Blocks inside savesets

Kenneth,

from your Forum Profile:


I have assigned points to 55 of 93 responses to my questions.


Maybe you can find some time to do some assigning?

http://forums1.itrc.hp.com/service/forums/helptips.do?#33

Mind, I do NOT say you necessarily need to give lots of points. It is fully up to _YOU_ to decide how many. If you consider an answer is not deserving any points, you can also assign 0 ( = zero ) points, and then that answer will no longer be counted as unassigned.
Consider, that every poster took at least the trouble of posting for you!

To easily find your streams with unassigned points, click your own name somewhere.
This will bring up your profile.
Near the bottom of that page, under the caption "My Question(s)" you will find "questions or topics with unassigned points " Clicking that will give all, and only, your questions that still have unassigned postings.
If you have closed some of those streams, you must "Reopen" them to "Submit points". (After which you can "Close" again)

Do not forget to explicitly activate "Submit points", or your effort gets lost again!!

Thanks on behalf of your Forum colleagues.

PS. - nothing personal in this. I try to post it to everyone with this kind of assignment ratio in this forum. If you have received a posting like this before - please do not take offence - none is intended!

PPS. - Zero points for this.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.