Gives subcommands to a streaming tape device.
tctl [ -f Device ] [ eof | weof | fsf | bsf | fsr | bsr | rewind | offline | rewoffl | erase | retension | reset | status ] [ Count ]
tctl [ -b BlockSize ] [ -f Device ] [ -p BufferSize ] [ -v ] [ -n ] [ -B ] { read | write }
The tctl command gives subcommands to a streaming tape device. If you do not specify the Device variable with the -f flag, the TAPE environment variable is used. If the environment variable does not exist, the tctl command uses the /dev/rmt0.1 device. (When the tctl command gives the status subcommand, the default device is /dev/rmt0.) The Device variable must specify a raw (not block) tape device. The Count parameter specifies the number of end-of-file markers, number of file marks, or number of records. If the Count parameter is not specified, the default count is 1.
Item | Description |
---|---|
eof or weof | Writes the number of end-of-file markers specified by the Count parameter
at the current position on the tape. On an 8 mm tape drive, an end-of-file
marker can be written in three places:
On a 9-track tape drive, the end-of-tape marker can be written at any location on the tape. However, this subcommand does not support overwriting single blocks of data. |
fsf | Moves the tape forward the number of file marks specified by the Count parameter and positions it on the end-of-tape (EOT) side of the file mark. |
bsf | Moves the tape backward the number of file marks specified by the Count parameter and positions it on the beginning-of-tape (BOT) side of the file mark. |
If the bsf subcommand moves the tape past the beginning, the tape rewinds, and the tctl command returns EIO. | |
fsr | Moves the tape forward the number of records specified by the Count parameter. |
bsr | Moves the tape backwards the number of records specified by the Count parameter. |
rewind | Rewinds the tape. The Count parameter is ignored. |
offline or rewoffl | Rewinds the tape and takes the tape drive offline. This will unload the tape when appropriate. The tape must be re-inserted before the device can be used again. |
erase | Erases all contents on the tape and rewinds it. |
read | Reads from the specified tape device (using the specified block size) until the internal buffer is full, and then writes the data to standard output, continuing to read and write this way until an end-of-file (EOF) mark is reached. |
reset | Sends a bus device reset (BDR) to the tape device. The BDR will only be sent if the device cannot be opened and is not busy. |
retension | Moves the tape to the beginning, then to the end, and then back to the beginning of the tape. If you have excessive read errors during a restore operation, you should run the retension subcommand. If the tape has been exposed to environmental extremes, you should run the retension subcommand before writing to tape. The 8 mm tape drive will not respond to this command. |
status | Prints status information about the specified tape device. |
write | Opens the tape device, reads from standard input, and writes the data to the tape device. |
Item | Description |
---|---|
-b BlockSize | Specifies, in bytes, the size of buffer used to read and write to the tape device, and also specifies, in the absence of the -n flag, the tape block size. If the block size is 0, variable-length blocks are used and the size of the tape buffer is 32,768. If the -b flag is not specified, the default block size and the size of the tape buffer is 512 bytes. |
-B | Writes the contents of the buffer each time the tape is read. Set this flag when reading variable-length records that are not of a regular and consistent size. |
-f Device | Specifies the tape device. |
-p BufferSize | Specifies the size of the buffer to be used on standard input and standard output. The default buffer size is 32,768 bytes. The BufferSize value must be a multiple of the tape block size. |
-v | Verbose. Prints the sizes of each read and write to standard error. |
-n | Specifies variable-length records when reading or writing to tape with the read or write subcommand. |
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
tctl fsf 2
cat file | tctl -v -f /dev/rmt1 -p 5120 -b 512 write
Note: The only valid block sizes for quarter-inch (QIC) tape drives are 0 and 512.
The first command moves the tape to the beginning-of-tape side of the file mark. The second command rewrites the file mark, because writing is allowed before extended file marks. The erase head of the drive erases data before the write head reaches it, so the write subroutines can write over data already in the tape. However, all old data following is lost because its file markers are meaningless.
Note: The write subroutines cannot write over a short file mark unless blank tape follows the short file mark. To write over existing data, as in the case of this example, the tape must be written with extended file marks (as specified through the SMIT interface).
Item | Description |
---|---|
/dev/rmtn | Specifies the raw streaming tape interface. |
/usr/bin/tctl | Contains the tctl command. |