[Sussex] Can't mount tape drive

Steven Dobson steve at dobson.org
Mon Aug 28 23:30:07 UTC 2006


On Mon, 2006-08-28 at 21:34 +0100, Bob Williams (SLUG) wrote:
> I've recently added an HP DDS-2 tape drive to my system, but I can't
> mount it. I know it exists as /dev/st0. Should I add an entry to fstab,
> and if so, what should I put (e.g. what file system?)?

*nix imposes a restriction that you can only mount a random access
device.  Tapes are not random access, the data they contain is accessed
serially as the tape moves past the tape head.

I believe that someone did write a wrapper for a tape device driver to
give it random access capability and thus you could then write a file
system to a tape and then mount it.  However, such a system would be
very, very, very slow as the drive moves the tape to and fro.

Take a look at commands like tar(1) [Tape ARchive] or cpio(1) which can
be used to read and write data to or from a tape device.  For example,
to take a backup of the /etc directory:

  # cd /
  # tar -cvf /dev/st0 etc

And to see what you have written:

  # tar -tvf /dev/st0 

And to extract the files from the tape:

  # cd /tmp
  # tar -xvf /dev/st0

The meanings of the flags are:
  'c' - Create
  't' - Table of content
  'x' - eXtract
  'v' - Verbose
  'f' - use File that follows

When it comes to the tape devices there are two types:

  /dev/st0  - Rewind the tape before finishing
  /dev/nst0 - Do not rewind the tape before finishing.

The second device is the most useful as it allows you to write multiple
tar archives to the tape, one after the other.  If you were to use the
first device the second file written to the tape would over write the
first.

To move the tape about manually take a look at the mt(1) command.  It
can do fast forward and fast rewind over each file.  Unless you are
rewinding the tape right back to the beginning then you _must_ use
the /dev/nst0 device, or the tape will be automaticly rewound to the
start before the prompt is given back to you.

Useful mt commands:

   # mt -f /dev/nst0 fsf 2     <----- Fast forward over 2 files

   # mt -f /dev/nst0 bsf 3     <----- Back up over 3 files

   # mt -f /dev/nst0 rewind    <----- Rewind the tape to the start

Hope this helps
Steve




More information about the Sussex mailing list