MTIO(4) | Kernel Interfaces Manual | MTIO(4) |
Magnetic tape comes in a wide variety of formats, from classic 9-track, through various Quarter Inch Cartridge (QIC) variants, to more modern systems using 8mm video tape, and Digital Audio Tape (DAT). There have also been a variety of proprietary tape systems, including DECtape, and IBM 3480.
The “raw” interface differs in that all I/O can be done in arbitrary sized blocks, within the limitations for the specific device and device driver, and all I/O is synchronous. This is the most flexible interface, but since there is very little that is handled automatically by the kernel, user programs must implement specific magnetic tape handling routines, which puts the onus of correctness on the application programmer.
The block device is usually named for the driver, e.g. /dev/st0 for unit zero of a st(4) SCSI tape drive.
The raw device name is the block device name with an “r” prepended, e.g. /dev/rst0.
By default, the tape driver will rewind the tape drive when the device is closed. To make it possible for multiple program invocations to sequentially write multiple files on the same tape, a “no rewind on close” device is provided, denoted by the letter “n” prepended to the name of the device, e.g. /dev/nst0, /dev/nrst0.
The mt(1) command can be used to explicitly rewind, or otherwise position a tape at a particular point with the no-rewind device.
By default, the tape driver will write two End Of File (EOF) marks and rewind the tape when the device is closed after the last write.
If the tape is not to be rewound it is positioned with the head in between the two tape marks, where the next write will over write the second end-of-file marker.
All of the magnetic tape devices may be manipulated with the mt(1) command.
A number of ioctl(2) operations are available on raw magnetic tape. Please see <sys/mtio.h> for their definitions.
The manual pages for specific tape device drivers should list their particular capabilities and limitations.
If and when NetBSD is updated to deal with non-512 byte per sector disk media through the system buffer cache, perhaps a more sane tape interface can be implemented.
January 14, 1999 | NetBSD 6.1 |