next up previous contents
Next: vmsbackup Up: Using TAPE drives Previous: Using TAPE drives   Contents

Tapedrive manipulation (mt, tar)

The Suns currently have no concept of allocating tape drives. There are several terse command names used to access the tapedrive. Type man -k tape | more for a full listing. The most important ones are mt to manipulate a tape and tar to read or write your files to tape. Look in man mt and man tar for full details. UNIX distinguishes the characteristics of a drive (density, autorewind, etc.) using the name. Currently the only tape drives on malama are the DAT drive, called ``/dev/rmt/0'', and the 1/4" cartridge tape drive, called ``/dev/rmt/1''. Both drives will automatically determine the format of any tape you read in it, but the DAT has only a high (default) and low density write mode. You will probably want to use the non-autorewind device names; simply append an ``n'' to the name of the drive, e.g. ``/dev/rmt/0n''.

A typical tapedrive session that backs up bbaggins' files from disk to tape would be:

<load the tape on the drive rmt/0n>
lehua% cd<- change to home directory
lehua% tar -cvf /dev/rmt/0n .<- create files on DAT tape
lehua% mt -f /dev/rmt/0n rew<- rewind tape
lehua% tar -tvf /dev/rmt/0n<- read back the table of
truein contents from the tape

Note that you could redirect the output of the table of contents listing into a file, or pipe it into a printing command or a screen-pager program like less. That way you could make it easier to read through, or save it permanently.

lehua% tar -tvf /dev/rmt/0n > tape.list

You should always use a ``relative'' (i.e. relative to your current working directory) pathname for backup of a directory, such as ``.'', since one of the quirks of tar is that files with explicit pathnames on a tape can only be restored to the same place. I.e. if you were to take the tape somewhere else, you could only restore the contents if you had a directory available with exactly the same full pathname. By using the ``.'', you can later restore the files into whatever directory you are working in then. tar will maintain the tree of subdirectories if there are any.

Be careful if you already have files on the tape, since UNIX will start writing wherever the tape is positioned. Using the -r option to tar instead of -c will force new files to be appended to an existing tarfile rather than overwriting it (WARNING: this may not work with the DAT drive). You can also skip to the end of the last file using mt and then start writing. See man mt for more details.

Look in man tar for even better examples.


next up previous contents
Next: vmsbackup Up: Using TAPE drives Previous: Using TAPE drives   Contents
h.stilmack@jach.hawaii.edu