st(4) Kernel Interfaces Manual st(4)
NAME
st - SCSI tape device
SYNOPSIS
#include <sys/mtio.h>
int ioctl(int fd, int request [, (void *)arg3]);
int ioctl(int fd, MTIOCTOP, (struct mtop *)mt_cmd);
int ioctl(int fd, MTIOCGET, (struct mtget *)mt_status);
int ioctl(int fd, MTIOCPOS, (struct mtpos *)mt_pos);
DESCRIPTION
The st driver provides the interface to a variety of SCSI tape devices.
Currently, the driver takes control of all detected devices of type
"sequential-access". The st driver uses major device number 9.
Each device uses eight minor device numbers. The lowermost five bits
in the minor numbers are assigned sequentially in the order of detec-
tion. In the 2.6 kernel, the bits above the eight lowermost bits are
concatenated to the five lowermost bits to form the tape number. The
minor numbers can be grouped into two sets of four numbers: the princi-
pal (auto-rewind) minor device numbers, n, and the "no-rewind" device
numbers, (n + 128). Devices opened using the principal device number
will be sent a REWIND command when they are closed. Devices opened us-
ing the "no-rewind" device number will not. (Note that using an auto-
rewind device for positioning the tape with, for instance, mt does not
lead to the desired result: the tape is rewound after the mt command
and the next command starts from the beginning of the tape).
Within each group, four minor numbers are available to define devices
with different characteristics (block size, compression, density, etc.)
When the system starts up, only the first device is available. The
other three are activated when the default characteristics are defined
(see below). (By changing compile-time constants, it is possible to
change the balance between the maximum number of tape drives and the
number of minor numbers for each drive. The default allocation allows
control of 32 tape drives. For instance, it is possible to control up
to 64 tape drives with two minor numbers for different options.)
Devices are typically created by:
mknod -m 666 /dev/st0 c 9 0
mknod -m 666 /dev/st0l c 9 32
mknod -m 666 /dev/st0m c 9 64
mknod -m 666 /dev/st0a c 9 96
mknod -m 666 /dev/nst0 c 9 128
mknod -m 666 /dev/nst0l c 9 160
mknod -m 666 /dev/nst0m c 9 192
mknod -m 666 /dev/nst0a c 9 224
There is no corresponding block device.
The driver uses an internal buffer that has to be large enough to hold
at least one tape block. Before Linux 2.1.121, the buffer is allocated
as one contiguous block. This limits the block size to the largest
contiguous block of memory the kernel allocator can provide. The limit
is currently 128 kB for 32-bit architectures and 256 kB for 64-bit ar-
chitectures. In newer kernels the driver allocates the buffer in sev-
eral parts if necessary. By default, the maximum number of parts is
16. This means that the maximum block size is very large (2 MB if al-
location of 16 blocks of 128 kB succeeds).
The driver's internal buffer size is determined by a compile-time con-
stant which can be overridden with a kernel startup option. In addi-
tion to this, the driver tries to allocate a larger temporary buffer at
run time if necessary. However, run-time allocation of large contigu-
ous blocks of memory may fail and it is advisable not to rely too much
on dynamic buffer allocation before Linux 2.1.121 (this applies also to
demand-loading the driver with kerneld or kmod).
The driver does not specifically support any tape drive brand or model.
After system start-up the tape device options are defined by the drive
firmware. For example, if the drive firmware selects fixed-block mode,
the tape device uses fixed-block mode. The options can be changed with
explicit ioctl(2) calls and remain in effect when the device is closed
and reopened. Setting the options affects both the auto-rewind and the
nonrewind device.
Different options can be specified for the different devices within the
subgroup of four. The options take effect when the device is opened.
For example, the system administrator can define one device that writes
in fixed-block mode with a certain block size, and one which writes in
variable-block mode (if the drive supports both modes).
The driver supports tape partitions if they are supported by the drive.
(Note that the tape partitions have nothing to do with disk partitions.
A partitioned tape can be seen as several logical tapes within one
medium.) Partition support has to be enabled with an ioctl(2). The
tape location is preserved within each partition across partition
changes. The partition used for subsequent tape operations is selected
with an ioctl(2). The partition switch is executed together with the
next tape operation in order to avoid unnecessary tape movement. The
maximum number of partitions on a tape is defined by a compile-time
constant (originally four). The driver contains an ioctl(2) that can
format a tape with either one or two partitions.
Device /dev/tape is usually created as a hard or soft link to the de-
fault tape device on the system.
Starting from Linux 2.6.2, the driver exports in the sysfs directory
/sys/class/scsi_tape the attached devices and some parameters assigned
to the devices.
Data transfer
The driver supports operation in both fixed-block mode and variable-
block mode (if supported by the drive). In fixed-block mode the drive
writes blocks of the specified size and the block size is not dependent
on the byte counts of the write system calls. In variable-block mode
one tape block is written for each write call and the byte count deter-
mines the size of the corresponding tape block. Note that the blocks
on the tape don't contain any information about the writing mode: when
reading, the only important thing is to use commands that accept the
block sizes on the tape.
In variable-block mode the read byte count does not have to match the
tape block size exactly. If the byte count is larger than the next
block on tape, the driver returns the data and the function returns the
actual block size. If the block size is larger than the byte count, an
error is returned.
In fixed-block mode the read byte counts can be arbitrary if buffering
is enabled, or a multiple of the tape block size if buffering is dis-
abled. Before Linux 2.1.121 allow writes with arbitrary byte count if
buffering is enabled. In all other cases (before Linux 2.1.121 with
buffering disabled or newer kernel) the write byte count must be a mul-
tiple of the tape block size.
In Linux 2.6, the driver tries to use direct transfers between the user
buffer and the device. If this is not possible, the driver's internal
buffer is used. The reasons for not using direct transfers include im-
proper alignment of the user buffer (default is 512 bytes but this can
be changed by the HBA driver), one or more pages of the user buffer not
reachable by the SCSI adapter, and so on.
A filemark is automatically written to tape if the last tape operation
before close was a write.
When a filemark is encountered while reading, the following happens.
If there are data remaining in the buffer when the filemark is found,
the buffered data is returned. The next read returns zero bytes. The
following read returns data from the next file. The end of recorded
data is signaled by returning zero bytes for two consecutive read
calls. The third read returns an error.
Ioctls
The driver supports three ioctl(2) requests. Requests not recognized
by the st driver are passed to the SCSI driver. The definitions below
are from /usr/include/linux/mtio.h:
MTIOCTOP -- perform a tape operation
This request takes an argument of type (struct mtop *). Not all drives
support all operations. The driver returns an EIO error if the drive
rejects an operation.
st(4) Kernel Interfaces Manual st(4)
NAME
st - SCSI tape device
SYNOPSIS
#include <sys/mtio.h>
int ioctl(int fd, int request [, (void *)arg3]);
int ioctl(int fd, MTIOCTOP, (struct mtop *)mt_cmd);
int ioctl(int fd, MTIOCGET, (struct mtget *)mt_status);
int ioctl(int fd, MTIOCPOS, (struct mtpos *)mt_pos);
DESCRIPTION
The st driver provides the interface to a variety of SCSI tape devices.
Currently, the driver takes control of all detected devices of type
"sequential-access". The st driver uses major device number 9.
Each device uses eight minor device numbers. The lowermost five bits
in the minor numbers are assigned sequentially in the order of detec-
tion. In the 2.6 kernel, the bits above the eight lowermost bits are
concatenated to the five lowermost bits to form the tape number. The
minor numbers can be grouped into two sets of four numbers: the princi-
pal (auto-rewind) minor device numbers, n, and the "no-rewind" device
numbers, (n + 128). Devices opened using the principal device number
will be sent a REWIND command when they are closed. Devices opened us-
ing the "no-rewind" device number will not. (Note that using an auto-
rewind device for positioning the tape with, for instance, mt does not
lead to the desired result: the tape is rewound after the mt command
and the next command starts from the beginning of the tape).
Within each group, four minor numbers are available to define devices
with different characteristics (block size, compression, density, etc.)
When the system starts up, only the first device is available. The
other three are activated when the default characteristics are defined
(see below). (By changing compile-time constants, it is possible to
change the balance between the maximum number of tape drives and the
number of minor numbers for each drive. The default allocation allows
control of 32 tape drives. For instance, it is possible to control up
to 64 tape drives with two minor numbers for different options.)
Devices are typically created by:
mknod -m 666 /dev/st0 c 9 0
mknod -m 666 /dev/st0l c 9 32
mknod -m 666 /dev/st0m c 9 64
mknod -m 666 /dev/st0a c 9 96
mknod -m 666 /dev/nst0 c 9 128
mknod -m 666 /dev/nst0l c 9 160
mknod -m 666 /dev/nst0m c 9 192
mknod -m 666 /dev/nst0a c 9 224
There is no corresponding block device.
The driver uses an internal buffer that has to be large enough to hold
at least one tape block. Before Linux 2.1.121, the buffer is allocated
as one contiguous block. This limits the block size to the largest
contiguous block of memory the kernel allocator can provide. The limit
is currently 128 kB for 32-bit architectures and 256 kB for 64-bit ar-
chitectures. In newer kernels the driver allocates the buffer in sev-
eral parts if necessary. By default, the maximum number of parts is
16. This means that the maximum block size is very large (2 MB if al-
location of 16 blocks of 128 kB succeeds).
The driver's internal buffer size is determined by a compile-time con-
stant which can be overridden with a kernel startup option. In addi-
tion to this, the driver tries to allocate a larger temporary buffer at
run time if necessary. However, run-time allocation of large contigu-
ous blocks of memory may fail and it is advisable not to rely too much
on dynamic buffer allocation before Linux 2.1.121 (this applies also to
demand-loading the driver with kerneld or kmod).
The driver does not specifically support any tape drive brand or model.
After system start-up the tape device options are defined by the drive
firmware. For example, if the drive firmware selects fixed-block mode,
the tape device uses fixed-block mode. The options can be changed with
explicit ioctl(2) calls and remain in effect when the device is closed
and reopened. Setting the options affects both the auto-rewind and the
nonrewind device.
Different options can be specified for the different devices within the
subgroup of four. The options take effect when the device is opened.
For example, the system administrator can define one device that writes
in fixed-block mode with a certain block size, and one which writes in
variable-block mode (if the drive supports both modes).
The driver supports tape partitions if they are supported by the drive.
(Note that the tape partitions have nothing to do with disk partitions.
A partitioned tape can be seen as several logical tapes within one
medium.) Partition support has to be enabled with an ioctl(2). The
tape location is preserved within each partition across partition
changes. The partition used for subsequent tape operations is selected
with an ioctl(2). The partition switch is executed together with the
next tape operation in order to avoid unnecessary tape movement. The
maximum number of partitions on a tape is defined by a compile-time
constant (originally four). The driver contains an ioctl(2) that can
format a tape with either one or two partitions.
Device /dev/tape is usually created as a hard or soft link to the de-
fault tape device on the system.
Starting from Linux 2.6.2, the driver exports in the sysfs directory
/sys/class/scsi_tape the attached devices and some parameters assigned
to the devices.
Data transfer
The driver supports operation in both fixed-block mode and variable-
block mode (if supported by the drive). In fixed-block mode the drive
writes blocks of the specified size and the block size is not dependent
on the byte counts of the write system calls. In variable-block mode
one tape block is written for each write call and the byte count deter-
mines the size of the corresponding tape block. Note that the blocks
on the tape don't contain any information about the writing mode: when
reading, the only important thing is to use commands that accept the
block sizes on the tape.
In variable-block mode the read byte count does not have to match the
tape block size exactly. If the byte count is larger than the next
block on tape, the driver returns the data and the function returns the
actual block size. If the block size is larger than the byte count, an
error is returned.
In fixed-block mode the read byte counts can be arbitrary if buffering
is enabled, or a multiple of the tape block size if buffering is dis-
abled. Before Linux 2.1.121 allow writes with arbitrary byte count if
buffering is enabled. In all other cases (before Linux 2.1.121 with
buffering disabled or newer kernel) the write byte count must be a mul-
tiple of the tape block size.
In Linux 2.6, the driver tries to use direct transfers between the user
buffer and the device. If this is not possible, the driver's internal
buffer is used. The reasons for not using direct transfers include im-
proper alignment of the user buffer (default is 512 bytes but this can
be changed by the HBA driver), one or more pages of the user buffer not
reachable by the SCSI adapter, and so on.
A filemark is automatically written to tape if the last tape operation
before close was a write.
When a filemark is encountered while reading, the following happens.
If there are data remaining in the buffer when the filemark is found,
the buffered data is returned. The next read returns zero bytes. The
following read returns data from the next file. The end of recorded
data is signaled by returning zero bytes for two consecutive read
calls. The third read returns an error.
Ioctls
The driver supports three ioctl(2) requests. Requests not recognized
by the st driver are passed to the SCSI driver. The definitions below
are from /usr/include/linux/mtio.h:
MTIOCTOP -- perform a tape operation
This request takes an argument of type (struct mtop *). Not all drives
support all operations. The driver returns an EIO error if the drive
rejects an operation.
st(4) Kernel Interfaces Manual st(4)
NAME
st - SCSI tape device
SYNOPSIS
#include <sys/mtio.h>
int ioctl(int fd, int request [, (void *)arg3]);
int ioctl(int fd, MTIOCTOP, (struct mtop *)mt_cmd);
int ioctl(int fd, MTIOCGET, (struct mtget *)mt_status);
int ioctl(int fd, MTIOCPOS, (struct mtpos *)mt_pos);
DESCRIPTION
The st driver provides the interface to a variety of SCSI tape devices.
Currently, the driver takes control of all detected devices of type
"sequential-access". The st driver uses major device number 9.
Each device uses eight minor device numbers. The lowermost five bits
in the minor numbers are assigned sequentially in the order of detec-
tion. In the 2.6 kernel, the bits above the eight lowermost bits are
concatenated to the five lowermost bits to form the tape number. The
minor numbers can be grouped into two sets of four numbers: the princi-
pal (auto-rewind) minor device numbers, n, and the "no-rewind" device
numbers, (n + 128). Devices opened using the principal device number
will be sent a REWIND command when they are closed. Devices opened us-
ing the "no-rewind" device number will not. (Note that using an auto-
rewind device for positioning the tape with, for instance, mt does not
lead to the desired result: the tape is rewound after the mt command
and the next command starts from the beginning of the tape).
Within each group, four minor numbers are available to define devices
with different characteristics (block size, compression, density, etc.)
When the system starts up, only the first device is available. The
other three are activated when the default characteristics are defined
(see below). (By changing compile-time constants, it is possible to
change the balance between the maximum number of tape drives and the
number of minor numbers for each drive. The default allocation allows
control of 32 tape drives. For instance, it is possible to control up
to 64 tape drives with two minor numbers for different options.)
Devices are typically created by:
mknod -m 666 /dev/st0 c 9 0
mknod -m 666 /dev/st0l c 9 32
mknod -m 666 /dev/st0m c 9 64
mknod -m 666 /dev/st0a c 9 96
mknod -m 666 /dev/nst0 c 9 128
mknod -m 666 /dev/nst0l c 9 160
mknod -m 666 /dev/nst0m c 9 192
mknod -m 666 /dev/nst0a c 9 224
There is no corresponding block device.
The driver uses an internal buffer that has to be large enough to hold
at least one tape block. Before Linux 2.1.121, the buffer is allocated
as one contiguous block. This limits the block size to the largest
contiguous block of memory the kernel allocator can provide. The limit
is currently 128 kB for 32-bit architectures and 256 kB for 64-bit ar-
chitectures. In newer kernels the driver allocates the buffer in sev-
eral parts if necessary. By default, the maximum number of parts is
16. This means that the maximum block size is very large (2 MB if al-
location of 16 blocks of 128 kB succeeds).
The driver's internal buffer size is determined by a compile-time con-
stant which can be overridden with a kernel startup option. In addi-
tion to this, the driver tries to allocate a larger temporary buffer at
run time if necessary. However, run-time allocation of large contigu-
ous blocks of memory may fail and it is advisable not to rely too much
on dynamic buffer allocation before Linux 2.1.121 (this applies also to
demand-loading the driver with kerneld or kmod).
The driver does not specifically support any tape drive brand or model.
After system start-up the tape device options are defined by the drive
firmware. For example, if the drive firmware selects fixed-block mode,
the tape device uses fixed-block mode. The options can be changed with
explicit ioctl(2) calls and remain in effect when the device is closed
and reopened. Setting the options affects both the auto-rewind and the
nonrewind device.
Different options can be specified for the different devices within the
subgroup of four. The options take effect when the device is opened.
For example, the system administrator can define one device that writes
in fixed-block mode with a certain block size, and one which writes in
variable-block mode (if the drive supports both modes).
The driver supports tape partitions if they are supported by the drive.
(Note that the tape partitions have nothing to do with disk partitions.
A partitioned tape can be seen as several logical tapes within one
medium.) Partition support has to be enabled with an ioctl(2). The
tape location is preserved within each partition across partition
changes. The partition used for subsequent tape operations is selected
with an ioctl(2). The partition switch is executed together with the
next tape operation in order to avoid unnecessary tape movement. The
maximum number of partitions on a tape is defined by a compile-time
constant (originally four). The driver contains an ioctl(2) that can
format a tape with either one or two partitions.
Device /dev/tape is usually created as a hard or soft link to the de-
fault tape device on the system.
Starting from Linux 2.6.2, the driver exports in the sysfs directory
/sys/class/scsi_tape the attached devices and some parameters assigned
to the devices.
Data transfer
The driver supports operation in both fixed-block mode and variable-
block mode (if supported by the drive). In fixed-block mode the drive
writes blocks of the specified size and the block size is not dependent
on the byte counts of the write system calls. In variable-block mode
one tape block is written for each write call and the byte count deter-
mines the size of the corresponding tape block. Note that the blocks
on the tape don't contain any information about the writing mode: when
reading, the only important thing is to use commands that accept the
block sizes on the tape.
In variable-block mode the read byte count does not have to match the
tape block size exactly. If the byte count is larger than the next
block on tape, the driver returns the data and the function returns the
actual block size. If the block size is larger than the byte count, an
error is returned.
In fixed-block mode the read byte counts can be arbitrary if buffering
is enabled, or a multiple of the tape block size if buffering is dis-
abled. Before Linux 2.1.121 allow writes with arbitrary byte count if
buffering is enabled. In all other cases (before Linux 2.1.121 with
buffering disabled or newer kernel) the write byte count must be a mul-
tiple of the tape block size.
In Linux 2.6, the driver tries to use direct transfers between the user
buffer and the device. If this is not possible, the driver's internal
buffer is used. The reasons for not using direct transfers include im-
proper alignment of the user buffer (default is 512 bytes but this can
be changed by the HBA driver), one or more pages of the user buffer not
reachable by the SCSI adapter, and so on.
A filemark is automatically written to tape if the last tape operation
before close was a write.
When a filemark is encountered while reading, the following happens.
If there are data remaining in the buffer when the filemark is found,
the buffered data is returned. The next read returns zero bytes. The
following read returns data from the next file. The end of recorded
data is signaled by returning zero bytes for two consecutive read
calls. The third read returns an error.
Ioctls
The driver supports three ioctl(2) requests. Requests not recognized
by the st driver are passed to the SCSI driver. The definitions below
are from /usr/include/linux/mtio.h:
MTIOCTOP -- perform a tape operation
This request takes an argument of type (struct mtop *). Not all drives
support all operations. The driver returns an EIO error if the drive
rejects an operation.
st(4) Kernel Interfaces Manual st(4)
NAME
st - SCSI tape device
SYNOPSIS
#include <sys/mtio.h>
int ioctl(int fd, int request [, (void *)arg3]);
int ioctl(int fd, MTIOCTOP, (struct mtop *)mt_cmd);
int ioctl(int fd, MTIOCGET, (struct mtget *)mt_status);
int ioctl(int fd, MTIOCPOS, (struct mtpos *)mt_pos);
DESCRIPTION
The st driver provides the interface to a variety of SCSI tape devices.
Currently, the driver takes control of all detected devices of type
"sequential-access". The st driver uses major device number 9.
Each device uses eight minor device numbers. The lowermost five bits
in the minor numbers are assigned sequentially in the order of detec-
tion. In the 2.6 kernel, the bits above the eight lowermost bits are
concatenated to the five lowermost bits to form the tape number. The
minor numbers can be grouped into two sets of four numbers: the princi-
pal (auto-rewind) minor device numbers, n, and the "no-rewind" device
numbers, (n + 128). Devices opened using the principal device number
will be sent a REWIND command when they are closed. Devices opened us-
ing the "no-rewind" device number will not. (Note that using an auto-
rewind device for positioning the tape with, for instance, mt does not
lead to the desired result: the tape is rewound after the mt command
and the next command starts from the beginning of the tape).
Within each group, four minor numbers are available to define devices
with different characteristics (block size, compression, density, etc.)
When the system starts up, only the first device is available. The
other three are activated when the default characteristics are defined
(see below). (By changing compile-time constants, it is possible to
change the balance between the maximum number of tape drives and the
number of minor numbers for each drive. The default allocation allows
control of 32 tape drives. For instance, it is possible to control up
to 64 tape drives with two minor numbers for different options.)
Devices are typically created by:
mknod -m 666 /dev/st0 c 9 0
mknod -m 666 /dev/st0l c 9 32
mknod -m 666 /dev/st0m c 9 64
mknod -m 666 /dev/st0a c 9 96
mknod -m 666 /dev/nst0 c 9 128
mknod -m 666 /dev/nst0l c 9 160
mknod -m 666 /dev/nst0m c 9 192
mknod -m 666 /dev/nst0a c 9 224
There is no corresponding block device.
The driver uses an internal buffer that has to be large enough to hold
at least one tape block. Before Linux 2.1.121, the buffer is allocated
as one contiguous block. This limits the block size to the largest
contiguous block of memory the kernel allocator can provide. The limit
is currently 128 kB for 32-bit architectures and 256 kB for 64-bit ar-
chitectures. In newer kernels the driver allocates the buffer in sev-
eral parts if necessary. By default, the maximum number of parts is
16. This means that the maximum block size is very large (2 MB if al-
location of 16 blocks of 128 kB succeeds).
The driver's internal buffer size is determined by a compile-time con-
stant which can be overridden with a kernel startup option. In addi-
tion to this, the driver tries to allocate a larger temporary buffer at
run time if necessary. However, run-time allocation of large contigu-
ous blocks of memory may fail and it is advisable not to rely too much
on dynamic buffer allocation before Linux 2.1.121 (this applies also to
demand-loading the driver with kerneld or kmod).
The driver does not specifically support any tape drive brand or model.
After system start-up the tape device options are defined by the drive
firmware. For example, if the drive firmware selects fixed-block mode,
t
Linux man-pages 6.03 2023-02-05 st(4)
Czas wygenerowania: 0.00262 sek.
Created with the man page lookup class by Andrew Collington.
Based on a C man page viewer by Vadim Pavlov
Unicode soft-hyphen fix (as used by RedHat) by Dan Edwards
Some optimisations by Eli Argon
Caching idea and code contribution by James Richardson
Copyright © 2003-2025 Linux.pl
Hosted by Hosting Linux.pl