BEDTIME READING-TAPES
QIC Tape TAPE BACKUP or I installed the bloody driver, what now? or OOK?

Tape media are streaming devices. As such, they cannot be mounted. This makes them quite painful to use intuitively and the tools necessary are somewhat obscure. Using tapes in Linux is a three-step operation.

Have a careful read of the above three points to realise the following;

Step ONE: device drivers

First you need to supply a device driver for your particular streaming tape. See Tape Drives for howto with Jaz, Floppy Tape, Zip, Ditto and others.

Step TWO: device nodes

After the above step, fix up your /dev devices. Each type of streaming device use different nodes. Examples
 

/dev/st0 scsi tape streamer
/dev/nqft0 non rewinding floppy tape
/dev/tape a symbolic (shorthand) link to the most commonly used device (scsi, floppy, rewinding, non-rewinding)

These device nodes are _normally_ acquired as follows


For the curious, here is where device drivers and device nodes fit into the scheme of things.

Linux is one huge file system (including tapes, consoles, keyboards)

All file activity begins and ends with the c function call ioctl(device node.....)

When you install a device driver (modprobe), that device driver's first task is to tell the kernel which device node(s) it is responsible for.

Since you _could_ have two scsi tape drives, three floppy tape drives, and a single joe bungles tape drive, EACH one requires separate nodes. Ie something that defines the explicit 'number' of the device.

Application programs that work with tape drives will use by-convention device names for the given device. Thus the same application program can be configured to use /dev/nqft0, or /dev/st0. Each name associates with a different device number, and hence a (most likely) different device driver. In fact, the actual names are quite arbitrary, you would be quite free to call them 'sausages' in the /dev/ directory and 'sausages' in the application program and all will work well.


Step THREE: Understand tape layout before proceeding

Blocks on a tape are just that. The are simply data blocks which are separated (on the tape) by unfortunately named 'file separators'. The contents of any block can contain a single file, a single directory, or an entire hard disk. Each 'block' you write on a tape is separated by a file separator and has consequences when you read or list the tape back.

Rewinding and non-rewinding devices.

At first glance, these appear to reflect the capabilities of the 'device'. ALL tape drives are both rewindng and non-rewinding. The use of these two separate device names are for the operations that the kernel will perform automatically to the rewinding device name. They BOTH refer to the same device. Such examples are (n)qft0 and (n)st0.

In the documentation below /dev/tape is a symbolic link to /dev/nqft0 , ie the NON rewinding port. Do not use the rewinding device until you know what you are doing, most operations will not work as advertised.

Step FOUR: using tar and mt

Because we are used to the familiar commands of mv, cp, mount etc. It is initially quite difficult to follow along and use tape devices. Linux supplies tar and mt for this purpose (among others).

TAR is a storage application, (read / write)
MT is move tape application.

Combined together, you have the rudimentary building blocks of working with tapes. Here's what you need to know. NB the following are simple one or two line script files.
 

./rewind mt -f /dev/tape rewind Use this command before doing anything on a freshly loaded cartridge
./erase ./rewind
mt -f /dev/tape erase
Use this command before doing anthying else on a freshly formatted cartridge (it writes special header blocks)
./write tar cvf /dev/tape <filename> <filename> can be a single file, or a directory name. The / is optional if specifying a directory.
./list tar tvf /dev/tape Similar to ls, lists 1st 'block' on tape. You can also specify specific file(s) in the block.
./restore tar xvf /dev/tape Simply copies the contents of the block to the current directory
./restore other tar xvf /dev/tape -C <somewhere> copies the contents of the block to <somewhere>
Useful Esoterica
./fwd mt -f /dev/tape fsf move to next block
./back mt -f /dev/tape bsf n move back n blocks (n > 1)
./seteof mt -f /dev/tape eof set eof for new record beginning
./end mt -f /dev/tape eod moves to end of tape blocks. (not tape, tape blocks)

Writing multiple blocks.

To write more than one directory on a tape device (let's say /etc and /home).

./rewind
./write /etc
./write /home

to list multiple blocks

./rewind
./list # first 'block'
./list # reads eof separarator
./list # 2nd block
./list # next separator
etc

Appending blocks.

The tar -A and -r options do not work.

./end # move to end of existing tape blocks
./write <filename>
./write <another filename>
./rewind

Esoterica

For all QIC formatted tapes insert the following into ALL tar commands

tar -b58 ..........

Why?

Qic tape blocks are fixed 32k entries. 29k is data, 3k is ECC. tar will build 58/2 = 29k data blocks before passing to tape, the speeding process.

Step FIVE: Archivers

By now, you have realised that the tools for tape data storage are not only primitive, but require, as a minimum, script files to avoid unpleasant side effects (eg ./rewind first)

Secondly, tape data is NOT ext2 files system format, nor is it ISO9660, nor is it Dos, it is tape data blocks. There is NO universally accepted tape file structure. For a file system to exist, there needs to be a directory listing, containing 'pointers' to all other data on the 'device'. In short, there isn't one, nor does tar provide one. Enter the archivers.

With the above listed scripts ./end, ./rewind, ./list etc, you could write your own sensible archiver application. You could, create your own method of file directory and write it as the first 'block' on the tape.

Other people have already done this for you. One such program is BRU (or xbru) and quite popular. In it's own proprietary way, it maintains tape archives, listing, and manipulating the contents. Bare in mind, there is nothing wrong about 'proprietary', each supplier of any archiver program has their own unique methods.

BRU and all other archivers are outside the scope of this document. I have pointed you in the right direction to capture the tools necessary for sucessful tape manipluation, and, hopefully, solved some stumbling blocks for you, noticeably the primary stumbling block of installed driver, what do I do now?

Enjoy!

searchSearch Index