📄 readme.st
字号:
The following syntax used by the old kernel versions is also supported: st=aa[,bb[,cc[,dd]]]where aa is the buffer size in 1024 byte units bb is the write threshold in 1024 byte units cc is the maximum number of tape buffers to allocate (the number of buffers is bounded also by the number of drives detected) dd is the maximum number of scatter/gather segmentsIOCTLSThe tape is positioned and the drive parameters are set with ioctlsdefined in mtio.h The tape control program 'mt' uses these ioctls. Tryto find an mt that supports all of the Linux SCSI tape ioctls andopens the device for writing if the tape contents will be modified(look for a package mt-st* from the Linux ftp sites; the GNU mt doesnot open for writing for, e.g., erase).The supported ioctls are:The following use the structure mtop:MTFSF Space forward over count filemarks. Tape positioned after filemark.MTFSFM As above but tape positioned before filemark.MTBSF Space backward over count filemarks. Tape positioned before filemark.MTBSFM As above but ape positioned after filemark.MTFSR Space forward over count records.MTBSR Space backward over count records.MTFSS Space forward over count setmarks.MTBSS Space backward over count setmarks.MTWEOF Write count filemarks.MTWSM Write count setmarks.MTREW Rewind tape.MTOFFL Set device off line (often rewind plus eject).MTNOP Do nothing except flush the buffers.MTRETEN Re-tension tape.MTEOM Space to end of recorded data.MTERASE Erase tape.MTSEEK Seek to tape block count. Uses Tandberg-compatible seek (QFA) for SCSI-1 drives and SCSI-2 seek for SCSI-2 drives. The file and block numbers in the status are not valid after a seek.MTSETBLK Set the drive block size. Setting to zero sets the drive into variable block mode (if applicable).MTSETDENSITY Sets the drive density code to arg. See drive documentation for available codes.MTLOCK and MTUNLOCK Explicitly lock/unlock the tape drive door.MTLOAD and MTUNLOAD Explicitly load and unload the tape. If the command argument x is between MT_ST_HPLOADER_OFFSET + 1 and MT_ST_HPLOADER_OFFSET + 6, the number x is used sent to the drive with the command and it selects the tape slot to use of HP C1553A changer.MTCOMPRESSION Sets compressing or uncompressing drive mode using the SCSI mode page 15. Note that some drives other methods for control of compression. Some drives (like the Exabytes) use density codes for compression control. Some drives use another mode page but this page has not been implemented in the driver. Some drives without compression capability will accept any compression mode without error.MTSETPART Moves the tape to the partition given by the argument at the next tape operation. The block at which the tape is positioned is the block where the tape was previously positioned in the new active partition unless the next tape operation is MTSEEK. In this case the tape is moved directly to the block specified by MTSEEK. MTSETPART is inactive unless MT_ST_CAN_PARTITIONS set.MTMKPART Formats the tape with one partition (argument zero) or two partitions (the argument gives in megabytes the size of partition 1 that is physically the first partition of the tape). The drive has to support partitions with size specified by the initiator. Inactive unless MT_ST_CAN_PARTITIONS set.MTSETDRVBUFFER Is used for several purposes. The command is obtained from count with mask MT_SET_OPTIONS, the low order bits are used as argument. This command is only allowed for the superuser (root). The subcommands are: 0 The drive buffer option is set to the argument. Zero means no buffering. MT_ST_BOOLEANS Sets the buffering options. The bits are the new states (enabled/disabled) the following options (in the parenthesis is specified whether the option is global or can be specified differently for each mode): MT_ST_BUFFER_WRITES write buffering (mode) MT_ST_ASYNC_WRITES asynchronous writes (mode) MT_ST_READ_AHEAD read ahead (mode) MT_ST_TWO_FM writing of two filemarks (global) MT_ST_FAST_EOM using the SCSI spacing to EOD (global) MT_ST_AUTO_LOCK automatic locking of the drive door (global) MT_ST_DEF_WRITES the defaults are meant only for writes (mode) MT_ST_CAN_BSR backspacing over more than one records can be used for repositioning the tape (global) MT_ST_NO_BLKLIMS the driver does not ask the block limits from the drive (block size can be changed only to variable) (global) MT_ST_CAN_PARTITIONS enables support for partitioned tapes (global) MT_ST_SCSI2LOGICAL the logical block number is used in the MTSEEK and MTIOCPOS for SCSI-2 drives instead of the device dependent address. It is recommended to set this flag unless there are tapes using the device dependent (from the old times) (global) MT_ST_SYSV sets the SYSV sematics (mode) MT_ST_DEBUGGING debugging (global; debugging must be compiled into the driver) MT_ST_SETBOOLEANS MT_ST_CLEARBOOLEANS Sets or clears the option bits. MT_ST_WRITE_THRESHOLD Sets the write threshold for this device to kilobytes specified by the lowest bits. MT_ST_DEF_BLKSIZE Defines the default block size set automatically. Value 0xffffff means that the default is not used any more. MT_ST_DEF_DENSITY MT_ST_DEF_DRVBUFFER MT_ST_DEF_COMPRESSION Used to set or clear the density (8 bits), drive buffer state (3 bits), and compression (single bit). If the value is MT_ST_CLEAR_DEFAULT (0xfffff), the default will not be used any more. Otherwise the lower-most bits of the value contain the new value of the parameter. MT_ST_SET_TIMEOUT Set the normal timeout in seconds for this device. The default is 900 seconds (15 minutes). The timeout should be long enough for the retries done by the device while reading/writing. MT_ST_SET_LONG_TIMEOUT Set the long timeout that is used for operations that are known to take a long time. The default is 14000 seconds (3.9 hours). For erase this value is further multiplied by eight.The following ioctl uses the structure mtpos:MTIOCPOS Reads the current position from the drive. Uses Tandberg-compatible QFA for SCSI-1 drives and the SCSI-2 command for the SCSI-2 drives.The following ioctl uses the structure mtget to return the status:MTIOCGET Returns some status information. The file number and block number within file are returned. The block is -1 when it can't be determined (e.g., after MTBSF). The drive type is either MTISSCSI1 or MTISSCSI2. The number of recovered errors since the previous status call is stored in the lower word of the field mt_erreg. The current block size and the density code are stored in the field mt_dsreg (shifts for the subfields are MT_ST_BLKSIZE_SHIFT and MT_ST_DENSITY_SHIFT). The GMT_xxx status bits reflect the drive status. GMT_DR_OPEN is set if there is no tape in the drive. GMT_EOD means either end of recorded data or end of tape. GMT_EOT means end of tape.MISCELLANEOUS COMPILE OPTIONSThe recovered write errors are considered fatal if ST_RECOVERED_WRITE_FATALis defined.The maximum number of tape devices is determined by the defineST_MAX_TAPES. If more tapes are detected at driver initialization, themaximum is adjusted accordingly.Immediate return from tape positioning SCSI commands can be enabled bydefining ST_NOWAIT. If this is defined, the user should take care thatthe next tape operation is not started before the previous one hasfinished. The drives and SCSI adapters should handle this conditiongracefully, but some drive/adapter combinations are known to hang theSCSI bus in this case.The MTEOM command is by default implemented as spacing over 32767filemarks. With this method the file number in the status iscorrect. The user can request using direct spacing to EOD by settingST_FAST_EOM 1 (or using the MT_ST_OPTIONS ioctl). In this case the filenumber will be invalid.When using read ahead or buffered writes the position within the filemay not be correct after the file is closed (correct position mayrequire backspacing over more than one record). The correct positionwithin file can be obtained if ST_IN_FILE_POS is defined at compiletime or the MT_ST_CAN_BSR bit is set for the drive with an ioctl.(The driver always backs over a filemark crossed by read ahead if theuser does not request data that far.)DEBUGGING HINTSTo enable debugging messages, edit st.c and #define DEBUG 1. As seenabove, debugging can be switched off with an ioctl if debugging iscompiled into the driver. The debugging output is not voluminuous.If the tape seems to hang, I would be very interested to hear wherethe driver is waiting. With the command 'ps -l' you can see the stateof the process using the tape. If the state is D, the process iswaiting for something. The field WCHAN tells where the driver iswaiting. If you have the current System.map in the correct place (in/boot for the procps I use) or have updated /etc/psdatabase (for kmemps), ps writes the function name in the WCHAN field. If not, you haveto look up the function from System.map.Note also that the timeouts are very long compared to most otherdrivers. This means that the Linux driver may appear hung although thereal reason is that the tape firmware has got confused.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -