Microsoft KB Archive/246421

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Article ID: 246421

Article Last Modified on 10/30/2006



APPLIES TO

  • Microsoft Interix 2.2 Standard Edition
  • Microsoft Interix 2.2 Standard Edition
  • Microsoft Interix 2.2 Standard Edition
  • Microsoft Interix 2.2 Standard Edition



This article was previously published under Q246421

SUMMARY

This article describes how to use tape drives in INTERIX 2.2 SP1.

MORE INFORMATION

What's New in INTERIX 2.2 SP1

  • The tar and pax utilities automatically determine the correct block size to use when reading a tape. It is no longer necessary to know the block size of a tape before you can untar it.
  • Hardware data compression is now supported. The mt setcmp command is used to turn this feature on and off.
  • The mt analyse command scans a tape and finds files, blocks, and tape marks. Use this command to determine the block size of an existing tape.

How to Read a Unix tar Tape

The new version of the tar utility automatically determines the correct block size to use when reading a tape, but only if the tape drive is set to variable length block mode. To read a Unix tar tape, do the following:

  1. Insert the tape into the tape drive.
  2. Use the following command to set the tape drive to variable length block mode:


mt setblk 0

Note: Use the -f tapex option to mt if more than one tape drive is connected, where x is the tape drive on which you want to work.

  1. To read the tape, use the following command:


tar xvf /dev/tap

How to Write a Unix tar Tape

To write a Unix tar tape that can be read on Unix systems, including old System V systems, use a block size of 512 bytes. Follow these steps:

  1. Insert the tape into the tape drive.
  2. Use the following command to set the tape drive block size to 512 bytes:


$ mt setblk 512

  1. Write the tape by using the following tar command:


$ tar cvf /dev/tape0


For efficiency, write the tar archive with a block size of 10240 by following these steps:

  1. Insert the tape into the tape drive.
  2. Use the following command to set the tape drive to variable length block mode:


$ mt setblk 0

  1. Write the tape by using the following tar command:


$ tar cvf /dev/tape0

Note: tar defaults to a block size of 10240.



When you write a tape using a tape drive that supports hardware data compression, and then read the tape using a drive that does not support hardware data compression, you must turn off compression before writing the tape.


To turn off compression, use the following command:

mt setcmp 0

Note: For streaming tape drives, drives that use DC300, DC600, or DC6250 tapes, you do not have a fixed blocking factor. Any block size that is a multiple of 512 bytes will work.

Tape Block Sizes

This section applies to non-streaming tape drives. When you encounter issues reading tapes, the issues most often involve mismatched block sizes. When you write a tape, the data is written as a sequence of 'blocks' with an interblock gap between them. The actual size of the blocks written on the tape is determined by two factors:

  1. What block size is specified on the tar, pax or dd command line.
  2. Whether the tape drive is set to variable length or fixed length block mode.


On BSD-based Unix systems, the tape drive is normally set to variable length block mode, and one block is written to the tape with each call to the 'write' system call. On these systems, the block size specified on the tar or dd command line is the size of the blocks that are written to the tape.

On System V-based Unix systems, the tape drive is normally set to fixed length block mode, and the tape device driver splits each write() request into a series of fixed length blocks, often 512 bytes. On these systems, the block size specified on the tar or dd command line has no effect on the block size used when writing the tape, except that the tar or dd block size must be an integer multiple of the tape device block size.

On Interix, you can set the tape drive to variable length block mode by using the following command:

mt setblk 0

You can set the tape drive to fixed length block mode, for example, to a block size of 512 bytes, by using the following command:

mt setblk 512

When a tape is read, the success or failure of the read operation is determined by three factors:

  1. The size of the tape blocks to be read.
  2. The size of the buffer where the data is to be read.
  3. Whether the tape drive is set to variable length or fixed length block mode


In variable length block mode, exactly one tape block is read by each read() request. The read buffer must be at least as large as the block to be read, or the read operation will fail.

If the tape drive is set to fixed length block mode with a block length of N, then each block that is read must be exactly N bytes long. The read() request will fill the buffer with as many blocks as will fit, and again the request will fail if the buffer is smaller than a block.
What this means is that you cannot successfully read a tape when you are in fixed length block mode unless you know the block size with which the tape was written. This is why we recommend that you set the tape drive to variable length block mode when reading a tape using tar or pax. In variable length block mode, tar can automatically determine the block size.

When you want to determine the block size of a Unix tape of uncertain provenance, use the following sequence of commands:

mt rewind mt setblk 0 mt analyse

The mt analyse command scans the tape, printing out a message for each block and each tape mark that it finds. If the tape contains more than one file or tar archive, separated by tape marks, then mt analyse will find them all.

Hardware Data Compression

If your tape drive supports hardware data compression, turn on compression by using the following command:

mt setcmp 1

You can turn off hardware data compression by using this command:

mt setcmp 0

Tape drive firmware detects hardware data compression, and automatically uncompresses the data. However, if you are writing a tape that will later be read by using a tape drive that does not support hardware data compression, then you need to turn off compression before writing the tape.

Troubleshooting and Help

When you need help, type the following command:

mt status

This command prints information about the tape drive, including the current blocking factor as set by mt setblk. If this command does not work, then you cannot access the tape using INTERIX until the underlying problem is resolved.

When you need help from Softway to read or write a tape, please follow this procedure:

  1. Insert the tape you are having problems with into the tape drive, and type:


mt rewind mt status >status 2>&1 mt setblk 0 mt analyse >analysis 2>&1

  1. Send e-mail to Support, and include the following information:


    • The contents of the Status file.
    • The contents of the Analysis file.
    • The brand and model number of the tape drive connected to your Interix system.
    • The brand and model number of the tape media.
    • The sequence of commands that you typed to the INTERIX shell while attempting to read or write the tape.
    • The messages that you got back.
    • Whether you are attempting to exchange data with a Unix-based system.
    • The brand and version number of the Unix operating system.
    • The output from uname -a.
    • The brand and model number of the tape drive on the Unix system with which you want to exchange data.
    • The sequence of commands that you typed to the Unix system when you attempted to read or write the tape, and the messages that you got back.
    • The name of the tape device that you were using on the Unix system.
    • If you used mt, tapecntl, or an equivalent command to set tape drive parameters, then include this information.
    • If the Unix system has an mt, tapecntl, or equivalent command that is capable of displaying the current tape drive parameters, then issue the command and include the output.


For additional information, see the INTERIX 2.2 User's Guide in the online library.

Keywords: kbinfo KB246421