Re: Tape handling in Linux

Eric Koldeweij <[email protected]> Fri, 22 Aug 2003 04:09:19 +0200
Newsgroups gmane.linux.redhat.release.enigma
Message-ID <[email protected]>

Becca Putman wrote:

>Hi, all!
>
>Yet another Linux newbie... having found that Linux has been able to
>identify and install software for everything in my system, I thought I'd
>try something exotic.  I purchased an old Digital (DEC) TZ87 tape drive
>and an Adaptec AHA-2940 SCSI adapter (this is the SCSI-2 adapter with
>only 50-pin connectors; not a wide or fast/wide)
>
>RedHat found my scsi adapter and installed it.  It even sees my TZ87,
>but I don't think a driver has been installed for it.  My hardware
>browser says: 
>Selected Device: Dec TZ87  (C)DEC
>   Manufacturer: Unknown
>         Driver: none or built-in
>         Device: /dev/st
>
As the kernel has already recognized the streamer you won't need any 
special driver. The tape drive can be accessed by the device name (as 
mentioned) /dev/stx where x is the tape drive number. Since you have 
only one tape drive I assume, its device name will be /dev/st0

There are several standard utilities for tape streamers. one important 
one is "mt" This can be used for non-backup related tape actions like 
rewind the tape (mt rewind), tape drive status (mt status) and many 
more. See "man mt" for details.

I personally use the good ol' tar utility for my backups. After all, 
it's what tar's originally made for :)
for instance "tar cfvz /dev/st0 /" makes a complete backup of the whole 
directory structure to the tape.
See "man tar" for details......

I have no idea how VMS stores its backups on tape and I also don't know 
if there's a utility able to read VMS-type backup tapes. What is 
possible in any case is to copy an image of the whole tape into a file 
on disk, you should use the "dd" command for that. You could use regular 
file-based tools to decode the image just as if it was read from tape. 
It's also a great way to copy a tape :)
Again the man command should help here; man dd for details on Linux' 
data dump utility.

Last but not least, as the device name is a "file" in the linux file 
system, basically any standard unix command will work on the tape drive. 
Whether it's useful is another matter of course. For instance "cp 
somefile /dev/st0" will work like a charm and copy the file somefile to 
tape (hereby destroying the tape's previous contents) as raw data. It's 
pretty useless, because you can't copy more than one file to tape and 
expect to be able to retrieve it, but it shows that you can more or less 
treat your tape drive like a regular file in Linux. I have once tried to 
catch a hacker by rerouting my system log messages to the tape drive. It 
worked :)

Have fun with it :)

Eric.