Solved

Copying a tape

Posted on 2000-04-07
27
427 Views
Last Modified: 2008-03-04
I am using SCO 5.0.5 and am trying to backup a copy of a tape using dd
I have tried using all different bs sizes but all that is copied are 5 files with a total of 314k bytes.  Two of the files list the actual files on the tape some 3000 of them in all and the total install time for the tape is some 60 minutes.
I have been using
dd if=/dev/rct0 of=/usr/harry/tmpfile
and using any bs size always only copies the same 5 files.  I have not tried cpio as I am not too sure whether this is the right command to use or in fact how to use it properly.
Any ideas
0
Comment
Question by:weeph
  • 14
  • 12
27 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2693614
What's the data format on the tape? It sounds like there are probably double EOF's on the tape separating areas of the format and dd will stop when it encounters a double EOF. If you use a no-rewind tape device you can repeatedly invoke dd to get more off the tape, but the result may not be particulary usable if the process that installs from the tape needs to see the actual tape format.

I suspect that you need something like tcopy or copytape. I found copytape at ftp://ftp.freesoftware.com/pub/FreeBSD/ports/ports/sysutils/copytape/
0
 

Author Comment

by:weeph
ID: 2694394
The data format on the tape is tar.
tar xvf is used to extract these five files onto HDD and then the command ./bootloader (one of the 5 files ) is used to install software from tape.  
0
 

Author Comment

by:weeph
ID: 2694492
The tape drive is an Archive 150mb QIC
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2694640
That explains why dd only gives you the first image. Multiple tars on a tape are separated by a double EOF marker. You can use a no-rewind device and multiple dd's, each to a separate file to get the contents of the tape. Or use copytape and do it in one step. I gave you the wrong link for it. It turns out that the sources aren't there, but are in ashar file here; ftp://ftp.freesoftware.com/pub/FreeBSD/ports/distfiles/copytape.Z
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2695172
Minor error on my part, multiple tar images on a tape are separated by a single EOF (which still terminates dd) and the last tar image is terminated by a double EOF. Apparently I was having a major brain fade when I said a double EOF as I've written enough special tape handlers to know better.
0
 

Author Comment

by:weeph
ID: 2698309
Does your last comment mean I can't copy a tape?  I will be trying copytape tonite after downloading it.  Will advise success or otherwise.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2698354
Yes you can copy a tape that contains multiple tars. Your problem is that when you try to get the data off the tape with dd, it will terminate when it encounters the EOF that separates each tar image from the next. So to get each of the images off the tape and onto disk you have to use a no-rewind tape device (a rewind device rewinds the tape to the beginning when dd exits on the EOF).

I don't remember what the no-rewind device is on SCO, but if I were doing it on Solaris the sequence would look something like:

dd if=/dev/rmt/0n of=file1.tar
(some non-zero block count)
dd if=/dev/rmt/0n of=file2.tar
(some non-zero block count)
dd if=/dev/rmt/0n of=file3.tar
(some non-zero block count)
dd if=/dev/rmt/0n of=file4.tar
(zero block count)

The last dd doesn't return data as it immediately encounters an EOF (or just doesn't find a tar image so I know that I've got all the tar images off the tape. just in case that's not clear, the layout of the data on the tape is:

1st tar image
EOF
2nd tar image
EOF
3rd tar image
EOF
EOF <<< may or may not be present

To put the data back on a tape the procedure is similar, except that I'll want to write bigger blocks to the tape, like so:

dd if=file1.tar of=/dev/rmt/0n obs=20k
dd if=file2.tar of=/dev/rmt/0n obs=20k
dd if=file3.tar of=/dev/rmt/0n obs=20k

Again I have to use a no-rewind device or I'll write each image over the preceeding one at the beginnig of the tape (a rewind device in Solaris is /dev/rmt/0, the no-rewind is /dev/rmt/0n). Check your docs for SCO to see what the designation for the no-rewind device is (it's probably a higher numbered /dev/rct).
0
 

Author Comment

by:weeph
ID: 2699370
Tried your last comment but didn't work too good.
I have a file that was used in our older systems.  I have used it successfully in the Motorola 68 and 88K machines but it won't work with a PC with SCO.  I have changed only one line from the rewind command for the 68 & 88 to the sco tape rewind command, but still no luck.  The file is too long to type in here.  Can I email it to you so you can look at it.  It was writtne in '95
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2699872
Oay, send it to jlevie@bellsouth.net and I'll look at it. That would be the best way for me to see what you're up against.
0
 
LVL 2

Expert Comment

by:bedot
ID: 2703486
try to use the mt command to seek in your tape, but always using the no rewind driver
0
 

Author Comment

by:weeph
ID: 2704928
bedot
Please explain
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2705076
I'm not cure that you made the change to use a no-rewind device correctly in copytape. What does your doc's say the no-rewind device is?
0
 

Author Comment

by:weeph
ID: 2705326
The man page shows for tapecntl
-e   erase tape
-r   reset tape device
-t   retension tape
-w   rewind tape
I thought that in the both files the m350ctl and tapecntl commands referred to dorewind() in line 31
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 40

Expert Comment

by:jlevie
ID: 2705568
That's fine for the tape control, but what I want to know is what is the designation for a no rewind device. By your edit it looks as though you think it's probably /dev/rct0n. Is that correct?
0
 

Author Comment

by:weeph
ID: 2706694
Yes the/dev/rct0n is the no rewind device according to manual
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2707586
Right, i thought so. When you changed the copytape script it orgininally had  the line "FROM=${FROM}an" which you changed to "FROM=${FROM}a". That line needs to read "FROM=${FROM}n"

To copy it back out to top you'll also need to change "TO=${TO}tn" & "TO=${TO}an" to "TO=${TO}n".
0
 

Author Comment

by:weeph
ID: 2711205
First the good news.  Copied a tape to disk and then copied it back to new tape.  Installed program from copied tape 100% success.  Well done.
Now the bad news.  When I copied the tape to disk all went well except after copying all that was on the disk the process kept copying zero size files to disk.  I ended up with the three COPY.1 COPY.2 & COPY.3 files and then files from COPY.4 up to COPY.842 zero byte files before I did a Ctrl+c to stop the process.  I deleted all but COPY.1 to .3 and then copied disk to tape and it completed the task as it should have without problems.
I think I need a further line in the copytape file to stop when there are no more files to copy.  Any ideas.  Have you tried copytape yet or do you not hace sco?
0
 

Author Comment

by:weeph
ID: 2711216
First the good news.  Copied a tape to disk and then copied it back to new tape.  Installed program from copied tape 100% success.  Well done.
Now the bad news.  When I copied the tape to disk all went well except after copying all that was on the disk the process kept copying zero size files to disk.  I ended up with the three COPY.1 COPY.2 & COPY.3 files and then files from COPY.4 up to COPY.842 zero byte files before I did a Ctrl+c to stop the process.  I deleted all but COPY.1 to .3 and then copied disk to tape and it completed the task as it should have without problems.
I think I need a further line in the copytape file to stop when there are no more files to copy.  Any ideas.  Have you tried copytape yet or do you not hace sco?
0
 

Author Comment

by:weeph
ID: 2711219
Sorry my last comment should have read 'all that was on the tape the process'  not 'all that was on the disk the process'
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2711747
It was obvious to me that you were talking about the tape, even without the correction, as I knew from the first part of the question what was happening.

dd is pretty dumb and if you keep invoking it on a blank tape it'll keep trying to get data. After all how would it know that there wasn't any more data without trying to read from the tape? Since the frst thing it does is to open the output file, then open the tape device you get a zero  length file.

The shell script could be modified to look at the resultant output file size and stop after one, or preferrably two, zero length files have been "extracted" from the tape (which could then be deleted).
0
 

Author Comment

by:weeph
ID: 2720819
Any ideas of what the script would be?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2720925
Yeah, probably... I'd have to play around with it a bit to right. I'll see what I can come up with
0
 

Author Comment

by:weeph
ID: 2743040
Adjusted points from 100 to 400
0
 

Author Comment

by:weeph
ID: 2743041
jlevie
I have found answer but I will give you 400 points for work done.  Many thanx
0
 
LVL 40

Accepted Solution

by:
jlevie earned 400 total points
ID: 2743414
What did you find?

I'm assuming from that last comment that you wished for me to Propose an Answer...
0
 

Author Comment

by:weeph
ID: 2744422
Change the 'while' part of the script to
while copyfile $FROMTAPE $TOTAPE $COUNT
do
    cat $TMPDIR/$LOGF

    if [ ! -s "$TO" ]
    then
        if [ -n "$STOPFLAG"]; then break;
fi
    else
        STOPFLAG=true
    fi

    COUNT=`expr $COUNT + 1`
done

Works like a dream.  Once again thanx
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2744530
Yep that would do it.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now