Tape-IO for Windows

Current version : 1.07 (January 1997)

My thanks are due to Michael A. Meiszl for help and ideas, in particular for work on the dynamic buffer sizing logic, German language help and error texts, and testing.

Overview

TAPEIO is freeware. Please read the disclaimer below for more details of the rules and restrictions governing it's use.

This program provides access to the NT tape devices for unix-style archiving programs that take data from (or write to) their standard input and output devices. There are a number of shareware programs for NT (tryshareware.com) that provide CPIO, TAR and other unix style backup formatting options. Sadly, NT does not provide unix-like access to tape devices through named directory entries (like "/dev/tape1", etc), so many of these programs cannot read or write tape backups. TAPEIO attempts to plug this hole.

TAPEIO runs in two major modes..

Read mode

This copies data from the tape device to standard output. This can be used to restore data from tape, like this.

tapeio -r | cpio -icBdum

Write mode

This copies data from the standard input to the tape device. This can be used to save data to tape, like this..

dir /b | cpio -ocB | tapeio -w

There are a number of other options for selecting the device to use, the tape section to access, to elect to erase the tape at the start of a "write" operation or to eject the tape at the end.

TAPEIO was developed on NT4.0, and tested on the Olivetti SNX140 range of machines. It WILL NOT run on Win95 systems, but should (or so I reason) run on other hardware platforms that provide compliant APIs and tape device drivers. If you find it does not work on your hardware or OS version, and you manage to resolve the problems by changing the code, please send me details of the changes so that I can include them in a future release - Thanks.

Notes

"Block sizes" (-b option)

The block size argument (for the -w command) specifies the size of blocks that are written to tape. NT can handle a wide range of sizes (limited only by the capabilities of your tape drive hardware). Some other operating systems can only use a specific block size (typically 512 for unix 5.4, and 1024 for SCO unix). It is important that when creating tapes for exchange with other systems, you select an appropriate block size.

The block size does NOT have to be a power of 2 in NT 4.0 and beyond.

When reading tapes, tapeio determines the block size automatically, and can handle tapes created with block sizes up to (and including) 64 Kbytes.

Unix systems are somewhat picky on the tapes they would like to read. The block size is a rather critical factor here. We can't tell you what size your Unix system likes to read, but we give you a tool to test it out. Create a tape on your Unix system, contents don't matter. Now enter the tape into your NT system and issue the command "tapeio -b?". You will get a report, indicating what size is used on the tape. Write down the value and use it as an argument for -b on future write commands.

If you want the -b? result displayed in a particular format (for example, as a variable that the shell can collect), then use the -f option. The following batch script shows how this logic could be used..

tapeio -b? -f"SET N=~" > tmp.bat
call tmp.bat
del tmp.bat
echo Block size is %N% bytes

The '~' (tilde) character is used as the place-holder for the actual block size returned.

Preventing "Padding" (-n option)

When specifying "block" sizes with the "-w" option (write), the data is copied to the tape in blocks of the specified size. If the file is not an exact multiple of this block size, the last block is filled with NULL characters to bring it up to size.

The -n option prevents this "padding" logic, and causes the last block to be written with the actual size required to complete the file.

When using tapeio with archive programs such as CPIO or TAR for interchange with unix systems, this flag should probably not be used, but if you are saving and restoring a "raw" data file that would be damaged by having nulls appended to it, then the option should be used.

"Section number" (-s and -a options)

The '-s' option allows you to specify the tape "section" or "file set" to be accessed.

Normally, the first section on tape is section number one, but some systems (eg: SCO) place an empty section at the start of the tape, so your data may be in section 2.

When writing data to tape, the "end of tape" is flagged at the end of the most recently written section, so beware of thinking you can "update" a tape section - you will loose the data held in the following sections if you do.

To speed up writing tapes with large numbers of blocks, the "-a" flag (append) can be used in place of "-s", so tell TAPEIO to find the end of the current data, and start a new section there.

In addition, you can use TAPEIO to count the number of sections present on your tape. Simply use the "-s?" syntax, and the program scans the tape from start to finish, counting the sections it encounters along the way. At the end, the count is displayed to you.

If you want the -s? result displayed in a particular format (for example, as a variable that the shell can collect), then use the -f option. The following batch script shows how this logic could be used..

tapeio -s? -f"SET N=~" > tmp.bat
call tmp.bat
del tmp.bat
echo Tape has %N% sections

The '~' (tilde) character is used as the place-holder for the actual counter returned

Logical formatting (use of tape marks)

Tapeio follows the Unix 5.4 convention that every "section" on the tape is terminated with a FILEMARK, including the last one. The end of data is flagged with an ENDOFDATA mark. Thus the number of sections and the number of FILEMARKS are the same, and an empty tape consists simply of an ENDOFDATA mark.

Tapes that do not follow this formatting convention will cause Tapeio to misbehave. Possible differences of tape formatting which could cause problems are..

  • Use of SHORT or LONG filemarks in place of STANDARD ones.
  • Use of SETMARKS in place of, or as well as FILEMARKS.
  • Omission of the FILEMARK at the end of the last section.
  • Omission of the ENDOFDATA mark after the last FILEMARK.
  • Use of multiple partitions.

[For the meanings of the words FILEMARK, SETMARK, ENDOFDATA and PARTITION, see the Win32 programmer's reference - chapter on the "Tape Backup" system service]

Tape copying

Tapeio also provides a facility for copying tapes, including data from all the sections of the tape, duplicating the block sizes.

The "-ri" syntax reads a full image of the tape contents and writes it to the standard output using an "internal" binary format.

The "-wi" syntax reverses the process.

So to copy a tape you can dump its contents to a file, and then restore, thus..

tapeio -ri > file         To dump tape contents to disk
tapeio -wi < file         To copy back to tape

Or combine these syntaxes, piped together on a machine with more than one tape drive, thus..

tapeio -ri -t0 | tapeio -wi -t1

Tapeio Usage summary

tapeio -?|-??|-x
tapeio -r [-j] [-t#] [-s#] | COMMAND-NAME
tapeio -ri [-j] [-t#] | COMMAND-NAME
COMMAND-NAME | tapeio -w [-j] [-t#] [-a|-e|-s#] [-b#] [-n]
COMMAND-NAME | tapeio -wi [-j] [-t#] [-e]
tapeio -e [-j] [-t#]
tapeio -j [-t#]
tapeio -b? [-j] [-t#] [-s#] [-f"format"]
tapeio -s? [-j] [-t#] [-f"format"]

   -?   to display disclaimer and registration information (please read!)
   -??  to display the full README text, including notes and hints on use
   -x   to display some brief examples of use
   -r   to read one section from tape device (copy tape => stdout)
   -ri  to read entire tape image (copy full tape => stdout)
   -w   to write one section to tape device (copy stdin => tape)
   -wi  to write full image to tape (copy stdin => tape)
   -e   to erase the tape [from the start]
   -a   to append one section (skip to end of tape, and write)
   -j   to eject the tape [when finished]
   -t#  specify the tape device number (0=first/default)
   -s#  specify the tape section number (1=first/default)
   -s?  to count the number of sections on the tape
   -b#  specify the blocksize (default = 512, SCO Unix = 1024)
   -b?  to measure blocksize of the first block in the section
   -n   to prevent 'padding' the last block with nulls
   -f   specify result format ('~' is value placeholder)

Tapeio Examples

Command line                   Description
----------------------------   ------------------------------ 
tapeio -r | tar xvf -          Restores a TAR tape
tar cf - . | tapeio -w -s2     Saves current dir to section 2 of tape
dir /b | cpio -oc | tapeio -w  Saves files in current dir to tape
tapeio -r -j > tape.dat        Dumps tape contents (section 1) and ejects
tapeio -e -t3                  Erase tape in drive 3
tapeio -r | tapeio -w -t1 -e   Copy from tape drive 0 to drive 1
tapeio -j                      Eject the tape
tapeio -?                      Display full disclaimer text
tapeio -??                     Display the full readme text
tapeio -s? -t2 -f"SET N=~"     Count the sections on tape in drive 2
tapeio -ri > tape.dat          Dump entire tape contents to file
tapeio -wi -j < tape.dat       Restore entire tape contents, and eject
tapeio -ri | tapeio -wi -t1    Copy entire tape from drive 0 to drive 1

Disclaimer/Warnings

By running the program, you are deemed to agree to the following terms and conditions of use..

In summary:

  • You can use this software, free of charge, but entirely at your own risk and without support of any kind.
  • You MUST NOT sell this software to anyone else.
  • If you obtain the sources (see below) and you have to modify the program to get it to run on your hardware or system version you must e-mail me details of the changes you have made.

In more detail:

  • The author (and/or his employer, internet provider etc) cannot be held responsible for any damage or loss of data (however caused) resulting directly or indirectly from the use of this software or any other software written by him.
  • The software is the private property of Digitage Ltd, and must not change hands in any commercial transaction (it cannot be bought or sold) what so ever.
  • It is provided by the author 'as is', free of charge, without support or guarantees of any kind as to it's worthiness for use for any purpose, or reliability etc.
  • This software must NOT be placed on any public bulletin board, FTP site or other means of distribution (including diskette, tape, CD rom or any other removable computer media) without prior consent from the author.
  • The software must not be modified or reverse-engineered in any way.
  • This software is UNSUPPORTED. If you have ANY problems with it, you are on your own (sorry!). You may wish to tell me about them by e-mailing me but I do not promise to resolve them. You can also e-mail me suggestions or requests for changes if you wish, and If I have time, I may incorporate your ideas into a future release.

Scroll to Top