674 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3====================4The SCSI Tape Driver5====================6 7This file contains brief information about the SCSI tape driver.8The driver is currently maintained by Kai Mäkisara (email9Kai.Makisara@kolumbus.fi)10 11Last modified: Tue Feb 9 21:54:16 2016 by kai.makisara12 13 14Basics15======16 17The driver is generic, i.e., it does not contain any code tailored18to any specific tape drive. The tape parameters can be specified with19one of the following three methods:20 211. Each user can specify the tape parameters he/she wants to use22directly with ioctls. This is administratively a very simple and23flexible method and applicable to single-user workstations. However,24in a multiuser environment the next user finds the tape parameters in25state the previous user left them.26 272. The system manager (root) can define default values for some tape28parameters, like block size and density using the MTSETDRVBUFFER ioctl.29These parameters can be programmed to come into effect either when a30new tape is loaded into the drive or if writing begins at the31beginning of the tape. The second method is applicable if the tape32drive performs auto-detection of the tape format well (like some33QIC-drives). The result is that any tape can be read, writing can be34continued using existing format, and the default format is used if35the tape is rewritten from the beginning (or a new tape is written36for the first time). The first method is applicable if the drive37does not perform auto-detection well enough and there is a single38"sensible" mode for the device. An example is a DAT drive that is39used only in variable block mode (I don't know if this is sensible40or not :-).41 42The user can override the parameters defined by the system43manager. The changes persist until the defaults again come into44effect.45 463. By default, up to four modes can be defined and selected using the minor47number (bits 5 and 6). The number of modes can be changed by changing48ST_NBR_MODE_BITS in st.h. Mode 0 corresponds to the defaults discussed49above. Additional modes are dormant until they are defined by the50system manager (root). When specification of a new mode is started,51the configuration of mode 0 is used to provide a starting point for52definition of the new mode.53 54Using the modes allows the system manager to give the users choices55over some of the buffering parameters not directly accessible to the56users (buffered and asynchronous writes). The modes also allow choices57between formats in multi-tape operations (the explicitly overridden58parameters are reset when a new tape is loaded).59 60If more than one mode is used, all modes should contain definitions61for the same set of parameters.62 63Many Unices contain internal tables that associate different modes to64supported devices. The Linux SCSI tape driver does not contain such65tables (and will not do that in future). Instead of that, a utility66program can be made that fetches the inquiry data sent by the device,67scans its database, and sets up the modes using the ioctls. Another68alternative is to make a small script that uses mt to set the defaults69tailored to the system.70 71The driver supports fixed and variable block size (within buffer72limits). Both the auto-rewind (minor equals device number) and73non-rewind devices (minor is 128 + device number) are implemented.74 75In variable block mode, the byte count in write() determines the size76of the physical block on tape. When reading, the drive reads the next77tape block and returns to the user the data if the read() byte count78is at least the block size. Otherwise, error ENOMEM is returned.79 80In fixed block mode, the data transfer between the drive and the81driver is in multiples of the block size. The write() byte count must82be a multiple of the block size. This is not required when reading but83may be advisable for portability.84 85Support is provided for changing the tape partition and partitioning86of the tape with one or two partitions. By default support for87partitioned tape is disabled for each driver and it can be enabled88with the ioctl MTSETDRVBUFFER.89 90By default the driver writes one filemark when the device is closed after91writing and the last operation has been a write. Two filemarks can be92optionally written. In both cases end of data is signified by93returning zero bytes for two consecutive reads.94 95Writing filemarks without the immediate bit set in the SCSI command block acts96as a synchronization point, i.e., all remaining data form the drive buffers is97written to tape before the command returns. This makes sure that write errors98are caught at that point, but this takes time. In some applications, several99consecutive files must be written fast. The MTWEOFI operation can be used to100write the filemarks without flushing the drive buffer. Writing filemark at101close() is always flushing the drive buffers. However, if the previous102operation is MTWEOFI, close() does not write a filemark. This can be used if103the program wants to close/open the tape device between files and wants to104skip waiting.105 106If rewind, offline, bsf, or seek is done and previous tape operation was107write, a filemark is written before moving tape.108 109The compile options are defined in the file linux/drivers/scsi/st_options.h.110 1114. If the open option O_NONBLOCK is used, open succeeds even if the112drive is not ready. If O_NONBLOCK is not used, the driver waits for113the drive to become ready. If this does not happen in ST_BLOCK_SECONDS114seconds, open fails with the errno value EIO. With O_NONBLOCK the115device can be opened for writing even if there is a write protected116tape in the drive (commands trying to write something return error if117attempted).118 119 120Minor Numbers121=============122 123The tape driver currently supports up to 2^17 drives if 4 modes for124each drive are used.125 126The minor numbers consist of the following bit fields::127 128 dev_upper non-rew mode dev-lower129 20 - 8 7 6 5 4 0130 131The non-rewind bit is always bit 7 (the uppermost bit in the lowermost132byte). The bits defining the mode are below the non-rewind bit. The133remaining bits define the tape device number. This numbering is134backward compatible with the numbering used when the minor number was135only 8 bits wide.136 137 138Sysfs Support139=============140 141The driver creates the directory /sys/class/scsi_tape and populates it with142directories corresponding to the existing tape devices. There are autorewind143and non-rewind entries for each mode. The names are stxy and nstxy, where x144is the tape number and y a character corresponding to the mode (none, l, m,145a). For example, the directories for the first tape device are (assuming four146modes): st0 nst0 st0l nst0l st0m nst0m st0a nst0a.147 148Each directory contains the entries: default_blksize default_compression149default_density defined dev device driver. The file 'defined' contains 1150if the mode is defined and zero if not defined. The files 'default_*' contain151the defaults set by the user. The value -1 means the default is not set. The152file 'dev' contains the device numbers corresponding to this device. The links153'device' and 'driver' point to the SCSI device and driver entries.154 155Each directory also contains the entry 'options' which shows the currently156enabled driver and mode options. The value in the file is a bit mask where the157bit definitions are the same as those used with MTSETDRVBUFFER in setting the158options.159 160A link named 'tape' is made from the SCSI device directory to the class161directory corresponding to the mode 0 auto-rewind device (e.g., st0).162 163 164Sysfs and Statistics for Tape Devices165=====================================166 167The st driver maintains statistics for tape drives inside the sysfs filesystem.168The following method can be used to locate the statistics that are169available (assuming that sysfs is mounted at /sys):170 1711. Use opendir(3) on the directory /sys/class/scsi_tape1722. Use readdir(3) to read the directory contents1733. Use regcomp(3)/regexec(3) to match directory entries to the extended174 regular expression "^st[0-9]+$"1754. Access the statistics from the /sys/class/scsi_tape/<match>/stats176 directory (where <match> is a directory entry from /sys/class/scsi_tape177 that matched the extended regular expression)178 179The reason for using this approach is that all the character devices180pointing to the same tape drive use the same statistics. That means181that st0 would have the same statistics as nst0.182 183The directory contains the following statistics files:184 1851. in_flight186 - The number of I/Os currently outstanding to this device.1872. io_ns188 - The amount of time spent waiting (in nanoseconds) for all I/O189 to complete (including read and write). This includes tape movement190 commands such as seeking between file or set marks and implicit tape191 movement such as when rewind on close tape devices are used.1923. other_cnt193 - The number of I/Os issued to the tape drive other than read or194 write commands. The time taken to complete these commands uses the195 following calculation io_ms-read_ms-write_ms.1964. read_byte_cnt197 - The number of bytes read from the tape drive.1985. read_cnt199 - The number of read requests issued to the tape drive.2006. read_ns201 - The amount of time (in nanoseconds) spent waiting for read202 requests to complete.2037. write_byte_cnt204 - The number of bytes written to the tape drive.2058. write_cnt206 - The number of write requests issued to the tape drive.2079. write_ns208 - The amount of time (in nanoseconds) spent waiting for write209 requests to complete.21010. resid_cnt211 - The number of times during a read or write we found212 the residual amount to be non-zero. This should mean that a program213 is issuing a read larger thean the block size on tape. For write214 not all data made it to tape.215 216.. Note::217 218 The in_flight value is incremented when an I/O starts the I/O219 itself is not added to the statistics until it completes.220 221The total of read_cnt, write_cnt, and other_cnt may not total to the same222value as iodone_cnt at the device level. The tape statistics only count223I/O issued via the st module.224 225When read the statistics may not be temporally consistent while I/O is in226progress. The individual values are read and written to atomically however227when reading them back via sysfs they may be in the process of being228updated when starting an I/O or when it is completed.229 230The value shown in in_flight is incremented before any statstics are231updated and decremented when an I/O completes after updating statistics.232The value of in_flight is 0 when there are no I/Os outstanding that are233issued by the st driver. Tape statistics do not take into account any234I/O performed via the sg device.235 236BSD and Sys V Semantics237=======================238 239The user can choose between these two behaviours of the tape driver by240defining the value of the symbol ST_SYSV. The semantics differ when a241file being read is closed. The BSD semantics leaves the tape where it242currently is whereas the SYS V semantics moves the tape past the next243filemark unless the filemark has just been crossed.244 245The default is BSD semantics.246 247 248Buffering249=========250 251The driver tries to do transfers directly to/from user space. If this252is not possible, a driver buffer allocated at run-time is used. If253direct i/o is not possible for the whole transfer, the driver buffer254is used (i.e., bounce buffers for individual pages are not255used). Direct i/o can be impossible because of several reasons, e.g.:256 257- one or more pages are at addresses not reachable by the HBA258- the number of pages in the transfer exceeds the number of259 scatter/gather segments permitted by the HBA260- one or more pages can't be locked into memory (should not happen in261 any reasonable situation)262 263The size of the driver buffers is always at least one tape block. In fixed264block mode, the minimum buffer size is defined (in 1024 byte units) by265ST_FIXED_BUFFER_BLOCKS. With small block size this allows buffering of266several blocks and using one SCSI read or write to transfer all of the267blocks. Buffering of data across write calls in fixed block mode is268allowed if ST_BUFFER_WRITES is non-zero and direct i/o is not used.269Buffer allocation uses chunks of memory having sizes 2^n * (page270size). Because of this the actual buffer size may be larger than the271minimum allowable buffer size.272 273NOTE that if direct i/o is used, the small writes are not buffered. This may274cause a surprise when moving from 2.4. There small writes (e.g., tar without275-b option) may have had good throughput but this is not true any more with2762.6. Direct i/o can be turned off to solve this problem but a better solution277is to use bigger write() byte counts (e.g., tar -b 64).278 279Asynchronous writing. Writing the buffer contents to the tape is280started and the write call returns immediately. The status is checked281at the next tape operation. Asynchronous writes are not done with282direct i/o and not in fixed block mode.283 284Buffered writes and asynchronous writes may in some rare cases cause285problems in multivolume operations if there is not enough space on the286tape after the early-warning mark to flush the driver buffer.287 288Read ahead for fixed block mode (ST_READ_AHEAD). Filling the buffer is289attempted even if the user does not want to get all of the data at290this read command. Should be disabled for those drives that don't like291a filemark to truncate a read request or that don't like backspacing.292 293Scatter/gather buffers (buffers that consist of chunks non-contiguous294in the physical memory) are used if contiguous buffers can't be295allocated. To support all SCSI adapters (including those not296supporting scatter/gather), buffer allocation is using the following297three kinds of chunks:298 2991. The initial segment that is used for all SCSI adapters including300 those not supporting scatter/gather. The size of this buffer will be301 (PAGE_SIZE << ST_FIRST_ORDER) bytes if the system can give a chunk of302 this size (and it is not larger than the buffer size specified by303 ST_BUFFER_BLOCKS). If this size is not available, the driver halves304 the size and tries again until the size of one page. The default305 settings in st_options.h make the driver to try to allocate all of the306 buffer as one chunk.3072. The scatter/gather segments to fill the specified buffer size are308 allocated so that as many segments as possible are used but the number309 of segments does not exceed ST_FIRST_SG.3103. The remaining segments between ST_MAX_SG (or the module parameter311 max_sg_segs) and the number of segments used in phases 1 and 2312 are used to extend the buffer at run-time if this is necessary. The313 number of scatter/gather segments allowed for the SCSI adapter is not314 exceeded if it is smaller than the maximum number of scatter/gather315 segments specified. If the maximum number allowed for the SCSI adapter316 is smaller than the number of segments used in phases 1 and 2,317 extending the buffer will always fail.318 319 320EOM Behaviour When Writing321==========================322 323When the end of medium early warning is encountered, the current write324is finished and the number of bytes is returned. The next write325returns -1 and errno is set to ENOSPC. To enable writing a trailer,326the next write is allowed to proceed and, if successful, the number of327bytes is returned. After this, -1 and the number of bytes are328alternately returned until the physical end of medium (or some other329error) is encountered.330 331Module Parameters332=================333 334The buffer size, write threshold, and the maximum number of allocated buffers335are configurable when the driver is loaded as a module. The keywords are:336 337========================== ===========================================338buffer_kbs=xxx the buffer size for fixed block mode is set339 to xxx kilobytes340write_threshold_kbs=xxx the write threshold in kilobytes set to xxx341max_sg_segs=xxx the maximum number of scatter/gather342 segments343try_direct_io=x try direct transfer between user buffer and344 tape drive if this is non-zero345========================== ===========================================346 347Note that if the buffer size is changed but the write threshold is not348set, the write threshold is set to the new buffer size - 2 kB.349 350 351Boot Time Configuration352=======================353 354If the driver is compiled into the kernel, the same parameters can be355also set using, e.g., the LILO command line. The preferred syntax is356to use the same keyword used when loading as module but prepended357with 'st.'. For instance, to set the maximum number of scatter/gather358segments, the parameter 'st.max_sg_segs=xx' should be used (xx is the359number of scatter/gather segments).360 361For compatibility, the old syntax from early 2.5 and 2.4 kernel362versions is supported. The same keywords can be used as when loading363the driver as module. If several parameters are set, the keyword-value364pairs are separated with a comma (no spaces allowed). A colon can be365used instead of the equal mark. The definition is prepended by the366string st=. Here is an example::367 368 st=buffer_kbs:64,write_threshold_kbs:60369 370The following syntax used by the old kernel versions is also supported::371 372 st=aa[,bb[,dd]]373 374where:375 376 - aa is the buffer size for fixed block mode in 1024 byte units377 - bb is the write threshold in 1024 byte units378 - dd is the maximum number of scatter/gather segments379 380 381IOCTLs382======383 384The tape is positioned and the drive parameters are set with ioctls385defined in mtio.h The tape control program 'mt' uses these ioctls. Try386to find an mt that supports all of the Linux SCSI tape ioctls and387opens the device for writing if the tape contents will be modified388(look for a package mt-st* from the Linux ftp sites; the GNU mt does389not open for writing for, e.g., erase).390 391The supported ioctls are:392 393The following use the structure mtop:394 395MTFSF396 Space forward over count filemarks. Tape positioned after filemark.397MTFSFM398 As above but tape positioned before filemark.399MTBSF400 Space backward over count filemarks. Tape positioned before401 filemark.402MTBSFM403 As above but ape positioned after filemark.404MTFSR405 Space forward over count records.406MTBSR407 Space backward over count records.408MTFSS409 Space forward over count setmarks.410MTBSS411 Space backward over count setmarks.412MTWEOF413 Write count filemarks.414MTWEOFI415 Write count filemarks with immediate bit set (i.e., does not416 wait until data is on tape)417MTWSM418 Write count setmarks.419MTREW420 Rewind tape.421MTOFFL422 Set device off line (often rewind plus eject).423MTNOP424 Do nothing except flush the buffers.425MTRETEN426 Re-tension tape.427MTEOM428 Space to end of recorded data.429MTERASE430 Erase tape. If the argument is zero, the short erase command431 is used. The long erase command is used with all other values432 of the argument.433MTSEEK434 Seek to tape block count. Uses Tandberg-compatible seek (QFA)435 for SCSI-1 drives and SCSI-2 seek for SCSI-2 drives. The file and436 block numbers in the status are not valid after a seek.437MTSETBLK438 Set the drive block size. Setting to zero sets the drive into439 variable block mode (if applicable).440MTSETDENSITY441 Sets the drive density code to arg. See drive442 documentation for available codes.443MTLOCK and MTUNLOCK444 Explicitly lock/unlock the tape drive door.445MTLOAD and MTUNLOAD446 Explicitly load and unload the tape. If the447 command argument x is between MT_ST_HPLOADER_OFFSET + 1 and448 MT_ST_HPLOADER_OFFSET + 6, the number x is used sent to the449 drive with the command and it selects the tape slot to use of450 HP C1553A changer.451MTCOMPRESSION452 Sets compressing or uncompressing drive mode using the453 SCSI mode page 15. Note that some drives other methods for454 control of compression. Some drives (like the Exabytes) use455 density codes for compression control. Some drives use another456 mode page but this page has not been implemented in the457 driver. Some drives without compression capability will accept458 any compression mode without error.459MTSETPART460 Moves the tape to the partition given by the argument at the461 next tape operation. The block at which the tape is positioned462 is the block where the tape was previously positioned in the463 new active partition unless the next tape operation is464 MTSEEK. In this case the tape is moved directly to the block465 specified by MTSEEK. MTSETPART is inactive unless466 MT_ST_CAN_PARTITIONS set.467MTMKPART468 Formats the tape with one partition (argument zero) or two469 partitions (argument non-zero). If the argument is positive,470 it specifies the size of partition 1 in megabytes. For DDS471 drives and several early drives this is the physically first472 partition of the tape. If the argument is negative, its absolute473 value specifies the size of partition 0 in megabytes. This is474 the physically first partition of many later drives, like the475 LTO drives from LTO-5 upwards. The drive has to support partitions476 with size specified by the initiator. Inactive unless477 MT_ST_CAN_PARTITIONS set.478MTSETDRVBUFFER479 Is used for several purposes. The command is obtained from count480 with mask MT_SET_OPTIONS, the low order bits are used as argument.481 This command is only allowed for the superuser (root). The482 subcommands are:483 484 * 0485 The drive buffer option is set to the argument. Zero means486 no buffering.487 * MT_ST_BOOLEANS488 Sets the buffering options. The bits are the new states489 (enabled/disabled) the following options (in the490 parenthesis is specified whether the option is global or491 can be specified differently for each mode):492 493 MT_ST_BUFFER_WRITES494 write buffering (mode)495 MT_ST_ASYNC_WRITES496 asynchronous writes (mode)497 MT_ST_READ_AHEAD498 read ahead (mode)499 MT_ST_TWO_FM500 writing of two filemarks (global)501 MT_ST_FAST_EOM502 using the SCSI spacing to EOD (global)503 MT_ST_AUTO_LOCK504 automatic locking of the drive door (global)505 MT_ST_DEF_WRITES506 the defaults are meant only for writes (mode)507 MT_ST_CAN_BSR508 backspacing over more than one records can509 be used for repositioning the tape (global)510 MT_ST_NO_BLKLIMS511 the driver does not ask the block limits512 from the drive (block size can be changed only to513 variable) (global)514 MT_ST_CAN_PARTITIONS515 enables support for partitioned516 tapes (global)517 MT_ST_SCSI2LOGICAL518 the logical block number is used in519 the MTSEEK and MTIOCPOS for SCSI-2 drives instead of520 the device dependent address. It is recommended to set521 this flag unless there are tapes using the device522 dependent (from the old times) (global)523 MT_ST_SYSV524 sets the SYSV semantics (mode)525 MT_ST_NOWAIT526 enables immediate mode (i.e., don't wait for527 the command to finish) for some commands (e.g., rewind)528 MT_ST_NOWAIT_EOF529 enables immediate filemark mode (i.e. when530 writing a filemark, don't wait for it to complete). Please531 see the BASICS note about MTWEOFI with respect to the532 possible dangers of writing immediate filemarks.533 MT_ST_SILI534 enables setting the SILI bit in SCSI commands when535 reading in variable block mode to enhance performance when536 reading blocks shorter than the byte count; set this only537 if you are sure that the drive supports SILI and the HBA538 correctly returns transfer residuals539 MT_ST_DEBUGGING540 debugging (global; debugging must be541 compiled into the driver)542 543 * MT_ST_SETBOOLEANS, MT_ST_CLEARBOOLEANS544 Sets or clears the option bits.545 * MT_ST_WRITE_THRESHOLD546 Sets the write threshold for this device to kilobytes547 specified by the lowest bits.548 * MT_ST_DEF_BLKSIZE549 Defines the default block size set automatically. Value550 0xffffff means that the default is not used any more.551 * MT_ST_DEF_DENSITY, MT_ST_DEF_DRVBUFFER552 Used to set or clear the density (8 bits), and drive buffer553 state (3 bits). If the value is MT_ST_CLEAR_DEFAULT554 (0xfffff) the default will not be used any more. Otherwise555 the lowermost bits of the value contain the new value of556 the parameter.557 * MT_ST_DEF_COMPRESSION558 The compression default will not be used if the value of559 the lowermost byte is 0xff. Otherwise the lowermost bit560 contains the new default. If the bits 8-15 are set to a561 non-zero number, and this number is not 0xff, the number is562 used as the compression algorithm. The value563 MT_ST_CLEAR_DEFAULT can be used to clear the compression564 default.565 * MT_ST_SET_TIMEOUT566 Set the normal timeout in seconds for this device. The567 default is 900 seconds (15 minutes). The timeout should be568 long enough for the retries done by the device while569 reading/writing.570 * MT_ST_SET_LONG_TIMEOUT571 Set the long timeout that is used for operations that are572 known to take a long time. The default is 14000 seconds573 (3.9 hours). For erase this value is further multiplied by574 eight.575 * MT_ST_SET_CLN576 Set the cleaning request interpretation parameters using577 the lowest 24 bits of the argument. The driver can set the578 generic status bit GMT_CLN if a cleaning request bit pattern579 is found from the extended sense data. Many drives set one or580 more bits in the extended sense data when the drive needs581 cleaning. The bits are device-dependent. The driver is582 given the number of the sense data byte (the lowest eight583 bits of the argument; must be >= 18 (values 1 - 17584 reserved) and <= the maximum requested sense data sixe),585 a mask to select the relevant bits (the bits 9-16), and the586 bit pattern (bits 17-23). If the bit pattern is zero, one587 or more bits under the mask indicate cleaning request. If588 the pattern is non-zero, the pattern must match the masked589 sense data byte.590 591 (The cleaning bit is set if the additional sense code and592 qualifier 00h 17h are seen regardless of the setting of593 MT_ST_SET_CLN.)594 595The following ioctl uses the structure mtpos:596 597MTIOCPOS598 Reads the current position from the drive. Uses599 Tandberg-compatible QFA for SCSI-1 drives and the SCSI-2600 command for the SCSI-2 drives.601 602The following ioctl uses the structure mtget to return the status:603 604MTIOCGET605 Returns some status information.606 The file number and block number within file are returned. The607 block is -1 when it can't be determined (e.g., after MTBSF).608 The drive type is either MTISSCSI1 or MTISSCSI2.609 The number of recovered errors since the previous status call610 is stored in the lower word of the field mt_erreg.611 The current block size and the density code are stored in the field612 mt_dsreg (shifts for the subfields are MT_ST_BLKSIZE_SHIFT and613 MT_ST_DENSITY_SHIFT).614 The GMT_xxx status bits reflect the drive status. GMT_DR_OPEN615 is set if there is no tape in the drive. GMT_EOD means either616 end of recorded data or end of tape. GMT_EOT means end of tape.617 618 619Miscellaneous Compile Options620=============================621 622The recovered write errors are considered fatal if ST_RECOVERED_WRITE_FATAL623is defined.624 625The maximum number of tape devices is determined by the define626ST_MAX_TAPES. If more tapes are detected at driver initialization, the627maximum is adjusted accordingly.628 629Immediate return from tape positioning SCSI commands can be enabled by630defining ST_NOWAIT. If this is defined, the user should take care that631the next tape operation is not started before the previous one has632finished. The drives and SCSI adapters should handle this condition633gracefully, but some drive/adapter combinations are known to hang the634SCSI bus in this case.635 636The MTEOM command is by default implemented as spacing over 32767637filemarks. With this method the file number in the status is638correct. The user can request using direct spacing to EOD by setting639ST_FAST_EOM 1 (or using the MT_ST_OPTIONS ioctl). In this case the file640number will be invalid.641 642When using read ahead or buffered writes the position within the file643may not be correct after the file is closed (correct position may644require backspacing over more than one record). The correct position645within file can be obtained if ST_IN_FILE_POS is defined at compile646time or the MT_ST_CAN_BSR bit is set for the drive with an ioctl.647(The driver always backs over a filemark crossed by read ahead if the648user does not request data that far.)649 650 651Debugging Hints652===============653 654Debugging code is now compiled in by default but debugging is turned off655with the kernel module parameter debug_flag defaulting to 0. Debugging656can still be switched on and off with an ioctl. To enable debug at657module load time add debug_flag=1 to the module load options, the658debugging output is not voluminous. Debugging can also be enabled659and disabled by writing a '0' (disable) or '1' (enable) to the sysfs660file /sys/bus/scsi/drivers/st/debug_flag.661 662If the tape seems to hang, I would be very interested to hear where663the driver is waiting. With the command 'ps -l' you can see the state664of the process using the tape. If the state is D, the process is665waiting for something. The field WCHAN tells where the driver is666waiting. If you have the current System.map in the correct place (in667/boot for the procps I use) or have updated /etc/psdatabase (for kmem668ps), ps writes the function name in the WCHAN field. If not, you have669to look up the function from System.map.670 671Note also that the timeouts are very long compared to most other672drivers. This means that the Linux driver may appear hung although the673real reason is that the tape firmware has got confused.674