Operating System - HP-UX
1756702 Members
3099 Online
108852 Solutions
New Discussion юеВ

finding out how a tape has been written.

 
SOLVED
Go to solution
malvin drakley
Esteemed Contributor

finding out how a tape has been written.

Hi there, can anyone point me in the direction of a utility on HP-UX that determines how a tape is written, i.e. tar,dd or cpio and what the block size is. I worked on ICL's DRS-NX for several years and we had a unix command called "whattape". I have discovered a routine for aix, but need a similar function on HP-UX.
I was given a tape yesterday that was allegedly a cpio backup from a customer who needed to restore some data, but I was unable to get any meaningful data from it
thanks in anticipation
malvin
Not me Chief, I'm Radar
21 REPLIES 21
Paula J Frazer-Campbell
Honored Contributor

Re: finding out how a tape has been written.

Hi Malvin

Try Here:-

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=87318


Paula
If you can spell SysAdmin then you is one - anon
malvin drakley
Esteemed Contributor

Re: finding out how a tape has been written.

Hi Paula, thanks for the quick reply. I have looked through the thread you have supplied and tried several of the options, but as yet have beeen unable to determine a block size on the cpio tape,
will keep trying
malvin
Not me Chief, I'm Radar
Cheryl Griffin
Honored Contributor

Re: finding out how a tape has been written.

Try:
# dd if=/dev/rmt/0mn of=/tmp/test bs=1K count=2
# file /tmp/test

The file command should return what format the tape is (cpio, tar, etc.).
"Downtime is a Crime."
malvin drakley
Esteemed Contributor

Re: finding out how a tape has been written.

Thanks Cheryl, I have tried that but it still does not let me know what block size the cpio was written with. I tried my tape with and without the -c option and each way that I tried it, it said "perhaps you should try the -c option" or vice versa
malvin
Not me Chief, I'm Radar
Cheryl Griffin
Honored Contributor

Re: finding out how a tape has been written.

The file command will only help you confirm that you're working with a cpio tape.

Can pax read the tape? Pax can read tar and cpio formats. If pax cant read the tape, it could be that the tape is bad:
# pax -r -f /dev/rmt/0m
"Downtime is a Crime."
malvin drakley
Esteemed Contributor

Re: finding out how a tape has been written.

Thanks Cheryl, the customer as they say "has just left the building", we are getting a message to him to bring the tape back tomorrow morning, so will let you know the outcome then when I have tried the latest suggestion you have given me
cheers
malvin
Not me Chief, I'm Radar
Bill Hassell
Honored Contributor

Re: finding out how a tape has been written.

Unlike mainframes where a tape recognition daemon (they aren't really called that but function that way) is used to ID a tape header, HP-UX doesn't have anything like that. Instead, you can use the guessing program called file. File is a magic program. OK, it uses a file call /etc/magic which is a series of codes to tell file how to match up something at the beginning of a file (or device file) with common formats. So the commands:

mt -t /dev/rmt/0m
dd if=/dev/rmt/0m of=/var/tmp/tapeid count=2
file /var/tmp/tapeid

should tell you about the tape, assuming that it is in a 'well-known' format like tar, cpio, etc. (note that /dev/rmt/0m is an example--use the correct device file for your system) It is IMPOSSIBLE to determine if the tape was created with dd since dd is a raw copy of . Also, tape formats from mainframes (ie, ANSI or IBM labeled tapes) are not recognized by file. However, you can see if it is a mainframe labeled tape by using xd as in:

mt -t /dev/rmt/0m
xd -xc /dev/rmt/0m | more

If you see something like VOL as the first 3 characters and subsequent header lines like HDR1, HDR2, etc then you have an ANSI labeled tape. If the characters are strange, it might be in EBCDIC mode so use something like this to translate:

mt -t /dev/rmt/0m
dd if=/dev/rmt/0m od= count=2 conv=ebcdic | xd -xc

If thisa looks like VOL HDR etc records are present, you have an IBM standard label. The bad news about ANSI or IBM standard laebls is that there is nothing in HP-UX that can read the data and make sense out of it. If the tape contains fixed length records, you can probably play with mt (for positioning the tape) and dd to do a raw copy and translate from EBCDIC if necessary. But if the format is variable length, you'll have to write a program to interpret the records, essentially the basics of a mainframe restore program.


Bill Hassell, sysadmin
malvin drakley
Esteemed Contributor

Re: finding out how a tape has been written.

Hi Bill, thanks again for the info, as I said to Cheryl it will be tomorrow before I get another chance to check the tape,
so will let you know sometime tomorrow
cheers
malvin
Not me Chief, I'm Radar
malvin drakley
Esteemed Contributor

Re: finding out how a tape has been written.

Hi to Cheryl and Bill, The customer arrived with the tape again yesterday. He says it was written on a SCO box(I've washed my mouth out!). I have tried the "pax" command and the response from that was "this doesn't look like a tar archive, skipping to next file" and then the # prompt.
I then tried your suggestions Bill and cannot see anything like you suggest, so I have "dd'd" the first 10 blocks in and am attaching them for your perusal. It all looks like plain text so I am not certain as to the kind of tape
cheers
malvin
Not me Chief, I'm Radar