SFINX documents - the tar command and tapes
Types of tapes
There are various types of magnetic tapes that can be used as storage or backup
media. At the Sterrewacht we have the following types of tapes:
  - DAT (Digital Audio Tape) - stores approx. 1.3 GB (or more if
      compression is possible)
  
- Exabyte (8mm video) - stores approx 4 GB (or more, with compression)
  
- DLT (Digital Linear Tape) - stores approx. 20 GB, and is fast
  
- QIC tape - stores only 60 MB
Currently, DAT tapes seem to be most widely available around the world, so if
you are planning on taking your data to another institute, DAT might be the
best choice.
The following machines have a tape device:
  - DAT    : rijn, ijssel, schelde,
               zijl, vecht, vliet, lithium, melian, flow, redshift
               drecht (2x), dollard [DAT jukebox], merwede
  
- Exabyte: ijssel, vecht, gouwe
  
- DLT    : gouwe, wad
  
- QIC    : spui
Under the SFINX environment, the device name of the
tape device is always set in the $TAPE envirnoment
variable, so
that you nearly never have to tell a command the device name to work with.
An up-to-date listing of tapes can be obtained using the command
devices tape.
compression
On some machines, compressed tape access is possible. Currently this is
the case on all Exabyte and DLT units, and on the newest DAT units (DDS-3;
on ijssel, melian, redshift, flow, merwede).
To use this feature, make sure you have the proper device name set in the
$TAPE environment variable. The device names are
indicated at a label on the tape device.
Beware that compressed backups cannot be read on all machines !!
The mt command
This command (whose name stands for "magnetic tape") is used to view the tape
status, and spool the tape backward and forward.
  - mt status : displays tape status.
 If all is OK, the status should end with a line
      file: 0 block: 0
      which means the head is positioned at the beginning of the tape.
      So file: 1 block: 0 means it is positioned just after
      the first file on tape. If the status should read
      file: 0 block: 200 this means it is positioned
      somewhere in
      file 1. You should then probably skip forward to the end of the file
      in order not to damage the file.
- mt fsf 1 : forward skip file
 This skips forward to the next end of file mark on tape, i.e. to after
      the end of the current file.
      The number indicates the number of files to skip, which may be bigger
      than 1.
- mt bsf 1 : backward skip file
 Skip back to directly after the previous end of file mark. This command
      is not supported on all tape devices.
- mt rewind : rewind the tape completely
  
- mt rewoffl : rewind and eject the tape
See the mt (1) man page for more detail.The tar command
The most often used command to write or read tapes is tar,
which stands for "tape archive". It can be used to make backups of (parts of)
your data. There is also GNU tar (gtar) which has more
options (including compression).
Files are always saved and restored with their full path name. This is both
convenient and inconvenient: it allows a complete backup and restore with all
the files in the same location, but one also has to be careful. If a backup is
made with the command tar cv /home/strw/myname, then it
is almost impossible to restore this backup on a system where no
/home/strw
disk exists. The smart way to do a backup is therefore to change to the
directory you want to save, and then do tar cv ., because the
current directory (.) will always exist on every UNIX
system.
Note: GNU tar (gtar) is smart enough to correct this
"mistake" automatically.
The most often used commands are:
  - tar cv .
 Create (c) a backup of the current directory
      (.), and give a verbose (v) description
      of what is being written.
- tar tv
 List the contents of a tar-file (backup set).
- tar xv ./dir/file
      Extract (x) a certain file (specified with its full path
      name).
See the tar (1) man page for more detail.The Backup command
Backup is a SFINX script built around
the tar command. Some people may like it, but it is
never necessary to use it. Tapes written by Backup can
be read by tar and vice versa.
Other commands that work with tapes
There is a couple of other programs that might be useful when dealing with
tapes.
  - dd : this is a low level tape access program. It can be
      used to copy files from tape to disk if the block size is known.
      e.g. dd if=$TAPE of=file1.fits bs=28800
  
- tcopy : a utility to copy tapes. Not very useful at the
      moment, except on machines with more than one tape device.
      e.g. tcopy /dev/rmt/0mn /dev/rmt/3mn
      
 Another use for tcopy is to list the record structure
      of a tape. This is what is done if you give tcopy
      only one tape argument.
- dump & restore :
      utilities for backups;
      especially useful for the system manager. Don't try it, unless you know
      what you are doing.
  
- tpalloc & tpdealloc :
      utilities to allocate and deallocate the tape unit, in order to
      prevent others from using it. Don't forget to deallocate !!!
  
- tpcheck : utility to check who has allocated a tape
      unit
See also the section about the automatic backups.
David.Jansen@strw.leidenuniv.nl
Last modified: Thu Jan 14 10:13:37 1999