How to reach files from tape drive using dd

Hi all!

I have problem with copying files from tape drive.

The contents of tape:
silverman# tcopy /dev/sa1

file 0: block size 10240: 21 records
file 0: eof after 21 records: 215040 bytes
file 1: block size 10240: 20712 records
file 1: eof after 20712 records: 212090880 bytes
file 2: block size 10240: 7 records
file 2: eof after 7 records: 71680 bytes
file 3: block size 10240:
file 3: eof after 44991 records: 460707840 bytes
file 4: block size 10240: 34298 records
file 4: eof after 34298 records: 351211520 bytes
file 5: block size 10240:
file 5: eof after 127911 records: 1309808640 bytes

Copy first file:
silverman# dd if=/dev/sa1 of=/tmp/1 bs=10240 count=21
Excelent first file copied.

Copy second file:
(skipping first file + mark EOF - maybe here is something wrong?)
silverman# dd if=/dev/sa1 of=/tmp/2 bs=10240 count=20712 skip=22
dd: skip reached end of input
silverman#

The size of 2 is 0.

Could you know how to reach tha second, third, etc files from tape using dd? or you have any other suggestion how to read it?

Many thanks for help!

Check the man page for the tape driver. There should be a no-rewind style of device file. It might be /dev/nrsa1 or something like that. You need to use that device file. Then do dd without count= or skip= so that dd will encounter the filemarks. the first dd will read the first file on the tape and leave the tape positioned to read the second file. So you just run a second dd command to read that file. And continue until you have all of the files. Another way would be the mt command. It will have some option to forward space files. So you might be able to do "mt -f /dev/nrsa1 fsf 3", and follow that by a dd to read only file 4 (assuming that you started with the file rewound). And you can use the mt command to explicitly rewind the tape when you need that.

It solves all my problems.

Thanks a lot for help!!!