Blame man4/st.4

Packit 7cfc04
.\" Copyright 1995 Robert K. Nichols (Robert.K.Nichols@att.com)
Packit 7cfc04
.\" Copyright 1999-2005 Kai Mäkisara (Kai.Makisara@kolumbus.fi)
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of this
Packit 7cfc04
.\" manual under the conditions for verbatim copying, provided that the
Packit 7cfc04
.\" entire resulting derived work is distributed under the terms of a
Packit 7cfc04
.\" permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
Packit 7cfc04
.\" responsibility for errors or omissions, or for damages resulting from
Packit 7cfc04
.\" the use of the information contained herein.  The author(s) may not
Packit 7cfc04
.\" have taken the same level of care in the production of this manual,
Packit 7cfc04
.\" which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.TH ST 4  2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
st \- SCSI tape device
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <sys/mtio.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int ioctl(int " fd ", int " request " [, (void *)" arg3 "]);"
Packit 7cfc04
.BI "int ioctl(int " fd ", MTIOCTOP, (struct mtop *)" mt_cmd );
Packit 7cfc04
.BI "int ioctl(int " fd ", MTIOCGET, (struct mtget *)" mt_status );
Packit 7cfc04
.BI "int ioctl(int " fd ", MTIOCPOS, (struct mtpos *)" mt_pos );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
.B st
Packit 7cfc04
driver provides the interface to a variety of SCSI tape devices.
Packit 7cfc04
Currently, the driver takes control of all detected devices of type
Packit 7cfc04
\(lqsequential-access\(rq.
Packit 7cfc04
The
Packit 7cfc04
.B st
Packit 7cfc04
driver uses major device number 9.
Packit 7cfc04
.PP
Packit 7cfc04
Each device uses eight minor device numbers.
Packit 7cfc04
The lowermost five bits
Packit 7cfc04
in the minor numbers are assigned sequentially in the order of
Packit 7cfc04
detection.
Packit 7cfc04
In the 2.6 kernel, the bits above the eight lowermost bits are
Packit 7cfc04
concatenated to the five lowermost bits to form the tape number.
Packit 7cfc04
The minor numbers can be grouped into
Packit 7cfc04
two sets of four numbers: the principal (auto-rewind) minor device numbers,
Packit 7cfc04
.IR n ,
Packit 7cfc04
and the \(lqno-rewind\(rq device numbers,
Packit 7cfc04
.RI ( n " + 128)."
Packit 7cfc04
Devices opened using the principal device number will be sent a
Packit 7cfc04
.BR REWIND
Packit 7cfc04
command when they are closed.
Packit 7cfc04
Devices opened using the \(lqno-rewind\(rq device number will not.
Packit 7cfc04
(Note that using an auto-rewind device for positioning the tape with,
Packit 7cfc04
for instance, mt does not lead to the desired result: the tape is
Packit 7cfc04
rewound after the mt command and the next command starts from the
Packit 7cfc04
beginning of the tape).
Packit 7cfc04
.PP
Packit 7cfc04
Within each group, four minor numbers are available to define
Packit 7cfc04
devices with different characteristics (block size, compression,
Packit 7cfc04
density, etc.)
Packit 7cfc04
When the system starts up, only the first device is available.
Packit 7cfc04
The other three are activated when the default
Packit 7cfc04
characteristics are defined (see below).
Packit 7cfc04
(By changing compile-time
Packit 7cfc04
constants, it is possible to change the balance between the maximum
Packit 7cfc04
number of tape drives and the number of minor numbers for each
Packit 7cfc04
drive.
Packit 7cfc04
The default allocation allows control of 32 tape drives.
Packit 7cfc04
For instance, it is possible to control up to 64 tape drives
Packit 7cfc04
with two minor numbers for different options.)
Packit 7cfc04
.PP
Packit 7cfc04
Devices are typically created by:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
mknod \-m 666 /dev/st0 c 9 0
Packit 7cfc04
mknod \-m 666 /dev/st0l c 9 32
Packit 7cfc04
mknod \-m 666 /dev/st0m c 9 64
Packit 7cfc04
mknod \-m 666 /dev/st0a c 9 96
Packit 7cfc04
mknod \-m 666 /dev/nst0 c 9 128
Packit 7cfc04
mknod \-m 666 /dev/nst0l c 9 160
Packit 7cfc04
mknod \-m 666 /dev/nst0m c 9 192
Packit 7cfc04
mknod \-m 666 /dev/nst0a c 9 224
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
There is no corresponding block device.
Packit 7cfc04
.PP
Packit 7cfc04
The driver uses an internal buffer that has to be large enough to hold
Packit 7cfc04
at least one tape block.
Packit 7cfc04
In kernels before 2.1.121, the buffer is
Packit 7cfc04
allocated as one contiguous block.
Packit 7cfc04
This limits the block size to the
Packit 7cfc04
largest contiguous block of memory the kernel allocator can provide.
Packit 7cfc04
The limit is currently 128\ kB for 32-bit architectures and
Packit 7cfc04
256\ kB for 64-bit architectures.
Packit 7cfc04
In newer kernels the driver
Packit 7cfc04
allocates the buffer in several parts if necessary.
Packit 7cfc04
By default, the
Packit 7cfc04
maximum number of parts is 16.
Packit 7cfc04
This means that the maximum block size
Packit 7cfc04
is very large (2\ MB if allocation of 16 blocks of 128\ kB succeeds).
Packit 7cfc04
.PP
Packit 7cfc04
The driver's internal buffer size is determined by a compile-time
Packit 7cfc04
constant which can be overridden with a kernel startup option.
Packit 7cfc04
In addition to this, the driver tries to allocate a larger temporary
Packit 7cfc04
buffer at run time if necessary.
Packit 7cfc04
However, run-time allocation of large
Packit 7cfc04
contiguous blocks of memory may fail and it is advisable not to rely
Packit 7cfc04
too much on dynamic buffer allocation with kernels older than 2.1.121
Packit 7cfc04
(this applies also to demand-loading the driver with kerneld or kmod).
Packit 7cfc04
.PP
Packit 7cfc04
The driver does not specifically support any tape drive brand or
Packit 7cfc04
model.
Packit 7cfc04
After system start-up the tape device options are defined by
Packit 7cfc04
the drive firmware.
Packit 7cfc04
For example, if the drive firmware selects fixed-block mode,
Packit 7cfc04
the tape device uses fixed-block mode.
Packit 7cfc04
The options can
Packit 7cfc04
be changed with explicit
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
calls and remain in effect when the device is closed and reopened.
Packit 7cfc04
Setting the options affects both the auto-rewind and the nonrewind
Packit 7cfc04
device.
Packit 7cfc04
.PP
Packit 7cfc04
Different options can be specified for the different devices within
Packit 7cfc04
the subgroup of four.
Packit 7cfc04
The options take effect when the device is
Packit 7cfc04
opened.
Packit 7cfc04
For example, the system administrator can define
Packit 7cfc04
one device that writes in fixed-block mode with a certain block size,
Packit 7cfc04
and one which writes in variable-block mode (if the drive supports
Packit 7cfc04
both modes).
Packit 7cfc04
.PP
Packit 7cfc04
The driver supports
Packit 7cfc04
.B tape partitions
Packit 7cfc04
if they are supported by the drive.
Packit 7cfc04
(Note that the tape partitions
Packit 7cfc04
have nothing to do with disk partitions.
Packit 7cfc04
A partitioned tape can be
Packit 7cfc04
seen as several logical tapes within one medium.)
Packit 7cfc04
Partition support has to be enabled with an
Packit 7cfc04
.BR ioctl (2).
Packit 7cfc04
The tape
Packit 7cfc04
location is preserved within each partition across partition changes.
Packit 7cfc04
The partition used for subsequent tape operations is
Packit 7cfc04
selected with an
Packit 7cfc04
.BR ioctl (2).
Packit 7cfc04
The partition switch is executed together with
Packit 7cfc04
the next tape operation in order to avoid unnecessary tape
Packit 7cfc04
movement.
Packit 7cfc04
The maximum number of partitions on a tape is defined by a
Packit 7cfc04
compile-time constant (originally four).
Packit 7cfc04
The driver contains an
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
that can format a tape with either one or two partitions.
Packit 7cfc04
.PP
Packit 7cfc04
Device
Packit 7cfc04
.I /dev/tape
Packit 7cfc04
is usually created as a hard or soft link to the default tape device
Packit 7cfc04
on the system.
Packit 7cfc04
.PP
Packit 7cfc04
Starting from kernel 2.6.2, the driver exports in the sysfs directory
Packit 7cfc04
.I /sys/class/scsi_tape
Packit 7cfc04
the attached devices and some parameters assigned to the devices.
Packit 7cfc04
.SS Data transfer
Packit 7cfc04
The driver supports operation in both fixed-block mode and
Packit 7cfc04
variable-block mode (if supported by the drive).
Packit 7cfc04
In fixed-block mode the drive
Packit 7cfc04
writes blocks of the specified size and the block size is not
Packit 7cfc04
dependent on the byte counts of the write system calls.
Packit 7cfc04
In variable-block mode one tape block is written for each write call
Packit 7cfc04
and the byte
Packit 7cfc04
count determines the size of the corresponding tape block.
Packit 7cfc04
Note that
Packit 7cfc04
the blocks on the tape don't contain any information about the
Packit 7cfc04
writing mode: when reading, the only important thing is to use
Packit 7cfc04
commands that accept the block sizes on the tape.
Packit 7cfc04
.PP
Packit 7cfc04
In variable-block mode the read byte count does not have to match
Packit 7cfc04
the tape block size exactly.
Packit 7cfc04
If the byte count is larger than the
Packit 7cfc04
next block on tape, the driver returns the data and the function
Packit 7cfc04
returns the actual block size.
Packit 7cfc04
If the block size is larger than the
Packit 7cfc04
byte count, an error is returned.
Packit 7cfc04
.PP
Packit 7cfc04
In fixed-block mode the read byte counts can be arbitrary if
Packit 7cfc04
buffering is enabled, or a multiple of the tape block size if
Packit 7cfc04
buffering is disabled.
Packit 7cfc04
Kernels before 2.1.121 allow writes with
Packit 7cfc04
arbitrary byte count if buffering is enabled.
Packit 7cfc04
In all other cases
Packit 7cfc04
(kernel before 2.1.121 with buffering disabled or newer kernel) the
Packit 7cfc04
write byte count must be a multiple of the tape block size.
Packit 7cfc04
.PP
Packit 7cfc04
In the 2.6 kernel, the driver tries to use direct transfers between the user
Packit 7cfc04
buffer and the device.
Packit 7cfc04
If this is not possible, the driver's internal buffer
Packit 7cfc04
is used.
Packit 7cfc04
The reasons for not using direct transfers include improper alignment
Packit 7cfc04
of the user buffer (default is 512 bytes but this can be changed by the HBA
Packit 7cfc04
driver), one or more pages of the user buffer not reachable by the
Packit 7cfc04
SCSI adapter, and so on.
Packit 7cfc04
.PP
Packit 7cfc04
A filemark is automatically written to tape if the last tape operation
Packit 7cfc04
before close was a write.
Packit 7cfc04
.PP
Packit 7cfc04
When a filemark is encountered while reading, the following
Packit 7cfc04
happens.
Packit 7cfc04
If there are data remaining in the buffer when the filemark
Packit 7cfc04
is found, the buffered data is returned.
Packit 7cfc04
The next read returns zero
Packit 7cfc04
bytes.
Packit 7cfc04
The following read returns data from the next file.
Packit 7cfc04
The end of
Packit 7cfc04
recorded data is signaled by returning zero bytes for two consecutive
Packit 7cfc04
read calls.
Packit 7cfc04
The third read returns an error.
Packit 7cfc04
.SS Ioctls
Packit 7cfc04
The driver supports three
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
requests.
Packit 7cfc04
Requests not recognized by the
Packit 7cfc04
.B st
Packit 7cfc04
driver are passed to the
Packit 7cfc04
.B SCSI
Packit 7cfc04
driver.
Packit 7cfc04
The definitions below are from
Packit 7cfc04
.IR /usr/include/linux/mtio.h :
Packit 7cfc04
.SS MTIOCTOP \(em perform a tape operation
Packit 7cfc04
.PP
Packit 7cfc04
This request takes an argument of type
Packit 7cfc04
.IR "(struct mtop\ *)" .
Packit 7cfc04
Not all drives support all operations.
Packit 7cfc04
The driver returns an
Packit 7cfc04
.B EIO
Packit 7cfc04
error if the drive rejects an operation.
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
/* Structure for MTIOCTOP \- mag tape op command: */
Packit 7cfc04
struct mtop {
Packit 7cfc04
    short   mt_op;       /* operations defined below */
Packit 7cfc04
    int     mt_count;    /* how many of them */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
Magnetic Tape operations for normal tape use:
Packit 7cfc04
.TP 14
Packit 7cfc04
.B MTBSF
Packit 7cfc04
Backward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
filemarks.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTBSFM
Packit 7cfc04
Backward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
filemarks.
Packit 7cfc04
Reposition the tape to the EOT side of the last filemark.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTBSR
Packit 7cfc04
Backward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
records (tape blocks).
Packit 7cfc04
.TP
Packit 7cfc04
.B MTBSS
Packit 7cfc04
Backward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
setmarks.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTCOMPRESSION
Packit 7cfc04
Enable compression of tape data within the drive if
Packit 7cfc04
.I mt_count
Packit 7cfc04
is nonzero and disable compression if
Packit 7cfc04
.I mt_count
Packit 7cfc04
is zero.
Packit 7cfc04
This command uses the MODE page 15 supported by most DATs.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTEOM
Packit 7cfc04
Go to the end of the recorded media (for appending files).
Packit 7cfc04
.TP
Packit 7cfc04
.B MTERASE
Packit 7cfc04
Erase tape.
Packit 7cfc04
With 2.6 kernel, short erase (mark tape empty) is performed if the
Packit 7cfc04
argument is zero.
Packit 7cfc04
Otherwise, long erase (erase all) is done.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTFSF
Packit 7cfc04
Forward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
filemarks.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTFSFM
Packit 7cfc04
Forward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
filemarks.
Packit 7cfc04
Reposition the tape to the BOT side of the last filemark.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTFSR
Packit 7cfc04
Forward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
records (tape blocks).
Packit 7cfc04
.TP
Packit 7cfc04
.B MTFSS
Packit 7cfc04
Forward space over
Packit 7cfc04
.I mt_count
Packit 7cfc04
setmarks.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTLOAD
Packit 7cfc04
Execute the SCSI load command.
Packit 7cfc04
A special case is available for some HP
Packit 7cfc04
autoloaders.
Packit 7cfc04
If
Packit 7cfc04
.I mt_count
Packit 7cfc04
is the constant
Packit 7cfc04
.B MT_ST_HPLOADER_OFFSET
Packit 7cfc04
plus a number, the number is
Packit 7cfc04
sent to the drive to control the autoloader.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTLOCK
Packit 7cfc04
Lock the tape drive door.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTMKPART
Packit 7cfc04
Format the tape into one or two partitions.
Packit 7cfc04
If
Packit 7cfc04
.I mt_count
Packit 7cfc04
is positive, it gives the size of partition 1 and partition
Packit 7cfc04
0 contains the rest of the tape.
Packit 7cfc04
If
Packit 7cfc04
.I mt_count
Packit 7cfc04
is zero, the tape is formatted into one partition.
Packit 7cfc04
From kernel version 4.6,
Packit 7cfc04
.\" commit 8038e6456a3e6f5c4759e0d73c4f9165b90c93e7
Packit 7cfc04
a negative
Packit 7cfc04
.I mt_count
Packit 7cfc04
specifies the size of partition 0 and
Packit 7cfc04
the rest of the tape contains partition 1.
Packit 7cfc04
The physical ordering of partitions depends on the drive.
Packit 7cfc04
This command is not allowed for a drive unless the partition support
Packit 7cfc04
is enabled for the drive (see
Packit 7cfc04
.BR MT_ST_CAN_PARTITIONS
Packit 7cfc04
below).
Packit 7cfc04
.TP
Packit 7cfc04
.B MTNOP
Packit 7cfc04
No op\(emflushes the driver's buffer as a side effect.
Packit 7cfc04
Should be used before reading status with
Packit 7cfc04
.BR MTIOCGET .
Packit 7cfc04
.TP
Packit 7cfc04
.B MTOFFL
Packit 7cfc04
Rewind and put the drive off line.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTRESET
Packit 7cfc04
Reset drive.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTRETEN
Packit 7cfc04
Re-tension tape.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTREW
Packit 7cfc04
Rewind.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTSEEK
Packit 7cfc04
Seek to the tape block number specified in
Packit 7cfc04
.IR mt_count .
Packit 7cfc04
This operation requires either a SCSI-2 drive that supports the
Packit 7cfc04
.B LOCATE
Packit 7cfc04
command (device-specific address)
Packit 7cfc04
or a Tandberg-compatible SCSI-1 drive (Tandberg, Archive
Packit 7cfc04
Viper, Wangtek, ...).
Packit 7cfc04
The block number should be one that was previously returned by
Packit 7cfc04
.BR MTIOCPOS
Packit 7cfc04
if device-specific addresses are used.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTSETBLK
Packit 7cfc04
Set the drive's block length to the value specified in
Packit 7cfc04
.IR mt_count .
Packit 7cfc04
A block length of zero sets the drive to variable block size mode.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTSETDENSITY
Packit 7cfc04
Set the tape density to the code in
Packit 7cfc04
.IR mt_count .
Packit 7cfc04
The density codes supported by a drive can be found from the drive
Packit 7cfc04
documentation.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTSETPART
Packit 7cfc04
The active partition is switched to
Packit 7cfc04
.IR mt_count .
Packit 7cfc04
The partitions are numbered from zero.
Packit 7cfc04
This command is not allowed for
Packit 7cfc04
a drive unless the partition support is enabled for the drive (see
Packit 7cfc04
.B MT_ST_CAN_PARTITIONS
Packit 7cfc04
below).
Packit 7cfc04
.TP
Packit 7cfc04
.B MTUNLOAD
Packit 7cfc04
Execute the SCSI unload command (does not eject the tape).
Packit 7cfc04
.TP
Packit 7cfc04
.B MTUNLOCK
Packit 7cfc04
Unlock the tape drive door.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTWEOF
Packit 7cfc04
Write
Packit 7cfc04
.I mt_count
Packit 7cfc04
filemarks.
Packit 7cfc04
.TP
Packit 7cfc04
.B MTWSM
Packit 7cfc04
Write
Packit 7cfc04
.I mt_count
Packit 7cfc04
setmarks.
Packit 7cfc04
.PP
Packit 7cfc04
Magnetic Tape operations for setting of device options (by the superuser):
Packit 7cfc04
.TP 8
Packit 7cfc04
.B MTSETDRVBUFFER
Packit 7cfc04
Set various drive and driver options according to bits encoded in
Packit 7cfc04
.IR mt_count .
Packit 7cfc04
These consist of the drive's buffering mode, a set of Boolean driver
Packit 7cfc04
options, the buffer write threshold, defaults for the block size and
Packit 7cfc04
density, and timeouts (only in kernels 2.1 and later).
Packit 7cfc04
A single operation can affect only one item in the list above (the
Packit 7cfc04
Booleans counted as one item.)
Packit 7cfc04
.IP
Packit 7cfc04
A value having zeros in the high-order 4 bits will be used to set the
Packit 7cfc04
drive's buffering mode.
Packit 7cfc04
The buffering modes are:
Packit 7cfc04
.RS 12
Packit 7cfc04
.IP 0 4
Packit 7cfc04
The drive will not report
Packit 7cfc04
.BR GOOD
Packit 7cfc04
status on write commands until the data
Packit 7cfc04
blocks are actually written to the medium.
Packit 7cfc04
.IP 1
Packit 7cfc04
The drive may report
Packit 7cfc04
.BR GOOD
Packit 7cfc04
status on write commands as soon as all the
Packit 7cfc04
data has been transferred to the drive's internal buffer.
Packit 7cfc04
.IP 2
Packit 7cfc04
The drive may report
Packit 7cfc04
.BR GOOD
Packit 7cfc04
status on write commands as soon as (a) all
Packit 7cfc04
the data has been transferred to the drive's internal buffer, and
Packit 7cfc04
(b) all buffered data from different initiators has been successfully
Packit 7cfc04
written to the medium.
Packit 7cfc04
.RE
Packit 7cfc04
.IP
Packit 7cfc04
To control the write threshold the value in
Packit 7cfc04
.I mt_count
Packit 7cfc04
must include the constant
Packit 7cfc04
.BR MT_ST_WRITE_THRESHOLD
Packit 7cfc04
bitwise ORed with a block count in the low 28 bits.
Packit 7cfc04
The block count refers to 1024-byte blocks, not the physical block
Packit 7cfc04
size on the tape.
Packit 7cfc04
The threshold cannot exceed the driver's internal buffer size (see
Packit 7cfc04
DESCRIPTION, above).
Packit 7cfc04
.IP
Packit 7cfc04
To set and clear the Boolean options
Packit 7cfc04
the value in
Packit 7cfc04
.I mt_count
Packit 7cfc04
must include one of the constants
Packit 7cfc04
.BR MT_ST_BOOLEANS ,
Packit 7cfc04
.BR MT_ST_SETBOOLEANS ,
Packit 7cfc04
.BR MT_ST_CLEARBOOLEANS ,
Packit 7cfc04
or
Packit 7cfc04
.BR MT_ST_DEFBOOLEANS
Packit 7cfc04
bitwise ORed with
Packit 7cfc04
whatever combination of the following options is desired.
Packit 7cfc04
Using
Packit 7cfc04
.BR MT_ST_BOOLEANS
Packit 7cfc04
the options can be set to the values
Packit 7cfc04
defined in the corresponding bits.
Packit 7cfc04
With
Packit 7cfc04
.BR MT_ST_SETBOOLEANS
Packit 7cfc04
the options can be selectively set and with
Packit 7cfc04
.BR MT_ST_DEFBOOLEANS
Packit 7cfc04
selectively cleared.
Packit 7cfc04
.IP ""
Packit 7cfc04
The default options for a tape device are set with
Packit 7cfc04
.BR MT_ST_DEFBOOLEANS .
Packit 7cfc04
A nonactive tape device (e.g., device with
Packit 7cfc04
minor 32 or 160) is activated when the default options for it are
Packit 7cfc04
defined the first time.
Packit 7cfc04
An activated device inherits from the device
Packit 7cfc04
activated at start-up the options not set explicitly.
Packit 7cfc04
.IP ""
Packit 7cfc04
The Boolean options are:
Packit 7cfc04
.RS
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_BUFFER_WRITES " (Default: true)"
Packit 7cfc04
Buffer all write operations in fixed-block mode.
Packit 7cfc04
If this option is false and the drive uses a fixed block size, then
Packit 7cfc04
all write operations must be for a multiple of the block size.
Packit 7cfc04
This option must be set false to write reliable multivolume archives.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_ASYNC_WRITES " (Default: true)"
Packit 7cfc04
When this option is true, write operations return immediately without
Packit 7cfc04
waiting for the data to be transferred to the drive if the data fits
Packit 7cfc04
into the driver's buffer.
Packit 7cfc04
The write threshold determines how full the buffer must be before a
Packit 7cfc04
new SCSI write command is issued.
Packit 7cfc04
Any errors reported by the drive will be held until the next
Packit 7cfc04
operation.
Packit 7cfc04
This option must be set false to write reliable multivolume archives.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_READ_AHEAD " (Default: true)"
Packit 7cfc04
This option causes the driver to provide read buffering and
Packit 7cfc04
read-ahead in fixed-block mode.
Packit 7cfc04
If this option is false and the drive uses a fixed block size, then
Packit 7cfc04
all read operations must be for a multiple of the block size.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_TWO_FM " (Default: false)"
Packit 7cfc04
This option modifies the driver behavior when a file is closed.
Packit 7cfc04
The normal action is to write a single filemark.
Packit 7cfc04
If the option is true, the driver will write two filemarks and
Packit 7cfc04
backspace over the second one.
Packit 7cfc04
.IP
Packit 7cfc04
Note:
Packit 7cfc04
This option should not be set true for QIC tape drives since they are
Packit 7cfc04
unable to overwrite a filemark.
Packit 7cfc04
These drives detect the end of recorded data by testing for blank tape
Packit 7cfc04
rather than two consecutive filemarks.
Packit 7cfc04
Most other current drives also
Packit 7cfc04
detect the end of recorded data and using two filemarks is usually
Packit 7cfc04
necessary only when interchanging tapes with some other systems.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_DEBUGGING " (Default: false)"
Packit 7cfc04
This option turns on various debugging messages from the driver
Packit 7cfc04
(effective only if the driver was compiled with
Packit 7cfc04
.B DEBUG
Packit 7cfc04
defined nonzero).
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_FAST_EOM " (Default: false)"
Packit 7cfc04
This option causes the
Packit 7cfc04
.B MTEOM
Packit 7cfc04
operation to be sent directly to the
Packit 7cfc04
drive, potentially speeding up the operation but causing the driver to
Packit 7cfc04
lose track of the current file number normally returned by the
Packit 7cfc04
.B MTIOCGET
Packit 7cfc04
request.
Packit 7cfc04
If
Packit 7cfc04
.B MT_ST_FAST_EOM
Packit 7cfc04
is false, the driver will respond to an
Packit 7cfc04
.B MTEOM
Packit 7cfc04
request by forward spacing over files.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_AUTO_LOCK " (Default: false)"
Packit 7cfc04
When this option is true, the drive door is locked when the device is
Packit 7cfc04
opened and unlocked when it is closed.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_DEF_WRITES " (Default: false)"
Packit 7cfc04
The tape options (block size, mode, compression, etc.) may change
Packit 7cfc04
when changing from one device linked to a drive to another device
Packit 7cfc04
linked to the same drive depending on how the devices are
Packit 7cfc04
defined.
Packit 7cfc04
This option defines when the changes are enforced by the
Packit 7cfc04
driver using SCSI-commands and when the drives auto-detection
Packit 7cfc04
capabilities are relied upon.
Packit 7cfc04
If this option is false, the driver
Packit 7cfc04
sends the SCSI-commands immediately when the device is changed.
Packit 7cfc04
If the
Packit 7cfc04
option is true, the SCSI-commands are not sent until a write is
Packit 7cfc04
requested.
Packit 7cfc04
In this case, the drive firmware is allowed to detect the
Packit 7cfc04
tape structure when reading and the SCSI-commands are used only to
Packit 7cfc04
make sure that a tape is written according to the correct specification.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_CAN_BSR " (Default: false)"
Packit 7cfc04
When read-ahead is used, the tape must sometimes be spaced backward to the
Packit 7cfc04
correct position when the device is closed and the SCSI command to
Packit 7cfc04
space backward over records is used for this purpose.
Packit 7cfc04
Some older
Packit 7cfc04
drives can't process this command reliably and this option can be used
Packit 7cfc04
to instruct the driver not to use the command.
Packit 7cfc04
The end result is that,
Packit 7cfc04
with read-ahead and fixed-block mode, the tape may not be correctly
Packit 7cfc04
positioned within a file when the device is closed.
Packit 7cfc04
With 2.6 kernel, the
Packit 7cfc04
default is true for drives supporting SCSI-3.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_NO_BLKLIMS " (Default: false)"
Packit 7cfc04
Some drives don't accept the
Packit 7cfc04
.B "READ BLOCK LIMITS"
Packit 7cfc04
SCSI command.
Packit 7cfc04
If this is used, the driver does not use the command.
Packit 7cfc04
The drawback is
Packit 7cfc04
that the driver can't check before sending commands if the selected
Packit 7cfc04
block size is acceptable to the drive.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_CAN_PARTITIONS " (Default: false)"
Packit 7cfc04
This option enables support for several partitions within a
Packit 7cfc04
tape.
Packit 7cfc04
The option applies to all devices linked to a drive.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_SCSI2LOGICAL " (Default: false)"
Packit 7cfc04
This option instructs the driver to use the logical block addresses
Packit 7cfc04
defined in the SCSI-2 standard when performing the seek and tell
Packit 7cfc04
operations (both with
Packit 7cfc04
.B MTSEEK
Packit 7cfc04
and
Packit 7cfc04
.B MTIOCPOS
Packit 7cfc04
commands and when changing tape
Packit 7cfc04
partition).
Packit 7cfc04
Otherwise, the device-specific addresses are used.
Packit 7cfc04
It is highly advisable to set this option if the drive supports the
Packit 7cfc04
logical addresses because they count also filemarks.
Packit 7cfc04
There are some
Packit 7cfc04
drives that support only the logical block addresses.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_ST_SYSV " (Default: false)"
Packit 7cfc04
When this option is enabled, the tape devices use the SystemV
Packit 7cfc04
semantics.
Packit 7cfc04
Otherwise, the BSD semantics are used.
Packit 7cfc04
The most important
Packit 7cfc04
difference between the semantics is what happens when a device used
Packit 7cfc04
for reading is closed: in System V semantics the tape is spaced forward
Packit 7cfc04
past the next filemark if this has not happened while using the
Packit 7cfc04
device.
Packit 7cfc04
In BSD semantics the tape position is not changed.
Packit 7cfc04
.TP
Packit 7cfc04
.BR MT_NO_WAIT " (Default: false)"
Packit 7cfc04
Enables immediate mode (i.e., don't wait for the command to finish) for some
Packit 7cfc04
commands (e.g., rewind).
Packit 7cfc04
.PP
Packit 7cfc04
An example:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct mtop mt_cmd;
Packit 7cfc04
mt_cmd.mt_op = MTSETDRVBUFFER;
Packit 7cfc04
mt_cmd.mt_count = MT_ST_BOOLEANS |
Packit 7cfc04
        MT_ST_BUFFER_WRITES | MT_ST_ASYNC_WRITES;
Packit 7cfc04
ioctl(fd, MTIOCTOP, mt_cmd);
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.RE
Packit 7cfc04
.IP ""
Packit 7cfc04
The default block size for a device can be set with
Packit 7cfc04
.B MT_ST_DEF_BLKSIZE
Packit 7cfc04
and the default density code can be set with
Packit 7cfc04
.BR MT_ST_DEFDENSITY .
Packit 7cfc04
The values for the parameters are or'ed
Packit 7cfc04
with the operation code.
Packit 7cfc04
.IP ""
Packit 7cfc04
With kernels 2.1.x and later, the timeout values can be set with the
Packit 7cfc04
subcommand
Packit 7cfc04
.B MT_ST_SET_TIMEOUT
Packit 7cfc04
ORed with the timeout in seconds.
Packit 7cfc04
The long timeout (used for rewinds and other commands
Packit 7cfc04
that may take a long time) can be set with
Packit 7cfc04
.BR MT_ST_SET_LONG_TIMEOUT .
Packit 7cfc04
The kernel defaults are very long to
Packit 7cfc04
make sure that a successful command is not timed out with any
Packit 7cfc04
drive.
Packit 7cfc04
Because of this, the driver may seem stuck even if it is only
Packit 7cfc04
waiting for the timeout.
Packit 7cfc04
These commands can be used to set more
Packit 7cfc04
practical values for a specific drive.
Packit 7cfc04
The timeouts set for one device
Packit 7cfc04
apply for all devices linked to the same drive.
Packit 7cfc04
.IP ""
Packit 7cfc04
Starting from kernels 2.4.19 and 2.5.43, the driver supports a status
Packit 7cfc04
bit which indicates whether the drive requests cleaning.
Packit 7cfc04
The method used by the
Packit 7cfc04
drive to return cleaning information is set using the
Packit 7cfc04
.B MT_ST_SEL_CLN
Packit 7cfc04
subcommand.
Packit 7cfc04
If the value is zero, the cleaning
Packit 7cfc04
bit is always zero.
Packit 7cfc04
If the value is one, the TapeAlert data defined
Packit 7cfc04
in the SCSI-3 standard is used (not yet implemented).
Packit 7cfc04
Values 2\(en17 are
Packit 7cfc04
reserved.
Packit 7cfc04
If the lowest eight bits are >= 18, bits from the extended
Packit 7cfc04
sense data are used.
Packit 7cfc04
The bits 9\(en16 specify a mask to select the bits
Packit 7cfc04
to look at and the bits 17\(en23 specify the bit pattern to look for.
Packit 7cfc04
If the bit pattern is zero, one or more bits under the mask indicate
Packit 7cfc04
the cleaning request.
Packit 7cfc04
If the pattern is nonzero, the pattern must match
Packit 7cfc04
the masked sense data byte.
Packit 7cfc04
.SS MTIOCGET \(em get status
Packit 7cfc04
.PP
Packit 7cfc04
This request takes an argument of type
Packit 7cfc04
.IR "(struct mtget\ *)" .
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
/* structure for MTIOCGET \- mag tape get status command */
Packit 7cfc04
struct mtget {
Packit 7cfc04
    long     mt_type;
Packit 7cfc04
    long     mt_resid;
Packit 7cfc04
    /* the following registers are device dependent */
Packit 7cfc04
    long     mt_dsreg;
Packit 7cfc04
    long     mt_gstat;
Packit 7cfc04
    long     mt_erreg;
Packit 7cfc04
    /* The next two fields are not always used */
Packit 7cfc04
    daddr_t  mt_fileno;
Packit 7cfc04
    daddr_t  mt_blkno;
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.IP \fImt_type\fP 11
Packit 7cfc04
The header file defines many values for
Packit 7cfc04
.IR mt_type ,
Packit 7cfc04
but the current driver reports only the generic types
Packit 7cfc04
.B MT_ISSCSI1
Packit 7cfc04
(Generic SCSI-1 tape)
Packit 7cfc04
and
Packit 7cfc04
.B MT_ISSCSI2
Packit 7cfc04
(Generic SCSI-2 tape).
Packit 7cfc04
.IP \fImt_resid\fP
Packit 7cfc04
contains the current tape partition number.
Packit 7cfc04
.IP \fImt_dsreg\fP
Packit 7cfc04
reports the drive's current settings for block size (in the low 24
Packit 7cfc04
bits) and density (in the high 8 bits).
Packit 7cfc04
These fields are defined by
Packit 7cfc04
.BR MT_ST_BLKSIZE_SHIFT ,
Packit 7cfc04
.BR MT_ST_BLKSIZE_MASK ,
Packit 7cfc04
.BR MT_ST_DENSITY_SHIFT ,
Packit 7cfc04
and
Packit 7cfc04
.BR MT_ST_DENSITY_MASK .
Packit 7cfc04
.IP \fImt_gstat\fP
Packit 7cfc04
reports generic (device independent) status information.
Packit 7cfc04
The header file defines macros for testing these status bits:
Packit 7cfc04
.RS
Packit 7cfc04
.HP 4
Packit 7cfc04
\fBGMT_EOF\fP(\fIx\fP):
Packit 7cfc04
The tape is positioned just after a filemark
Packit 7cfc04
(always false after an
Packit 7cfc04
.B MTSEEK
Packit 7cfc04
operation).
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_BOT\fP(\fIx\fP):
Packit 7cfc04
The tape is positioned at the beginning of the first file (always false
Packit 7cfc04
after an
Packit 7cfc04
.B MTSEEK
Packit 7cfc04
operation).
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_EOT\fP(\fIx\fP):
Packit 7cfc04
A tape operation has reached the physical End Of Tape.
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_SM\fP(\fIx\fP):
Packit 7cfc04
The tape is currently positioned at a setmark
Packit 7cfc04
(always false after an
Packit 7cfc04
.B MTSEEK
Packit 7cfc04
operation).
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_EOD\fP(\fIx\fP):
Packit 7cfc04
The tape is positioned at the end of recorded data.
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_WR_PROT\fP(\fIx\fP):
Packit 7cfc04
The drive is write-protected.
Packit 7cfc04
For some drives this can also mean that the drive does not support
Packit 7cfc04
writing on the current medium type.
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_ONLINE\fP(\fIx\fP):
Packit 7cfc04
The last
Packit 7cfc04
.BR open (2)
Packit 7cfc04
found the drive with a tape in place and ready for operation.
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_D_6250\fP(\fIx\fP), \fBGMT_D_1600\fP(\fIx\fP), \fBGMT_D_800\fP(\fIx\fP):
Packit 7cfc04
This \(lqgeneric\(rq status information reports the current
Packit 7cfc04
density setting for 9-track \(12" tape drives only.
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_DR_OPEN\fP(\fIx\fP):
Packit 7cfc04
The drive does not have a tape in place.
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_IM_REP_EN\fP(\fIx\fP):
Packit 7cfc04
Immediate report mode.
Packit 7cfc04
This bit is set if there are no guarantees that
Packit 7cfc04
the data has been physically written to the tape when the write call
Packit 7cfc04
returns.
Packit 7cfc04
It is set zero only when the driver does not buffer data and
Packit 7cfc04
the drive is set not to buffer data.
Packit 7cfc04
.HP
Packit 7cfc04
\fBGMT_CLN\fP(\fIx\fP):
Packit 7cfc04
The drive has requested cleaning.
Packit 7cfc04
Implemented in kernels since 2.4.19 and 2.5.43.
Packit 7cfc04
.RE
Packit 7cfc04
.IP \fImt_erreg\fP
Packit 7cfc04
The only field defined in
Packit 7cfc04
.I mt_erreg
Packit 7cfc04
is the recovered error count in the low 16 bits (as defined by
Packit 7cfc04
.BR MT_ST_SOFTERR_SHIFT
Packit 7cfc04
and
Packit 7cfc04
.BR MT_ST_SOFTERR_MASK .
Packit 7cfc04
Due to inconsistencies in the way drives report recovered errors, this
Packit 7cfc04
count is often not maintained (most drives do not by default report
Packit 7cfc04
soft errors but this can be changed with a SCSI MODE SELECT command).
Packit 7cfc04
.IP \fImt_fileno\fP
Packit 7cfc04
reports the current file number (zero-based).
Packit 7cfc04
This value is set to \-1 when the file number is unknown (e.g., after
Packit 7cfc04
.BR MTBSS
Packit 7cfc04
or
Packit 7cfc04
.BR MTSEEK ).
Packit 7cfc04
.IP \fImt_blkno\fP
Packit 7cfc04
reports the block number (zero-based) within the current file.
Packit 7cfc04
This value is set to \-1 when the block number is unknown (e.g., after
Packit 7cfc04
.BR MTBSF ,
Packit 7cfc04
.BR MTBSS ,
Packit 7cfc04
or
Packit 7cfc04
.BR MTSEEK ).
Packit 7cfc04
.SS MTIOCPOS \(em get tape position
Packit 7cfc04
.PP
Packit 7cfc04
This request takes an argument of type
Packit 7cfc04
.I "(struct mtpos\ *)"
Packit 7cfc04
and reports the drive's notion of the current tape block number,
Packit 7cfc04
which is not the same as
Packit 7cfc04
.I mt_blkno
Packit 7cfc04
returned by
Packit 7cfc04
.BR MTIOCGET .
Packit 7cfc04
This drive must be a SCSI-2 drive that supports the
Packit 7cfc04
.B "READ POSITION"
Packit 7cfc04
command (device-specific address)
Packit 7cfc04
or a Tandberg-compatible SCSI-1 drive (Tandberg, Archive
Packit 7cfc04
Viper, Wangtek, ... ).
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
/* structure for MTIOCPOS \- mag tape get position command */
Packit 7cfc04
struct mtpos {
Packit 7cfc04
    long mt_blkno;    /* current block number */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
.TP 14
Packit 7cfc04
.TP
Packit 7cfc04
.B EACCES
Packit 7cfc04
An attempt was made to write or erase a write-protected tape.
Packit 7cfc04
(This error is not detected during
Packit 7cfc04
.BR open (2).)
Packit 7cfc04
.TP
Packit 7cfc04
.B EBUSY
Packit 7cfc04
The device is already in use or the driver was unable to allocate a
Packit 7cfc04
buffer.
Packit 7cfc04
.TP
Packit 7cfc04
.B EFAULT
Packit 7cfc04
The command parameters point to memory not belonging to the calling
Packit 7cfc04
process.
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
An
Packit 7cfc04
.BR ioctl (2)
Packit 7cfc04
had an invalid argument, or a requested block size was invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B EIO
Packit 7cfc04
The requested operation could not be completed.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOMEM
Packit 7cfc04
The byte count in
Packit 7cfc04
.BR read (2)
Packit 7cfc04
is smaller than the next physical block on the tape.
Packit 7cfc04
(Before 2.2.18 and 2.4.0-test6 the extra bytes have been
Packit 7cfc04
silently ignored.)
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOSPC
Packit 7cfc04
A write operation could not be completed because the tape reached
Packit 7cfc04
end-of-medium.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOSYS
Packit 7cfc04
Unknown
Packit 7cfc04
.BR ioctl (2).
Packit 7cfc04
.TP
Packit 7cfc04
.B ENXIO
Packit 7cfc04
During opening, the tape device does not exist.
Packit 7cfc04
.TP
Packit 7cfc04
.B EOVERFLOW
Packit 7cfc04
An attempt was made to read or write a variable-length block that is
Packit 7cfc04
larger than the driver's internal buffer.
Packit 7cfc04
.TP
Packit 7cfc04
.B EROFS
Packit 7cfc04
Open is attempted with
Packit 7cfc04
.B O_WRONLY
Packit 7cfc04
or
Packit 7cfc04
.B O_RDWR
Packit 7cfc04
when the tape in the drive is write-protected.
Packit 7cfc04
.SH FILES
Packit 7cfc04
.TP
Packit 7cfc04
.I /dev/st*
Packit 7cfc04
the auto-rewind SCSI tape devices
Packit 7cfc04
.TP
Packit 7cfc04
.I /dev/nst*
Packit 7cfc04
the nonrewind SCSI tape devices
Packit 7cfc04
.\" .SH AUTHOR
Packit 7cfc04
.\" The driver has been written by Kai M\(:akisara (Kai.Makisara@metla.fi)
Packit 7cfc04
.\" starting from a driver written by Dwayne Forsyth.
Packit 7cfc04
.\" Several other
Packit 7cfc04
.\" people have also contributed to the driver.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
.IP 1. 4
Packit 7cfc04
When exchanging data between systems, both systems have to agree on
Packit 7cfc04
the physical tape block size.
Packit 7cfc04
The parameters of a drive after startup
Packit 7cfc04
are often not the ones most operating systems use with these
Packit 7cfc04
devices.
Packit 7cfc04
Most systems use drives in variable-block mode if the drive
Packit 7cfc04
supports that mode.
Packit 7cfc04
This applies to most modern drives, including
Packit 7cfc04
DATs, 8mm helical scan drives, DLTs, etc.
Packit 7cfc04
It may be advisable to use
Packit 7cfc04
these drives in variable-block mode also in Linux (i.e., use
Packit 7cfc04
.B MTSETBLK
Packit 7cfc04
or
Packit 7cfc04
.B MTSETDEFBLK
Packit 7cfc04
at system startup to set the mode), at least when
Packit 7cfc04
exchanging data with a foreign system.
Packit 7cfc04
The drawback of
Packit 7cfc04
this is that a fairly large tape block size has to be used to get
Packit 7cfc04
acceptable data transfer rates on the SCSI bus.
Packit 7cfc04
.IP 2.
Packit 7cfc04
Many programs (e.g.,
Packit 7cfc04
.BR tar (1))
Packit 7cfc04
allow the user to specify the blocking
Packit 7cfc04
factor on the command line.
Packit 7cfc04
Note that this determines the physical block
Packit 7cfc04
size on tape only in variable-block mode.
Packit 7cfc04
.IP 3.
Packit 7cfc04
In order to use SCSI tape drives, the basic SCSI driver,
Packit 7cfc04
a SCSI-adapter driver and the SCSI tape driver must be either
Packit 7cfc04
configured into the kernel or loaded as modules.
Packit 7cfc04
If the SCSI-tape
Packit 7cfc04
driver is not present, the drive is recognized but the tape support
Packit 7cfc04
described in this page is not available.
Packit 7cfc04
.IP 4.
Packit 7cfc04
The driver writes error messages to the console/log.
Packit 7cfc04
The SENSE
Packit 7cfc04
codes written into some messages are automatically translated to text
Packit 7cfc04
if verbose SCSI messages are enabled in kernel configuration.
Packit 7cfc04
.IP 5.
Packit 7cfc04
The driver's internal buffering allows good throughput in fixed-block
Packit 7cfc04
mode also with small
Packit 7cfc04
.BR read (2)
Packit 7cfc04
and
Packit 7cfc04
.BR write (2)
Packit 7cfc04
byte counts.
Packit 7cfc04
With direct transfers
Packit 7cfc04
this is not possible and may cause a surprise when moving to the 2.6
Packit 7cfc04
kernel.
Packit 7cfc04
The solution is to tell the software to use larger transfers (often
Packit 7cfc04
telling it to use larger blocks).
Packit 7cfc04
If this is not possible, direct transfers can be disabled.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR mt (1)
Packit 7cfc04
.PP
Packit 7cfc04
The file
Packit 7cfc04
.I drivers/scsi/README.st
Packit 7cfc04
or
Packit 7cfc04
.I Documentation/scsi/st.txt
Packit 7cfc04
(kernel >= 2.6) in the Linux kernel source tree contains
Packit 7cfc04
the most recent information about the driver and its configuration
Packit 7cfc04
possibilities
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.