Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting only SAVESET Header Info

 
SOLVED
Go to solution
Jack Trachtman
Super Advisor

Getting only SAVESET Header Info

I want to confirm what's on a backup tape, but I don't need the list of files in each saveset, only the saveset name and the Backup summary info displayed at the beginning of a "BACKUP/LIST saveset" cmd. Is there any way to display only this "header" info?

So far, I've tried various backup list cmds but can't find a combination that does not include the file names.

I've looked at parsing the output from a DUMP saveset/BLOCK=END:1, but I'm not certain of the format/offsets of each field.

Any suggestions?

TIA
22 REPLIES 22
Hoff
Honored Contributor
Solution

Re: Getting only SAVESET Header Info

AFAIK, no.

You can pipe the BACKUP output through SEARCH.

Or build a database that manages and keys off the tape label, or that maintains the contents from the BACKUP journal.

Or tweak the code here:

http://labs.hoffmanlabs.com/node/817
Shriniketan Bhagwat
Trusted Contributor

Re: Getting only SAVESET Header Info

Hi,

First block of the BACKUP saveset contains the summary record. Summary record basically contains the summary information of the saveset, i.e. saveset name, BACKUP command, OS version, user name, account from which the BACKUP was written, block size used etcâ ¦.

>> Is there any way to display only this "header" info?
Saveset is like any other file in the disk/tape. To display the header information you need to use the DUMP command as shown below.

$ dump/header/block=count=0
Hope this helps.

Regards,
Ketan
Jack Trachtman
Super Advisor

Re: Getting only SAVESET Header Info

I'm willing to write some DCL to parse the output of a DUMP cmd, but can anyone point me to any information on the record layout of the Backup "header" info? Thanks.
John A. Beard
Regular Advisor

Re: Getting only SAVESET Header Info

quick and nasty...

$ BACK/LIST=filename saveset.bck/save
$ search/wind=(8,9) filename "Command:"
Glacann fear críonna comhairle.
Hoff
Honored Contributor

Re: Getting only SAVESET Header Info

I do not know what Ketan is referring to here as I don't think the requested metadata is resident in the tape HDR records, and what is referenced in that posting is the ODS header data and not the BACKUP saveset header information.

What I've posted is a link to vmsbackup; some (portable) C code which reads BACKUP savesets on Mac OS X and other Unix boxes, on Linux and on Solaris. Within that C code, you'll find everything that you will need to do here to fetch (just) the BACKUP headers as that code can parse and can display the saveset headers. And see the undocumented BACKUP /ANALYZE qualifier.

If you want to go after the headers yourself, directly, and with DCL (shudder), then you'll be looking at the BCKDEF stuff IIRC.

You could probably SPAWN the BACKUP command and then (after some number of I/O calls or a couple of minutes time) delete the process and rewind the tape. This being a massive hack for a timeout; a way to get just the first part of the tape without having to read the whole thing. And this won't work if there's more than one saveset on the tape. Or punt, and just process the first dozen or so lines of BACKUP /FULL/LIST=file for the tape. I haven't tried this, but BACKUP /FULL /LIST=mbx might work, in conjunction with CREATE /MAILBOX and friends.

Or tweak the provided C code.
Volker Halle
Honored Contributor

Re: Getting only SAVESET Header Info

Jack,

BACKUP/LIST/ANALYZE together with DUMP/BLOCK=COUNT=1 of the saveset should give you enough information about the layout of the 'BACKUP SUMMARY' record.

Volker.
Volker Halle
Honored Contributor

Re: Getting only SAVESET Header Info

Jack,

also see SYS$EXAMPLES:BACKDEF.*

for structure definitions in your preferred programming language...

Volker.
P Muralidhar Kini
Honored Contributor

Re: Getting only SAVESET Header Info

Hi Jack,

>> So far, I've tried various backup list cmds but can't find a combination
>> that does not include the file names.
The BACKUP/LIST command will display the summary information followed
by the listing of the files present within the saveset.
I dont think there is any existing qualifier which would give only the summary
information and not the listing of files within the saveset.

Is the concern that the savesets on tape contain lot of files in it and hence
taking more time to complete the BACKUP/LIST operation?

Regards,
Murali
Let There Be Rock - AC/DC
Jon Pinkley
Honored Contributor

Re: Getting only SAVESET Header Info

Jack,

As others have said, backup itself doesn't (currently at least) provide a way to list only the non-file records. Perhaps you should make a formal request, it should be a relatively easy modification.

As far as parsing the output of the beginning block of the save set, I will only say that the backup header can span more than a single block, especially in the case of image backups. All backup save sets have a SUMMARY record, which has the basic info at the beginning of the listing. In an image backup there is additional volume information saved in the header (record type = VOLUME) and possibly many FID records.

For more detail about what is in the backup save set, use the undocumented, unsupported /ANALYZE switch with /LIST. This will give you a formatted dump of what is in the save set.

The disadvantage of listing is that it can take a long time for large save sets. For examples, an LTO3 filled with many small files can generate a listing file > 1 GB and take more than an hour to generate.

The advantage of listing the save set is that it will provide the totals for files and blocks contained in the save set, computed while backup lists the save set contents. This is similar to what directory/total/size=used gives. It also verifies the readability and consistency of the backup save set. In other words, if you do a complete listing, you will know that the save set is readable, and how much data is in the save set.

One possible way to exclude the file names from a listing of a backup save set is with VMS 8.3+ search /wild

$ search/nowin/wild saveset_listing "[*]*;"," %%%%%%%%%% %%-%%%-%%%% %%:%%"/mat=nor

This excludes strings that are found in the "file" listing lines. The first "[*]*;" excludes the lines that appear to be file specifications, the second is to exclude the date stamps that may have been wrapped to a separate line. The above works only for /brief listings. A perl or awk script could be made more general, but that is left as an exercise for the user.

Letting backup do the work, and filtering the output is the easy way. It works with pipe too.

$ pipe backup/list login.sav; /save | search/nowin/wild/match=nor sys$pipe "[*]*;"," %%%%%%%%%% %%-%%%-%%%% %%:%%"
Listing of save set(s)

Save set: LOGIN.SAV
Written by: JON
UIC: [000002,000016]
Date: 8-APR-2007 02:00:05.15
Command: BACKUP SYS$LOGIN:LOGIN.COM;* LOGIN.SAV/SAV
Operating system: OpenVMS Alpha version V7.2
BACKUP version: AXP72R001
CPU ID register: 80000000
Node name: _SIGMA::
Written on: _$4$DKA200:
Block size: 32256
Group size: 10
Buffer count: 1239


Total of 160 files, 2321 blocks
End of save set

$

If you don't want to wait for the complete listing, then Hoff's source would be the place to start.

Jon
it depends
Shriniketan Bhagwat
Trusted Contributor

Re: Getting only SAVESET Header Info

Hi,

Here are the some information about the saveset format. May be help full for you to parse.

Saveset consists of fixed length blocks. Each block in a save-set is of fixed length and the length is selectable by the user by specifying /BLOCK_SIZE qualifier or the default for tape is 8192 bytes for disk savesets is 32256.

Each block in a saveset begins with a 256-byte structure called the block header. The block header contains necessary information about the block. You can get the information about the all the fields in the block header by using the /ANALYZE qualifier. This is a undocumented feature.

Format is BACKUP/LIST/ANALYZE /SAVE

Following the block header, every save-set block contains one or more unique records. Each record begins with a 16-byte record header that describes the record and specifies its length. First record in the first block of the saveset is the summary record.

BACKUP SUMMARY RECORD Contains information about the save-set. This record includes the command for creating the save-set, the owner, date and version numbers for VMS and Backup, the system, and other pertinent information. The Backup Summary Record is the first record in a save-set and the first record in the first block of each volume of a multivolume save-set. This allows each volume of the save-set to be read and interpreted independently. The information in the command line is stored as an ASCII string and as separate data items.

Regards,
Ketan
Shriniketan Bhagwat
Trusted Contributor

Re: Getting only SAVESET Header Info

Hi,

Attached is the sample out put of using /ANALYZE qualifier on the small saveset.

As I explained earlier,

below is the block header of the first block in the saveset.

Block header
SIZE = 256
OPSYS = 4096
SUBSYS = 1
APPLIC = 1
NUMBER = 1
STRUCLEV = 0101
VOLNUM = 1
CRC = CCF5EFB1
BLOCKSIZE = 32256
NOCRC = False
SSNAME = "COM.BCK"
FID = 0,0,0
DID = 0,0,0
FILENAME = ""
ATTRIB = 0000000000000000
FILESIZE = 0

Record header for summary record.

Record header
RSIZE = 176 = %X'00B0'
RTYPE = SUMMARY (1)
FLAGS = %X'00000000'
ADDRESS = 0
BLOCKFLAGS = %X'0000'

And the summary record.

STRUCLEV = 0101
SIZE = 7, TYPE = SSNAME
"COM.BCK"
SIZE = 36, TYPE = COMMAND
"BACKUP/LOG COMPRO.COM;4 COM.BCK/SAVE"
SIZE = 12, TYPE = USERNAME
"GUEST "
SIZE = 4, TYPE = USERUIC
[200,201]
SIZE = 8, TYPE = DATE
18-MAY-2010 17:58:15.81
SIZE = 2, TYPE = OPSYS
1000
SIZE = 4, TYPE = SYSVER
"V8.4"
SIZE = 8, TYPE = NODENAME
"_PATNA::"
SIZE = 4, TYPE = SIR
80000000
SIZE = 14, TYPE = DRIVEID
"_PATNA$DKA100:"
SIZE = 4, TYPE = BACKVER
"V8.4"
SIZE = 4, TYPE = BLOCKSIZE
32256
SIZE = 2, TYPE = XORSIZE
10
SIZE = 2, TYPE = BUFFERS
467


Regards,
Ketan
Bob Blunt
Respected Contributor

Re: Getting only SAVESET Header Info

How about this... Possibly not enough information for what you need, Jack, but it limits the overload of /LIST.

BACKUP/LOG/LIST=NL: DEVICE:SAVE/SAVE

That's how I remember what savesets are on which tapes. No, I admit, it doesn't give nice info about the blocking factor and other gory details from the first header records.

I haven't toyed with SSM in a while, maybe that's got some way to peek without regurgitating tons of filenames etc. I'll have to see if I can find the latest release and (if it isn't already) install it and play. It is a neat tool I've used in the past for many media conversion projects.

bob
Shriniketan Bhagwat
Trusted Contributor

Re: Getting only SAVESET Header Info

Sorry for missing the attachment.

Regards,
Ketan

P Muralidhar Kini
Honored Contributor

Re: Getting only SAVESET Header Info

SSM (SaveSet Manager) is generally used to COPY/MERGE the saveset's
created by BACKUP. Apart from this, it can also validate the saveset
i.e. checking the internal consistency of the saveset.
But i dont think it provides any feature wherein you can get only the summary
information displayed by BACKUP/LIST.

Regards,
Murali
Let There Be Rock - AC/DC
Hein van den Heuvel
Honored Contributor

Re: Getting only SAVESET Header Info

[ and we're back ! (after the 5/19 - now downtime]

Hmmm,

When you MOUNT/OVER=ID a backup tape as an ANSI tape, then you can START a COPY of the saveset with for example: $ COPY/LOG mt:*.* []

Now just interupt the copy and use BACK/LIST on the initial fragment of the saveset.
I tested that by using an LM device
( http://www.digiater.nl/lddriver.html ).
That is of course to quick to abort the copy, so I used a SET FILE/ATTR=EBK=100 to fake an abort.
BACKUP listed the header, and some files then complained...

%BACKUP-E-READERR, error reading DKA:[TEMP]EXAMPLE.;1
-BACKUP-E-SHORTBLOCK, save-set block too short
%BACKUP-E-SSCHANGE, unexpected end of save set on DKA:[TEMP]EXAMPLE.;1
%BACKUP-I-OPERSPEC
%BACKUP-I-OPERASSIST, operator assistance has been requested

Still, the main goal was accomplished.

If would be 'nicer' if you had a tool to copy the first few blocks from the tape.

Since you probably do not have that, you can use DUMP to read some blocks (skipping over headers). I hacked up a DCL script to parse dump output to create a file from the dump.
Of course you should set the right file attributes, but BACK/REPAIR gets you over that hump.

Example run and DCL script below.

Hein

---------------------------------

$ moun/for lma1:
%MOUNT-I-MOUNTED, EXAMPL mounted on _BUNDY$LMA1:
$ set mag lma1/rewi
$ dump/block=(start=4,count=1) lma1: /out=example.dmp
$ @DUMP_TO_FILE.COM example.dmp example.tmp
%FDL-I-CREATED, DKA:[TEMP]EXAMPLE.TMP;1 created
%RMS-E-EOF, end of file detected
$ back/list/repai example.tmp/save
Listing of save set(s)

%BACKUP-I-REPAIRED, saveset attributes changed to RFM=FIX, MRS=8192
Save set: EXAMPLE.
Written by: SYSTEM
UIC: [000001,000004]
Date: 20-MAY-2010 00:10:55.88
Command: BACK/REWI/INIT/IGNO=LABEL SYS$EXAMPLES: LMA1:EXAMPLE
Operating system: hp OpenVMS I64 version V8.3
BACKUP version: V8.3-1H1
CPU ID register: 80000000
Node name: _BUNDY::
Written on: _BUNDY$LMA1:
Block size: 8192
Group size: 10
Buffer count: 1745

[SYSHLP.EXAMPLES]FMS.DIR;1 1 15-MAR-2009 17:26

Total of 1 file, 1 block
End of save set

----------------------------------

$ type DUMP_TO_FILE.COM
$ IF p1.EQS."" THEN EXIT 16
$ IF p2.EQS."" THEN p2 = "tmp.tmp"
$ CLOSE/NOLOG dump
$ CLOSE/NOLOG output
$ OPEN/ERROR=open_error dump 'p1
$ ! 2064656E 77617053 20212020 6B6F6F62 65746F6E 5F657461 64707520 21240048 H.$! update_notebook ! Spawned 000000
$ CREATE / FDL = "record; format fixed; size 512" /LOG 'p2
$ OPEN/APPEND/ERROR=open_error output 'p2
$ space = " "
$ out = F$FAO("!512AS", space)
$ bytes = 0
$
$record_loop:
$ READ/END=done dump record
$ longs = 8
$ IF 8.NE.F$LEN(F$ELEM(longs,space,record)) THEN GOTO record_loop
$
$longs_loop:
$ out[bytes*8,32] = %x'F$ELE(longs,space,record)
$ bytes = bytes + 4
$ longs = longs - 1
$ IF longs.GT.0 THEN GOTO longs_loop
$ IF bytes.LT.512 THEN GOTO record_loop
$ WRITE/SYMBOL output out
$ bytes = 0
$ GOTO record_loop
$
$done:
$ IF bytes.EQ.0 THEN GOTO open_error
$ out[bytes*8,32] = 0
$ bytes = bytes + 4
$ IF bytes.LT.512 THEN GOTO done
$ WRITE/SYMBOL output out
$
$open_error:
$ s = '$STATUS .AND. %x0FFFFFF
$ CLOSE/NOLOG dump
$ CLOSE/NOLOG output
$ EXIT 's


Jack Trachtman
Super Advisor

Re: Getting only SAVESET Header Info

As Mr. Kini has guessed, getting a BACKUP/LIST of everything on a tape would take very long, and I only need the internal BACKUP "header" info.

With the information supplied (thanks all), I've created a DCL script used as:

$PIPE BACKUP/BLOCKS=END:1 savesetnames | @myscript

which provides information that matches the first page of a BACKUP/ANALYZE cmd. Most importantly, after DUMP displays the first block, it then exits. I'm hoping to see the same quick exit w/savesets on tape.

This works just fine in testing w/savesets on disk. I've just started testing w/tapes and I've run into a simple problem which my frazled mind can't see through:

1) I mount the tape file structured via $MOUNT/OVER=ID/NOWRITE tapedrive
2) When I enter:

$DUMP/BLOCKS=END:1 tapedrive:*.*

the cmd prompt comes back in 10-15 minutes w/absolutely no output! What am I doing wrong? Do I really have to mount the tape /FOREIGN and code around all the tape/file headers/trailers?

TIA
Jon Pinkley
Honored Contributor

Re: Getting only SAVESET Header Info

Jack,

When I try using a LM device with multiple save sets (with block size=32256, must be under 32768), I can only get any output from dump when I use the /RECORD (instead of /BLOCK) command.

So try

$ DUMP/RECORD=COUNT:1 tapedrive:*.*

instead of

$DUMP/BLOCKS=END:1 tapedrive:*.*

That may not be significantly faster than a backup/list of the tape, since it is still going to traverse the whole tape, and I am not sure it will use any optimizations to skip to the start of the next save set.

Note: That method will only work for tapes that could be copied to disk. Also, there will be no validation of the data on the tape. For example, if what the tape really had on it was the first 5 records of the backup, you will not detect that it was not a complete backup save set.

At least for your initial testing, time the backup/list method compared to the dump method. That is really the only way to know how much longer the backup/list method takes.

Jon
it depends
Hein van den Heuvel
Honored Contributor

Re: Getting only SAVESET Header Info

With the ITRC forum down I had exchanged an Email or two with Jack.
You can do this with foreign mounted tapes, but then you need an understanding of tape formats like volume and file headers.

Hein

----

I can get the blocks by using:

$ mount/for lma1
$ set mag/ski=file=1 lma1
$ dump/bloc=count=1 lma1:
$ set mag/ski=file=3 lma1
$ dump/bloc=count=1 lma1:

LM trace....

23:56:00.447045 00.000001 00000424 0 0 NORMAL PACKACK|CLSEREXCP
23:56:00.447084 00.000001 00000424 0 0 NORMAL SENSEMODE|CLSEREXCP
23:56:00.452626 00.005503 00000000 1 131072 NORMAL READPBLK
23:56:00.455869 00.003235 00000000 257 131072 NORMAL READPBLK
23:56:00.457692 00.001816 00000000 513 131072 NORMAL READPBLK
23:56:00.460006 00.002308 00000000 769 131072 NORMAL READPBLK
23:56:00.460017 00.012896 00000424 0 80 NORMAL READPBLK|CLSEREXCP
23:56:00.460068 00.000003 00000424 0 80 NORMAL READPBLK|CLSEREXCP
23:56:00.460115 00.000002 00000424 0 80 NORMAL READPBLK|CLSEREXCP
23:56:00.460152 00.000000 00000424 0 80 ENDOFFILE READPBLK|CLSEREXCP
23:56:00.460194 00.000000 00000424 0 0 NORMAL PACKACK|CLSEREXCP
23:56:00.460226 00.000000 00000424 0 0 NORMAL REWIND|CLSEREXCP
23:56:00.560046 00.000000 00000424 0 0 NORMAL PACKACK|CLSEREXCP
23:56:00.566067 00.005980 00000000 1 131072 NORMAL READPBLK
23:56:00.569310 00.003236 00000000 257 131072 NORMAL READPBLK
23:56:00.571133 00.001817 00000000 513 131072 NORMAL READPBLK
23:56:00.573447 00.002308 00000000 769 131072 NORMAL READPBLK
23:56:00.573456 00.013370 00000424 0 80 NORMAL READPBLK|CLSEREXCP
23:56:00.573511 00.000003 00000424 0 80 NORMAL READPBLK|CLSEREXCP
23:56:00.573557 00.000002 00000424 0 80 NORMAL READPBLK|CLSEREXCP
23:56:00.573595 00.000001 00000424 0 0 NORMAL SETMODE|CLSEREXCP

----
Shriniketan Bhagwat
Trusted Contributor

Re: Getting only SAVESET Header Info

Jack,

Just curious to know is there any specific requirement to list only the summary record in the saveset? Please provide the feedback.

Regards,
Ketan
Jack Trachtman
Super Advisor

Re: Getting only SAVESET Header Info

Shriniketan,

The issue came up while we were reviewing our Disaster Recovery procedures.

Say we are at a DR site w/VMS booted from CD and a backup "recovery tape" from our site. The savesets on the tape used to be named with the disk labels, so mounting the tape and issuing a DIR would give us the disk names, the order (and the timestamps) of the files.

Since we switched our tape management system to ABS/MDMS, which requires that every Saveset have a unique name, now the saveset names don't give us much info.

Being able to get the Backup "header" record from each saveset would give us information needed for the restores. Using BACKUP/LIST on a full tape would take much, much longer than somehow pulling out just the header record.

With the info supplied by all (thanks very, very much to everyone), I've been able to create a software function that, for all savesets on a tape, lists only the header record, and ***doesn't take noticably longer than running a DIR cmd on the tape***.

Since the system disk is always the first file on our backup tapes, I just have to restore that file, boot that disk, and have access to my script, which I run to give me info to restore all the rest of the disks.
Jack Trachtman
Super Advisor

Re: Getting only SAVESET Header Info

Hein,

You were correct: changing DUMP/BLOCKS=END:1 *.* to DUMP/RECORDS=END:1 *.* allows me to dump just the 1st Backup block of every saveset on a tape. And dumping 1 record of every file on the tape doesn't take much longer than a DIR cmd on the tape!

Mounting the backup tape & PIPEing the output from the DUMP cmd to my script gives me what I need.

Thanks again to all
Verne Britton
Regular Advisor

Re: Getting only SAVESET Header Info

Dear Jack,

any chance you will share the final version of your utility ??

Verne