1ST(4) Linux Programmer's Manual ST(4)
2
3
4
6 st - SCSI tape device
7
9 #include <sys/mtio.h>
10
11 int ioctl(int fd, int request [, (void *)arg3]);
12 int ioctl(int fd, MTIOCTOP, (struct mtop *)mt_cmd);
13 int ioctl(int fd, MTIOCGET, (struct mtget *)mt_status);
14 int ioctl(int fd, MTIOCPOS, (struct mtpos *)mt_pos);
15
17 The st driver provides the interface to a variety of SCSI tape devices.
18 Currently, the driver takes control of all detected devices of type
19 “sequential-access”. The st driver uses major device number 9.
20
21 Each device uses eight minor device numbers. The lowermost five bits
22 in the minor numbers are assigned sequentially in the order of detec‐
23 tion. In the 2.6 kernel, the bits above the eight lowermost bits are
24 concatenated to the five lowermost bits to form the tape number. The
25 minor numbers can be grouped into two sets of four numbers: the princi‐
26 pal (auto-rewind) minor device numbers, n, and the “no-rewind” device
27 numbers, (n + 128). Devices opened using the principal device number
28 will be sent a REWIND command when they are closed. Devices opened us‐
29 ing the “no-rewind” device number will not. (Note that using an auto-
30 rewind device for positioning the tape with, for instance, mt does not
31 lead to the desired result: the tape is rewound after the mt command
32 and the next command starts from the beginning of the tape).
33
34 Within each group, four minor numbers are available to define devices
35 with different characteristics (block size, compression, density, etc.)
36 When the system starts up, only the first device is available. The
37 other three are activated when the default characteristics are defined
38 (see below). (By changing compile-time constants, it is possible to
39 change the balance between the maximum number of tape drives and the
40 number of minor numbers for each drive. The default allocation allows
41 control of 32 tape drives. For instance, it is possible to control up
42 to 64 tape drives with two minor numbers for different options.)
43
44 Devices are typically created by:
45
46 mknod -m 666 /dev/st0 c 9 0
47 mknod -m 666 /dev/st0l c 9 32
48 mknod -m 666 /dev/st0m c 9 64
49 mknod -m 666 /dev/st0a c 9 96
50 mknod -m 666 /dev/nst0 c 9 128
51 mknod -m 666 /dev/nst0l c 9 160
52 mknod -m 666 /dev/nst0m c 9 192
53 mknod -m 666 /dev/nst0a c 9 224
54
55 There is no corresponding block device.
56
57 The driver uses an internal buffer that has to be large enough to hold
58 at least one tape block. In kernels before 2.1.121, the buffer is al‐
59 located as one contiguous block. This limits the block size to the
60 largest contiguous block of memory the kernel allocator can provide.
61 The limit is currently 128 kB for 32-bit architectures and 256 kB for
62 64-bit architectures. In newer kernels the driver allocates the buffer
63 in several parts if necessary. By default, the maximum number of parts
64 is 16. This means that the maximum block size is very large (2 MB if
65 allocation of 16 blocks of 128 kB succeeds).
66
67 The driver's internal buffer size is determined by a compile-time con‐
68 stant which can be overridden with a kernel startup option. In addi‐
69 tion to this, the driver tries to allocate a larger temporary buffer at
70 run time if necessary. However, run-time allocation of large contigu‐
71 ous blocks of memory may fail and it is advisable not to rely too much
72 on dynamic buffer allocation with kernels older than 2.1.121 (this ap‐
73 plies also to demand-loading the driver with kerneld or kmod).
74
75 The driver does not specifically support any tape drive brand or model.
76 After system start-up the tape device options are defined by the drive
77 firmware. For example, if the drive firmware selects fixed-block mode,
78 the tape device uses fixed-block mode. The options can be changed with
79 explicit ioctl(2) calls and remain in effect when the device is closed
80 and reopened. Setting the options affects both the auto-rewind and the
81 nonrewind device.
82
83 Different options can be specified for the different devices within the
84 subgroup of four. The options take effect when the device is opened.
85 For example, the system administrator can define one device that writes
86 in fixed-block mode with a certain block size, and one which writes in
87 variable-block mode (if the drive supports both modes).
88
89 The driver supports tape partitions if they are supported by the drive.
90 (Note that the tape partitions have nothing to do with disk partitions.
91 A partitioned tape can be seen as several logical tapes within one
92 medium.) Partition support has to be enabled with an ioctl(2). The
93 tape location is preserved within each partition across partition
94 changes. The partition used for subsequent tape operations is selected
95 with an ioctl(2). The partition switch is executed together with the
96 next tape operation in order to avoid unnecessary tape movement. The
97 maximum number of partitions on a tape is defined by a compile-time
98 constant (originally four). The driver contains an ioctl(2) that can
99 format a tape with either one or two partitions.
100
101 Device /dev/tape is usually created as a hard or soft link to the de‐
102 fault tape device on the system.
103
104 Starting from kernel 2.6.2, the driver exports in the sysfs directory
105 /sys/class/scsi_tape the attached devices and some parameters assigned
106 to the devices.
107
108 Data transfer
109 The driver supports operation in both fixed-block mode and variable-
110 block mode (if supported by the drive). In fixed-block mode the drive
111 writes blocks of the specified size and the block size is not dependent
112 on the byte counts of the write system calls. In variable-block mode
113 one tape block is written for each write call and the byte count deter‐
114 mines the size of the corresponding tape block. Note that the blocks
115 on the tape don't contain any information about the writing mode: when
116 reading, the only important thing is to use commands that accept the
117 block sizes on the tape.
118
119 In variable-block mode the read byte count does not have to match the
120 tape block size exactly. If the byte count is larger than the next
121 block on tape, the driver returns the data and the function returns the
122 actual block size. If the block size is larger than the byte count, an
123 error is returned.
124
125 In fixed-block mode the read byte counts can be arbitrary if buffering
126 is enabled, or a multiple of the tape block size if buffering is dis‐
127 abled. Kernels before 2.1.121 allow writes with arbitrary byte count
128 if buffering is enabled. In all other cases (kernel before 2.1.121
129 with buffering disabled or newer kernel) the write byte count must be a
130 multiple of the tape block size.
131
132 In the 2.6 kernel, the driver tries to use direct transfers between the
133 user buffer and the device. If this is not possible, the driver's in‐
134 ternal buffer is used. The reasons for not using direct transfers in‐
135 clude improper alignment of the user buffer (default is 512 bytes but
136 this can be changed by the HBA driver), one or more pages of the user
137 buffer not reachable by the SCSI adapter, and so on.
138
139 A filemark is automatically written to tape if the last tape operation
140 before close was a write.
141
142 When a filemark is encountered while reading, the following happens.
143 If there are data remaining in the buffer when the filemark is found,
144 the buffered data is returned. The next read returns zero bytes. The
145 following read returns data from the next file. The end of recorded
146 data is signaled by returning zero bytes for two consecutive read
147 calls. The third read returns an error.
148
149 Ioctls
150 The driver supports three ioctl(2) requests. Requests not recognized
151 by the st driver are passed to the SCSI driver. The definitions below
152 are from /usr/include/linux/mtio.h:
153
154 MTIOCTOP — perform a tape operation
155 This request takes an argument of type (struct mtop *). Not all drives
156 support all operations. The driver returns an EIO error if the drive
157 rejects an operation.
158
159 /* Structure for MTIOCTOP - mag tape op command: */
160 struct mtop {
161 short mt_op; /* operations defined below */
162 int mt_count; /* how many of them */
163 };
164
165 Magnetic tape operations for normal tape use:
166
167 MTBSF Backward space over mt_count filemarks.
168
169 MTBSFM Backward space over mt_count filemarks. Reposition the tape to
170 the EOT side of the last filemark.
171
172 MTBSR Backward space over mt_count records (tape blocks).
173
174 MTBSS Backward space over mt_count setmarks.
175
176 MTCOMPRESSION
177 Enable compression of tape data within the drive if mt_count is
178 nonzero and disable compression if mt_count is zero. This com‐
179 mand uses the MODE page 15 supported by most DATs.
180
181 MTEOM Go to the end of the recorded media (for appending files).
182
183 MTERASE
184 Erase tape. With 2.6 kernel, short erase (mark tape empty) is
185 performed if the argument is zero. Otherwise, long erase (erase
186 all) is done.
187
188 MTFSF Forward space over mt_count filemarks.
189
190 MTFSFM Forward space over mt_count filemarks. Reposition the tape to
191 the BOT side of the last filemark.
192
193 MTFSR Forward space over mt_count records (tape blocks).
194
195 MTFSS Forward space over mt_count setmarks.
196
197 MTLOAD Execute the SCSI load command. A special case is available for
198 some HP autoloaders. If mt_count is the constant
199 MT_ST_HPLOADER_OFFSET plus a number, the number is sent to the
200 drive to control the autoloader.
201
202 MTLOCK Lock the tape drive door.
203
204 MTMKPART
205 Format the tape into one or two partitions. If mt_count is pos‐
206 itive, it gives the size of partition 1 and partition 0 contains
207 the rest of the tape. If mt_count is zero, the tape is format‐
208 ted into one partition. From kernel version 4.6, a negative
209 mt_count specifies the size of partition 0 and the rest of the
210 tape contains partition 1. The physical ordering of partitions
211 depends on the drive. This command is not allowed for a drive
212 unless the partition support is enabled for the drive (see
213 MT_ST_CAN_PARTITIONS below).
214
215 MTNOP No op—flushes the driver's buffer as a side effect. Should be
216 used before reading status with MTIOCGET.
217
218 MTOFFL Rewind and put the drive off line.
219
220 MTRESET
221 Reset drive.
222
223 MTRETEN
224 Re-tension tape.
225
226 MTREW Rewind.
227
228 MTSEEK Seek to the tape block number specified in mt_count. This oper‐
229 ation requires either a SCSI-2 drive that supports the LOCATE
230 command (device-specific address) or a Tandberg-compatible
231 SCSI-1 drive (Tandberg, Archive Viper, Wangtek, ...). The block
232 number should be one that was previously returned by MTIOCPOS if
233 device-specific addresses are used.
234
235 MTSETBLK
236 Set the drive's block length to the value specified in mt_count.
237 A block length of zero sets the drive to variable block size
238 mode.
239
240 MTSETDENSITY
241 Set the tape density to the code in mt_count. The density codes
242 supported by a drive can be found from the drive documentation.
243
244 MTSETPART
245 The active partition is switched to mt_count. The partitions
246 are numbered from zero. This command is not allowed for a drive
247 unless the partition support is enabled for the drive (see
248 MT_ST_CAN_PARTITIONS below).
249
250 MTUNLOAD
251 Execute the SCSI unload command (does not eject the tape).
252
253 MTUNLOCK
254 Unlock the tape drive door.
255
256 MTWEOF Write mt_count filemarks.
257
258 MTWSM Write mt_count setmarks.
259
260 Magnetic tape operations for setting of device options (by the supe‐
261 ruser):
262
263 MTSETDRVBUFFER
264 Set various drive and driver options according to bits encoded
265 in mt_count. These consist of the drive's buffering mode, a set
266 of Boolean driver options, the buffer write threshold, defaults
267 for the block size and density, and timeouts (only in kernels
268 2.1 and later). A single operation can affect only one item in
269 the list below (the Booleans counted as one item.)
270
271 A value having zeros in the high-order 4 bits will be used to
272 set the drive's buffering mode. The buffering modes are:
273
274 0 The drive will not report GOOD status on write commands
275 until the data blocks are actually written to the
276 medium.
277
278 1 The drive may report GOOD status on write commands as
279 soon as all the data has been transferred to the
280 drive's internal buffer.
281
282 2 The drive may report GOOD status on write commands as
283 soon as (a) all the data has been transferred to the
284 drive's internal buffer, and (b) all buffered data from
285 different initiators has been successfully written to
286 the medium.
287
288 To control the write threshold the value in mt_count must in‐
289 clude the constant MT_ST_WRITE_THRESHOLD bitwise ORed with a
290 block count in the low 28 bits. The block count refers to
291 1024-byte blocks, not the physical block size on the tape. The
292 threshold cannot exceed the driver's internal buffer size (see
293 DESCRIPTION, above).
294
295 To set and clear the Boolean options the value in mt_count must
296 include one of the constants MT_ST_BOOLEANS, MT_ST_SETBOOLEANS,
297 MT_ST_CLEARBOOLEANS, or MT_ST_DEFBOOLEANS bitwise ORed with
298 whatever combination of the following options is desired. Using
299 MT_ST_BOOLEANS the options can be set to the values defined in
300 the corresponding bits. With MT_ST_SETBOOLEANS the options can
301 be selectively set and with MT_ST_DEFBOOLEANS selectively
302 cleared.
303
304 The default options for a tape device are set with MT_ST_DEF‐
305 BOOLEANS. A nonactive tape device (e.g., device with minor 32
306 or 160) is activated when the default options for it are defined
307 the first time. An activated device inherits from the device
308 activated at start-up the options not set explicitly.
309
310 The Boolean options are:
311
312 MT_ST_BUFFER_WRITES (Default: true)
313 Buffer all write operations in fixed-block mode. If this
314 option is false and the drive uses a fixed block size,
315 then all write operations must be for a multiple of the
316 block size. This option must be set false to write reli‐
317 able multivolume archives.
318
319 MT_ST_ASYNC_WRITES (Default: true)
320 When this option is true, write operations return immedi‐
321 ately without waiting for the data to be transferred to
322 the drive if the data fits into the driver's buffer. The
323 write threshold determines how full the buffer must be
324 before a new SCSI write command is issued. Any errors
325 reported by the drive will be held until the next opera‐
326 tion. This option must be set false to write reliable
327 multivolume archives.
328
329 MT_ST_READ_AHEAD (Default: true)
330 This option causes the driver to provide read buffering
331 and read-ahead in fixed-block mode. If this option is
332 false and the drive uses a fixed block size, then all
333 read operations must be for a multiple of the block size.
334
335 MT_ST_TWO_FM (Default: false)
336 This option modifies the driver behavior when a file is
337 closed. The normal action is to write a single filemark.
338 If the option is true, the driver will write two file‐
339 marks and backspace over the second one.
340
341 Note: This option should not be set true for QIC tape
342 drives since they are unable to overwrite a filemark.
343 These drives detect the end of recorded data by testing
344 for blank tape rather than two consecutive filemarks.
345 Most other current drives also detect the end of recorded
346 data and using two filemarks is usually necessary only
347 when interchanging tapes with some other systems.
348
349 MT_ST_DEBUGGING (Default: false)
350 This option turns on various debugging messages from the
351 driver (effective only if the driver was compiled with
352 DEBUG defined nonzero).
353
354 MT_ST_FAST_EOM (Default: false)
355 This option causes the MTEOM operation to be sent di‐
356 rectly to the drive, potentially speeding up the opera‐
357 tion but causing the driver to lose track of the current
358 file number normally returned by the MTIOCGET request.
359 If MT_ST_FAST_EOM is false, the driver will respond to an
360 MTEOM request by forward spacing over files.
361
362 MT_ST_AUTO_LOCK (Default: false)
363 When this option is true, the drive door is locked when
364 the device file is opened and unlocked when it is closed.
365
366 MT_ST_DEF_WRITES (Default: false)
367 The tape options (block size, mode, compression, etc.)
368 may change when changing from one device linked to a
369 drive to another device linked to the same drive depend‐
370 ing on how the devices are defined. This option defines
371 when the changes are enforced by the driver using SCSI-
372 commands and when the drives auto-detection capabilities
373 are relied upon. If this option is false, the driver
374 sends the SCSI-commands immediately when the device is
375 changed. If the option is true, the SCSI-commands are
376 not sent until a write is requested. In this case, the
377 drive firmware is allowed to detect the tape structure
378 when reading and the SCSI-commands are used only to make
379 sure that a tape is written according to the correct
380 specification.
381
382 MT_ST_CAN_BSR (Default: false)
383 When read-ahead is used, the tape must sometimes be
384 spaced backward to the correct position when the device
385 is closed and the SCSI command to space backward over
386 records is used for this purpose. Some older drives
387 can't process this command reliably and this option can
388 be used to instruct the driver not to use the command.
389 The end result is that, with read-ahead and fixed-block
390 mode, the tape may not be correctly positioned within a
391 file when the device is closed. With 2.6 kernel, the de‐
392 fault is true for drives supporting SCSI-3.
393
394 MT_ST_NO_BLKLIMS (Default: false)
395 Some drives don't accept the READ BLOCK LIMITS SCSI com‐
396 mand. If this is used, the driver does not use the com‐
397 mand. The drawback is that the driver can't check before
398 sending commands if the selected block size is acceptable
399 to the drive.
400
401 MT_ST_CAN_PARTITIONS (Default: false)
402 This option enables support for several partitions within
403 a tape. The option applies to all devices linked to a
404 drive.
405
406 MT_ST_SCSI2LOGICAL (Default: false)
407 This option instructs the driver to use the logical block
408 addresses defined in the SCSI-2 standard when performing
409 the seek and tell operations (both with MTSEEK and MTIOC‐
410 POS commands and when changing tape partition). Other‐
411 wise, the device-specific addresses are used. It is
412 highly advisable to set this option if the drive supports
413 the logical addresses because they count also filemarks.
414 There are some drives that support only the logical block
415 addresses.
416
417 MT_ST_SYSV (Default: false)
418 When this option is enabled, the tape devices use the
419 System V semantics. Otherwise, the BSD semantics are
420 used. The most important difference between the seman‐
421 tics is what happens when a device used for reading is
422 closed: in System V semantics the tape is spaced forward
423 past the next filemark if this has not happened while us‐
424 ing the device. In BSD semantics the tape position is
425 not changed.
426
427 MT_NO_WAIT (Default: false)
428 Enables immediate mode (i.e., don't wait for the command
429 to finish) for some commands (e.g., rewind).
430
431 An example:
432
433 struct mtop mt_cmd;
434 mt_cmd.mt_op = MTSETDRVBUFFER;
435 mt_cmd.mt_count = MT_ST_BOOLEANS |
436 MT_ST_BUFFER_WRITES | MT_ST_ASYNC_WRITES;
437 ioctl(fd, MTIOCTOP, mt_cmd);
438
439 The default block size for a device can be set with
440 MT_ST_DEF_BLKSIZE and the default density code can be set with
441 MT_ST_DEFDENSITY. The values for the parameters are or'ed with
442 the operation code.
443
444 With kernels 2.1.x and later, the timeout values can be set with
445 the subcommand MT_ST_SET_TIMEOUT ORed with the timeout in sec‐
446 onds. The long timeout (used for rewinds and other commands
447 that may take a long time) can be set with MT_ST_SET_LONG_TIME‐
448 OUT. The kernel defaults are very long to make sure that a suc‐
449 cessful command is not timed out with any drive. Because of
450 this, the driver may seem stuck even if it is only waiting for
451 the timeout. These commands can be used to set more practical
452 values for a specific drive. The timeouts set for one device
453 apply for all devices linked to the same drive.
454
455 Starting from kernels 2.4.19 and 2.5.43, the driver supports a
456 status bit which indicates whether the drive requests cleaning.
457 The method used by the drive to return cleaning information is
458 set using the MT_ST_SEL_CLN subcommand. If the value is zero,
459 the cleaning bit is always zero. If the value is one, the
460 TapeAlert data defined in the SCSI-3 standard is used (not yet
461 implemented). Values 2–17 are reserved. If the lowest eight
462 bits are >= 18, bits from the extended sense data are used. The
463 bits 9–16 specify a mask to select the bits to look at and the
464 bits 17–23 specify the bit pattern to look for. If the bit pat‐
465 tern is zero, one or more bits under the mask indicate the
466 cleaning request. If the pattern is nonzero, the pattern must
467 match the masked sense data byte.
468
469 MTIOCGET — get status
470 This request takes an argument of type (struct mtget *).
471
472 /* structure for MTIOCGET - mag tape get status command */
473 struct mtget {
474 long mt_type;
475 long mt_resid;
476 /* the following registers are device dependent */
477 long mt_dsreg;
478 long mt_gstat;
479 long mt_erreg;
480 /* The next two fields are not always used */
481 daddr_t mt_fileno;
482 daddr_t mt_blkno;
483 };
484
485 mt_type
486 The header file defines many values for mt_type, but the current
487 driver reports only the generic types MT_ISSCSI1 (Generic SCSI-1
488 tape) and MT_ISSCSI2 (Generic SCSI-2 tape).
489
490 mt_resid
491 contains the current tape partition number.
492
493 mt_dsreg
494 reports the drive's current settings for block size (in the low
495 24 bits) and density (in the high 8 bits). These fields are de‐
496 fined by MT_ST_BLKSIZE_SHIFT, MT_ST_BLKSIZE_MASK, MT_ST_DEN‐
497 SITY_SHIFT, and MT_ST_DENSITY_MASK.
498
499 mt_gstat
500 reports generic (device independent) status information. The
501 header file defines macros for testing these status bits:
502
503 GMT_EOF(x): The tape is positioned just after a filemark (always
504 false after an MTSEEK operation).
505
506 GMT_BOT(x): The tape is positioned at the beginning of the first
507 file (always false after an MTSEEK operation).
508
509 GMT_EOT(x): A tape operation has reached the physical End Of
510 Tape.
511
512 GMT_SM(x): The tape is currently positioned at a setmark (always
513 false after an MTSEEK operation).
514
515 GMT_EOD(x): The tape is positioned at the end of recorded data.
516
517 GMT_WR_PROT(x): The drive is write-protected. For some drives
518 this can also mean that the drive does not support writing
519 on the current medium type.
520
521 GMT_ONLINE(x): The last open(2) found the drive with a tape in
522 place and ready for operation.
523
524 GMT_D_6250(x), GMT_D_1600(x), GMT_D_800(x): This “generic” sta‐
525 tus information reports the current density setting for
526 9-track ½" tape drives only.
527
528 GMT_DR_OPEN(x): The drive does not have a tape in place.
529
530 GMT_IM_REP_EN(x): Immediate report mode. This bit is set if
531 there are no guarantees that the data has been physically
532 written to the tape when the write call returns. It is set
533 zero only when the driver does not buffer data and the drive
534 is set not to buffer data.
535
536 GMT_CLN(x): The drive has requested cleaning. Implemented in
537 kernels since 2.4.19 and 2.5.43.
538
539 mt_erreg
540 The only field defined in mt_erreg is the recovered error count
541 in the low 16 bits (as defined by MT_ST_SOFTERR_SHIFT and
542 MT_ST_SOFTERR_MASK). Due to inconsistencies in the way drives
543 report recovered errors, this count is often not maintained
544 (most drives do not by default report soft errors but this can
545 be changed with a SCSI MODE SELECT command).
546
547 mt_fileno
548 reports the current file number (zero-based). This value is set
549 to -1 when the file number is unknown (e.g., after MTBSS or MT‐
550 SEEK).
551
552 mt_blkno
553 reports the block number (zero-based) within the current file.
554 This value is set to -1 when the block number is unknown (e.g.,
555 after MTBSF, MTBSS, or MTSEEK).
556
557 MTIOCPOS — get tape position
558 This request takes an argument of type (struct mtpos *) and reports the
559 drive's notion of the current tape block number, which is not the same
560 as mt_blkno returned by MTIOCGET. This drive must be a SCSI-2 drive
561 that supports the READ POSITION command (device-specific address) or a
562 Tandberg-compatible SCSI-1 drive (Tandberg, Archive Viper, Wangtek, ...
563 ).
564
565 /* structure for MTIOCPOS - mag tape get position command */
566 struct mtpos {
567 long mt_blkno; /* current block number */
568 };
569
571 EACCES An attempt was made to write or erase a write-protected tape.
572 (This error is not detected during open(2).)
573
574 EBUSY The device is already in use or the driver was unable to allo‐
575 cate a buffer.
576
577 EFAULT The command parameters point to memory not belonging to the
578 calling process.
579
580 EINVAL An ioctl(2) had an invalid argument, or a requested block size
581 was invalid.
582
583 EIO The requested operation could not be completed.
584
585 ENOMEM The byte count in read(2) is smaller than the next physical
586 block on the tape. (Before 2.2.18 and 2.4.0 the extra bytes
587 have been silently ignored.)
588
589 ENOSPC A write operation could not be completed because the tape
590 reached end-of-medium.
591
592 ENOSYS Unknown ioctl(2).
593
594 ENXIO During opening, the tape device does not exist.
595
596 EOVERFLOW
597 An attempt was made to read or write a variable-length block
598 that is larger than the driver's internal buffer.
599
600 EROFS Open is attempted with O_WRONLY or O_RDWR when the tape in the
601 drive is write-protected.
602
604 /dev/st*
605 the auto-rewind SCSI tape devices
606
607 /dev/nst*
608 the nonrewind SCSI tape devices
609
611 1. When exchanging data between systems, both systems have to agree on
612 the physical tape block size. The parameters of a drive after
613 startup are often not the ones most operating systems use with
614 these devices. Most systems use drives in variable-block mode if
615 the drive supports that mode. This applies to most modern drives,
616 including DATs, 8mm helical scan drives, DLTs, etc. It may be ad‐
617 visable to use these drives in variable-block mode also in Linux
618 (i.e., use MTSETBLK or MTSETDEFBLK at system startup to set the
619 mode), at least when exchanging data with a foreign system. The
620 drawback of this is that a fairly large tape block size has to be
621 used to get acceptable data transfer rates on the SCSI bus.
622
623 2. Many programs (e.g., tar(1)) allow the user to specify the blocking
624 factor on the command line. Note that this determines the physical
625 block size on tape only in variable-block mode.
626
627 3. In order to use SCSI tape drives, the basic SCSI driver, a SCSI-
628 adapter driver and the SCSI tape driver must be either configured
629 into the kernel or loaded as modules. If the SCSI-tape driver is
630 not present, the drive is recognized but the tape support described
631 in this page is not available.
632
633 4. The driver writes error messages to the console/log. The SENSE
634 codes written into some messages are automatically translated to
635 text if verbose SCSI messages are enabled in kernel configuration.
636
637 5. The driver's internal buffering allows good throughput in fixed-
638 block mode also with small read(2) and write(2) byte counts. With
639 direct transfers this is not possible and may cause a surprise when
640 moving to the 2.6 kernel. The solution is to tell the software to
641 use larger transfers (often telling it to use larger blocks). If
642 this is not possible, direct transfers can be disabled.
643
645 mt(1)
646
647 The file drivers/scsi/README.st or Documentation/scsi/st.txt (kernel >=
648 2.6) in the Linux kernel source tree contains the most recent informa‐
649 tion about the driver and its configuration possibilities
650
652 This page is part of release 5.13 of the Linux man-pages project. A
653 description of the project, information about reporting bugs, and the
654 latest version of this page, can be found at
655 https://www.kernel.org/doc/man-pages/.
656
657
658
659Linux 2020-04-11 ST(4)