{
    "content": [
        {
            "type": "text",
            "text": "# ST (man)\n\n## NAME\n\nst - SCSI tape device\n\n## DESCRIPTION\n\nThe  st  driver  provides  the  interface  to a variety of SCSI tape devices.  Currently, the\ndriver takes control of all detected devices of type “sequential-access”.  The st driver uses\nmajor device number 9.\n\n## TLDR\n\n> `st` can refer to multiple commands with the same name.\n\n- View documentation for the terminal emulator:\n  `tldr st.term`\n- View documentation for the statistics tool:\n  `tldr st.stat`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS** (1 subsections)\n- **DESCRIPTION** (2 subsections)\n- **RETURN VALUE**\n- **FILES**\n- **NOTES**\n- **SEE ALSO**\n- **COLOPHON**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ST",
        "section": "",
        "mode": "man",
        "summary": "st - SCSI tape device",
        "synopsis": "",
        "tldr_summary": "`st` can refer to multiple commands with the same name.",
        "tldr_examples": [
            {
                "description": "View documentation for the terminal emulator",
                "command": "tldr st.term"
            },
            {
                "description": "View documentation for the statistics tool",
                "command": "tldr st.stat"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "mt",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/mt/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "#include <sys/mtio.h>",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 77,
                "subsections": [
                    {
                        "name": "Data transfer",
                        "lines": 34
                    },
                    {
                        "name": "Ioctls",
                        "lines": 362
                    }
                ]
            },
            {
                "name": "RETURN VALUE",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "COLOPHON",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "st - SCSI tape device\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "",
                "subsections": [
                    {
                        "name": "#include <sys/mtio.h>",
                        "content": "int ioctl(int fd, int request [, (void *)arg3]);\nint ioctl(int fd, MTIOCTOP, (struct mtop *)mtcmd);\nint ioctl(int fd, MTIOCGET, (struct mtget *)mtstatus);\nint ioctl(int fd, MTIOCPOS, (struct mtpos *)mtpos);\n"
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "The  st  driver  provides  the  interface  to a variety of SCSI tape devices.  Currently, the\ndriver takes control of all detected devices of type “sequential-access”.  The st driver uses\nmajor device number 9.\n\nEach  device  uses  eight minor device numbers.  The lowermost five bits in the minor numbers\nare assigned sequentially in the order of detection.  In the 2.6 kernel, the bits  above  the\neight  lowermost  bits  are  concatenated to the five lowermost bits to form the tape number.\nThe minor numbers can be grouped into two sets of four numbers: the  principal  (auto-rewind)\nminor device numbers, n, and the “no-rewind” device numbers, (n + 128).  Devices opened using\nthe principal device number will be sent a REWIND command  when  they  are  closed.   Devices\nopened  using the “no-rewind” device number will not.  (Note that using an auto-rewind device\nfor positioning the tape with, for instance, mt does not lead to the desired result: the tape\nis rewound after the mt command and the next command starts from the beginning of the tape).\n\nWithin  each group, four minor numbers are available to define devices with different charac‐\nteristics (block size, compression, density, etc.)  When the system starts up, only the first\ndevice  is available.  The other three are activated when the default characteristics are de‐\nfined (see below).  (By changing compile-time constants, it is possible to change the balance\nbetween  the  maximum  number  of tape drives and the number of minor numbers for each drive.\nThe default allocation allows control of 32 tape drives.  For instance,  it  is  possible  to\ncontrol up to 64 tape drives with two minor numbers for different options.)\n\nDevices are typically created by:\n\nmknod -m 666 /dev/st0 c 9 0\nmknod -m 666 /dev/st0l c 9 32\nmknod -m 666 /dev/st0m c 9 64\nmknod -m 666 /dev/st0a c 9 96\nmknod -m 666 /dev/nst0 c 9 128\nmknod -m 666 /dev/nst0l c 9 160\nmknod -m 666 /dev/nst0m c 9 192\nmknod -m 666 /dev/nst0a c 9 224\n\nThere is no corresponding block device.\n\nThe  driver  uses  an  internal  buffer that has to be large enough to hold at least one tape\nblock.  In kernels before 2.1.121, the buffer is allocated as  one  contiguous  block.   This\nlimits the block size to the largest contiguous block of memory the kernel allocator can pro‐\nvide.  The limit is currently 128 kB for 32-bit architectures and 256 kB for 64-bit architec‐\ntures.   In  newer kernels the driver allocates the buffer in several parts if necessary.  By\ndefault, the maximum number of parts is 16.  This means that the maximum block size  is  very\nlarge (2 MB if allocation of 16 blocks of 128 kB succeeds).\n\nThe driver's internal buffer size is determined by a compile-time constant which can be over‐\nridden with a kernel startup option.  In addition to this, the driver  tries  to  allocate  a\nlarger temporary buffer at run time if necessary.  However, run-time allocation of large con‐\ntiguous blocks of memory may fail and it is advisable not to rely too much on dynamic  buffer\nallocation  with  kernels  older than 2.1.121 (this applies also to demand-loading the driver\nwith kerneld or kmod).\n\nThe driver does not specifically support any tape drive brand or model.  After system  start-\nup  the  tape  device  options  are defined by the drive firmware.  For example, if the drive\nfirmware selects fixed-block mode, the tape device uses fixed-block mode.  The options can be\nchanged  with  explicit ioctl(2) calls and remain in effect when the device is closed and re‐\nopened.  Setting the options affects both the auto-rewind and the nonrewind device.\n\nDifferent options can be specified for the different devices within  the  subgroup  of  four.\nThe options take effect when the device is opened.  For example, the system administrator can\ndefine one device that writes in fixed-block mode with a certain block size,  and  one  which\nwrites in variable-block mode (if the drive supports both modes).\n\nThe  driver supports tape partitions if they are supported by the drive.  (Note that the tape\npartitions have nothing to do with disk partitions.  A partitioned tape can be seen  as  sev‐\neral logical tapes within one medium.)  Partition support has to be enabled with an ioctl(2).\nThe tape location is preserved within each partition across partition changes.  The partition\nused  for  subsequent  tape operations is selected with an ioctl(2).  The partition switch is\nexecuted together with the next tape operation in order to avoid unnecessary  tape  movement.\nThe  maximum number of partitions on a tape is defined by a compile-time constant (originally\nfour).  The driver contains an ioctl(2) that can format a tape with either one or two  parti‐\ntions.\n\nDevice  /dev/tape is usually created as a hard or soft link to the default tape device on the\nsystem.\n\nStarting from kernel 2.6.2, the driver exports in the  sysfs  directory  /sys/class/scsitape\nthe attached devices and some parameters assigned to the devices.\n",
                "subsections": [
                    {
                        "name": "Data transfer",
                        "content": "The  driver supports operation in both fixed-block mode and variable-block mode (if supported\nby the drive).  In fixed-block mode the drive writes blocks of the  specified  size  and  the\nblock  size is not dependent on the byte counts of the write system calls.  In variable-block\nmode one tape block is written for each write call and the byte count determines the size  of\nthe corresponding tape block.  Note that the blocks on the tape don't contain any information\nabout the writing mode: when reading, the only important thing is to use commands that accept\nthe block sizes on the tape.\n\nIn  variable-block  mode  the  read byte count does not have to match the tape block size ex‐\nactly.  If the byte count is larger than the next block on tape, the driver returns the  data\nand  the  function  returns the actual block size.  If the block size is larger than the byte\ncount, an error is returned.\n\nIn fixed-block mode the read byte counts can be arbitrary if buffering is enabled, or a  mul‐\ntiple  of  the tape block size if buffering is disabled.  Kernels before 2.1.121 allow writes\nwith arbitrary byte count if buffering is enabled.  In all other cases (kernel before 2.1.121\nwith  buffering disabled or newer kernel) the write byte count must be a multiple of the tape\nblock size.\n\nIn the 2.6 kernel, the driver tries to use direct transfers between the user buffer  and  the\ndevice.   If this is not possible, the driver's internal buffer is used.  The reasons for not\nusing direct transfers include improper alignment of the user buffer (default  is  512  bytes\nbut  this  can be changed by the HBA driver), one or more pages of the user buffer not reach‐\nable by the SCSI adapter, and so on.\n\nA filemark is automatically written to tape if the last tape operation  before  close  was  a\nwrite.\n\nWhen  a  filemark is encountered while reading, the following happens.  If there are data re‐\nmaining in the buffer when the filemark is found, the buffered data is  returned.   The  next\nread  returns  zero  bytes.   The following read returns data from the next file.  The end of\nrecorded data is signaled by returning zero bytes for two consecutive read calls.  The  third\nread returns an error.\n"
                    },
                    {
                        "name": "Ioctls",
                        "content": "The  driver  supports  three ioctl(2) requests.  Requests not recognized by the st driver are\npassed to the SCSI driver.  The definitions below are from /usr/include/linux/mtio.h:\n\nMTIOCTOP —— perform a tape operation\nThis request takes an argument of type (struct mtop *).  Not all drives  support  all  opera‐\ntions.  The driver returns an EIO error if the drive rejects an operation.\n\n/* Structure for MTIOCTOP - mag tape op command: */\nstruct mtop {\nshort   mtop;       /* operations defined below */\nint     mtcount;    /* how many of them */\n};\n\nMagnetic tape operations for normal tape use:\n\nMTBSF  Backward space over mtcount filemarks.\n\nMTBSFM Backward  space  over  mtcount filemarks.  Reposition the tape to the EOT side of the\nlast filemark.\n\nMTBSR  Backward space over mtcount records (tape blocks).\n\nMTBSS  Backward space over mtcount setmarks.\n\nMTCOMPRESSION\nEnable compression of tape data within the drive if mtcount is  nonzero  and  disable\ncompression if mtcount is zero.  This command uses the MODE page 15 supported by most\nDATs.\n\nMTEOM  Go to the end of the recorded media (for appending files).\n\nMTERASE\nErase tape.  With 2.6 kernel, short erase (mark tape empty) is performed if the  argu‐\nment is zero.  Otherwise, long erase (erase all) is done.\n\nMTFSF  Forward space over mtcount filemarks.\n\nMTFSFM Forward  space  over  mtcount  filemarks.  Reposition the tape to the BOT side of the\nlast filemark.\n\nMTFSR  Forward space over mtcount records (tape blocks).\n\nMTFSS  Forward space over mtcount setmarks.\n\nMTLOAD Execute the SCSI load command.  A special case is available for some  HP  autoloaders.\nIf mtcount is the constant MTSTHPLOADEROFFSET plus a number, the number is sent to\nthe drive to control the autoloader.\n\nMTLOCK Lock the tape drive door.\n\nMTMKPART\nFormat the tape into one or two partitions.  If mtcount is  positive,  it  gives  the\nsize  of  partition  1  and partition 0 contains the rest of the tape.  If mtcount is\nzero, the tape is formatted into one partition.  From kernel version 4.6,  a  negative\nmtcount specifies the size of partition 0 and the rest of the tape contains partition\n1.  The physical ordering of partitions depends on the drive.  This command is not al‐\nlowed  for  a  drive  unless  the  partition  support  is  enabled  for the drive (see\nMTSTCANPARTITIONS below).\n\nMTNOP  No op—flushes the driver's buffer as a side effect.  Should  be  used  before  reading\nstatus with MTIOCGET.\n\nMTOFFL Rewind and put the drive off line.\n\nMTRESET\nReset drive.\n\nMTRETEN\nRe-tension tape.\n\nMTREW  Rewind.\n\nMTSEEK Seek to the tape block number specified in mtcount.  This operation requires either a\nSCSI-2 drive that supports the LOCATE command (device-specific address) or a Tandberg-\ncompatible  SCSI-1  drive  (Tandberg,  Archive Viper, Wangtek, ...).  The block number\nshould be one that was previously returned by MTIOCPOS  if  device-specific  addresses\nare used.\n\nMTSETBLK\nSet  the  drive's  block length to the value specified in mtcount.  A block length of\nzero sets the drive to variable block size mode.\n\nMTSETDENSITY\nSet the tape density to the code in mtcount.  The density codes supported by a  drive\ncan be found from the drive documentation.\n\nMTSETPART\nThe  active partition is switched to mtcount.  The partitions are numbered from zero.\nThis command is not allowed for a drive unless the partition support  is  enabled  for\nthe drive (see MTSTCANPARTITIONS below).\n\nMTUNLOAD\nExecute the SCSI unload command (does not eject the tape).\n\nMTUNLOCK\nUnlock the tape drive door.\n\nMTWEOF Write mtcount filemarks.\n\nMTWSM  Write mtcount setmarks.\n\nMagnetic tape operations for setting of device options (by the superuser):\n\nMTSETDRVBUFFER\nSet  various  drive  and  driver options according to bits encoded in mtcount.  These\nconsist of the drive's buffering mode, a set of Boolean  driver  options,  the  buffer\nwrite  threshold,  defaults for the block size and density, and timeouts (only in ker‐\nnels 2.1 and later).  A single operation can affect only one item in  the  list  below\n(the Booleans counted as one item.)\n\nA  value having zeros in the high-order 4 bits will be used to set the drive's buffer‐\ning mode.  The buffering modes are:\n\n0   The drive will not report GOOD status on write commands until the data blocks\nare actually written to the medium.\n\n1   The  drive  may  report GOOD status on write commands as soon as all the data\nhas been transferred to the drive's internal buffer.\n\n2   The drive may report GOOD status on write commands as soon  as  (a)  all  the\ndata  has  been  transferred  to  the  drive's  internal  buffer, and (b) all\nbuffered data from different initiators has been successfully written to  the\nmedium.\n\nTo  control  the  write  threshold  the  value  in  mtcount must include the constant\nMTSTWRITETHRESHOLD bitwise ORed with a block count in the low 28 bits.   The  block\ncount  refers  to  1024-byte  blocks,  not  the  physical block size on the tape.  The\nthreshold cannot exceed the driver's internal buffer size (see DESCRIPTION, above).\n\nTo set and clear the Boolean options the value in mtcount must  include  one  of  the\nconstants MTSTBOOLEANS, MTSTSETBOOLEANS, MTSTCLEARBOOLEANS, or MTSTDEFBOOLEANS\nbitwise ORed with whatever combination of the following  options  is  desired.   Using\nMTSTBOOLEANS the options can be set to the values defined in the corresponding bits.\nWith MTSTSETBOOLEANS the options can be selectively set and  with  MTSTDEFBOOLEANS\nselectively cleared.\n\nThe  default  options  for  a tape device are set with MTSTDEFBOOLEANS.  A nonactive\ntape device (e.g., device with minor 32 or 160) is activated when the default  options\nfor it are defined the first time.  An activated device inherits from the device acti‐\nvated at start-up the options not set explicitly.\n\nThe Boolean options are:\n\nMTSTBUFFERWRITES (Default: true)\nBuffer all write operations in fixed-block mode.  If this option is  false  and\nthe drive uses a fixed block size, then all write operations must be for a mul‐\ntiple of the block size.  This option must be set false to write reliable  mul‐\ntivolume archives.\n\nMTSTASYNCWRITES (Default: true)\nWhen  this  option is true, write operations return immediately without waiting\nfor the data to be transferred to the drive if the data fits into the  driver's\nbuffer.   The  write  threshold determines how full the buffer must be before a\nnew SCSI write command is issued.  Any errors reported by  the  drive  will  be\nheld until the next operation.  This option must be set false to write reliable\nmultivolume archives.\n\nMTSTREADAHEAD (Default: true)\nThis option causes the driver to  provide  read  buffering  and  read-ahead  in\nfixed-block  mode.   If  this  option is false and the drive uses a fixed block\nsize, then all read operations must be for a multiple of the block size.\n\nMTSTTWOFM (Default: false)\nThis option modifies the driver behavior when a file is closed.  The normal ac‐\ntion  is  to  write  a single filemark.  If the option is true, the driver will\nwrite two filemarks and backspace over the second one.\n\nNote: This option should not be set true for QIC tape drives since they are un‐\nable  to overwrite a filemark.  These drives detect the end of recorded data by\ntesting for blank tape rather than two consecutive filemarks.  Most other  cur‐\nrent  drives  also  detect  the end of recorded data and using two filemarks is\nusually necessary only when interchanging tapes with some other systems.\n\nMTSTDEBUGGING (Default: false)\nThis option turns on various debugging messages from the driver (effective only\nif the driver was compiled with DEBUG defined nonzero).\n\nMTSTFASTEOM (Default: false)\nThis option causes the MTEOM operation to be sent directly to the drive, poten‐\ntially speeding up the operation but causing the driver to lose  track  of  the\ncurrent   file   number   normally   returned  by  the  MTIOCGET  request.   If\nMTSTFASTEOM is false, the driver will respond to an MTEOM request by forward\nspacing over files.\n\nMTSTAUTOLOCK (Default: false)\nWhen  this  option  is  true,  the drive door is locked when the device file is\nopened and unlocked when it is closed.\n\nMTSTDEFWRITES (Default: false)\nThe tape options (block size, mode, compression, etc.) may change when changing\nfrom  one  device  linked to a drive to another device linked to the same drive\ndepending on how the devices are defined.  This option defines when the changes\nare  enforced by the driver using SCSI-commands and when the drives auto-detec‐\ntion capabilities are relied upon.  If this option is false, the  driver  sends\nthe  SCSI-commands  immediately  when  the device is changed.  If the option is\ntrue, the SCSI-commands are not sent until a write is requested.  In this case,\nthe drive firmware is allowed to detect the tape structure when reading and the\nSCSI-commands are used only to make sure that a tape is  written  according  to\nthe correct specification.\n\nMTSTCANBSR (Default: false)\nWhen read-ahead is used, the tape must sometimes be spaced backward to the cor‐\nrect position when the device is closed and the SCSI command to space  backward\nover  records  is  used for this purpose.  Some older drives can't process this\ncommand reliably and this option can be used to instruct the driver not to  use\nthe command.  The end result is that, with read-ahead and fixed-block mode, the\ntape may not be correctly positioned within a file when the device  is  closed.\nWith 2.6 kernel, the default is true for drives supporting SCSI-3.\n\nMTSTNOBLKLIMS (Default: false)\nSome  drives don't accept the READ BLOCK LIMITS SCSI command.  If this is used,\nthe driver does not use the command.  The drawback is  that  the  driver  can't\ncheck  before  sending commands if the selected block size is acceptable to the\ndrive.\n\nMTSTCANPARTITIONS (Default: false)\nThis option enables support for several partitions within a tape.   The  option\napplies to all devices linked to a drive.\n\nMTSTSCSI2LOGICAL (Default: false)\nThis  option instructs the driver to use the logical block addresses defined in\nthe SCSI-2 standard when performing the seek and tell operations (both with MT‐‐\nSEEK  and  MTIOCPOS commands and when changing tape partition).  Otherwise, the\ndevice-specific addresses are used.  It is highly advisable to set this  option\nif  the drive supports the logical addresses because they count also filemarks.\nThere are some drives that support only the logical block addresses.\n\nMTSTSYSV (Default: false)\nWhen this option is enabled, the tape devices use the System V semantics.  Oth‐\nerwise,  the BSD semantics are used.  The most important difference between the\nsemantics is what happens when a device used for reading is closed: in System V\nsemantics  the  tape  is  spaced forward past the next filemark if this has not\nhappened while using the device.  In BSD semantics the  tape  position  is  not\nchanged.\n\nMTNOWAIT (Default: false)\nEnables  immediate  mode  (i.e., don't wait for the command to finish) for some\ncommands (e.g., rewind).\n\nAn example:\n\nstruct mtop mtcmd;\nmtcmd.mtop = MTSETDRVBUFFER;\nmtcmd.mtcount = MTSTBOOLEANS |\nMTSTBUFFERWRITES | MTSTASYNCWRITES;\nioctl(fd, MTIOCTOP, mtcmd);\n\nThe default block size for a device can be set with MTSTDEFBLKSIZE and the  default\ndensity  code  can  be  set  with MTSTDEFDENSITY.  The values for the parameters are\nor'ed with the operation code.\n\nWith kernels 2.1.x and later, the timeout  values  can  be  set  with  the  subcommand\nMTSTSETTIMEOUT  ORed  with  the  timeout  in  seconds.   The long timeout (used for\nrewinds  and  other  commands  that  may  take  a  long  time)   can   be   set   with\nMTSTSETLONGTIMEOUT.   The  kernel  defaults are very long to make sure that a suc‐\ncessful command is not timed out with any drive.  Because of this, the driver may seem\nstuck  even  if it is only waiting for the timeout.  These commands can be used to set\nmore practical values for a specific drive.  The timeouts set for one device apply for\nall devices linked to the same drive.\n\nStarting  from kernels 2.4.19 and 2.5.43, the driver supports a status bit which indi‐\ncates whether the drive requests cleaning.  The method used by  the  drive  to  return\ncleaning information is set using the MTSTSELCLN subcommand.  If the value is zero,\nthe cleaning bit is always zero.  If the value is one, the TapeAlert data  defined  in\nthe  SCSI-3 standard is used (not yet implemented).  Values 2–17 are reserved.  If the\nlowest eight bits are >= 18, bits from the extended sense data  are  used.   The  bits\n9–16  specify  a mask to select the bits to look at and the bits 17–23 specify the bit\npattern to look for.  If the bit pattern is zero, one or more bits under the mask  in‐\ndicate  the  cleaning  request.  If the pattern is nonzero, the pattern must match the\nmasked sense data byte.\n\nMTIOCGET —— get status\nThis request takes an argument of type (struct mtget *).\n\n/* structure for MTIOCGET - mag tape get status command */\nstruct mtget {\nlong     mttype;\nlong     mtresid;\n/* the following registers are device dependent */\nlong     mtdsreg;\nlong     mtgstat;\nlong     mterreg;\n/* The next two fields are not always used */\ndaddrt  mtfileno;\ndaddrt  mtblkno;\n};\n\nmttype\nThe header file defines many values for mttype, but the current driver  reports  only\nthe  generic  types  MTISSCSI1  (Generic  SCSI-1 tape) and MTISSCSI2 (Generic SCSI-2\ntape).\n\nmtresid\ncontains the current tape partition number.\n\nmtdsreg\nreports the drive's current settings for block size (in the low 24 bits)  and  density\n(in  the  high  8  bits).  These fields are defined by MTSTBLKSIZESHIFT, MTSTBLK‐‐\nSIZEMASK, MTSTDENSITYSHIFT, and MTSTDENSITYMASK.\n\nmtgstat\nreports generic (device independent) status  information.   The  header  file  defines\nmacros for testing these status bits:\n\nGMTEOF(x): The tape is positioned just after a filemark (always false after an MTSEEK\noperation).\n\nGMTBOT(x): The tape is positioned at the beginning of the first  file  (always  false\nafter an MTSEEK operation).\n\nGMTEOT(x): A tape operation has reached the physical End Of Tape.\n\nGMTSM(x): The tape is currently positioned at a setmark (always false after an MTSEEK\noperation).\n\nGMTEOD(x): The tape is positioned at the end of recorded data.\n\nGMTWRPROT(x): The drive is write-protected.  For some drives this can also mean that\nthe drive does not support writing on the current medium type.\n\nGMTONLINE(x): The last open(2) found the drive with a tape in place and ready for op‐\neration.\n\nGMTD6250(x), GMTD1600(x), GMTD800(x): This “generic” status information  reports\nthe current density setting for 9-track ½\" tape drives only.\n\nGMTDROPEN(x): The drive does not have a tape in place.\n\nGMTIMREPEN(x):  Immediate  report mode.  This bit is set if there are no guarantees\nthat the data has been physically written to the tape when the write call returns.\nIt  is set zero only when the driver does not buffer data and the drive is set not\nto buffer data.\n\nGMTCLN(x): The drive has requested cleaning.  Implemented in kernels since 2.4.19 and\n2.5.43.\n\nmterreg\nThe only field defined in mterreg is the recovered error count in the low 16 bits (as\ndefined by MTSTSOFTERRSHIFT and MTSTSOFTERRMASK).  Due to inconsistencies in the\nway drives report recovered errors, this count is often not maintained (most drives do\nnot by default report soft errors but this can be changed with a SCSI MODE SELECT com‐\nmand).\n\nmtfileno\nreports  the  current file number (zero-based).  This value is set to -1 when the file\nnumber is unknown (e.g., after MTBSS or MTSEEK).\n\nmtblkno\nreports the block number (zero-based) within the current file.  This value is  set  to\n-1 when the block number is unknown (e.g., after MTBSF, MTBSS, or MTSEEK).\n\nMTIOCPOS —— get tape position\nThis request takes an argument of type (struct mtpos *) and reports the drive's notion of the\ncurrent tape block number, which is not the same as  mtblkno  returned  by  MTIOCGET.   This\ndrive  must  be  a  SCSI-2 drive that supports the READ POSITION command (device-specific ad‐\ndress) or a Tandberg-compatible SCSI-1 drive (Tandberg, Archive Viper, Wangtek, ... ).\n\n/* structure for MTIOCPOS - mag tape get position command */\nstruct mtpos {\nlong mtblkno;    /* current block number */\n};\n"
                    }
                ]
            },
            "RETURN VALUE": {
                "content": "EACCES An attempt was made to write or erase a write-protected tape.  (This error is not  de‐\ntected during open(2).)\n\nEBUSY  The device is already in use or the driver was unable to allocate a buffer.\n\nEFAULT The command parameters point to memory not belonging to the calling process.\n\nEINVAL An ioctl(2) had an invalid argument, or a requested block size was invalid.\n\nEIO    The requested operation could not be completed.\n\nENOMEM The  byte  count in read(2) is smaller than the next physical block on the tape.  (Be‐\nfore 2.2.18 and 2.4.0 the extra bytes have been silently ignored.)\n\nENOSPC A write operation could not be completed because the tape reached end-of-medium.\n\nENOSYS Unknown ioctl(2).\n\nENXIO  During opening, the tape device does not exist.\n\nEOVERFLOW\nAn attempt was made to read or write a variable-length block that is larger  than  the\ndriver's internal buffer.\n\nEROFS  Open  is  attempted  with  OWRONLY or ORDWR when the tape in the drive is write-pro‐\ntected.\n",
                "subsections": []
            },
            "FILES": {
                "content": "/dev/st*\nthe auto-rewind SCSI tape devices\n\n/dev/nst*\nthe nonrewind SCSI tape devices\n",
                "subsections": []
            },
            "NOTES": {
                "content": "1.  When exchanging data between systems, both systems have to agree  on  the  physical  tape\nblock  size.  The parameters of a drive after startup are often not the ones most operat‐\ning systems use with these devices.  Most systems use drives in  variable-block  mode  if\nthe  drive  supports  that mode.  This applies to most modern drives, including DATs, 8mm\nhelical scan drives, DLTs, etc.  It may be advisable to use  these  drives  in  variable-\nblock  mode also in Linux (i.e., use MTSETBLK or MTSETDEFBLK at system startup to set the\nmode), at least when exchanging data with a foreign system.  The drawback of this is that\na  fairly  large  tape block size has to be used to get acceptable data transfer rates on\nthe SCSI bus.\n\n2.  Many programs (e.g., tar(1)) allow the user to specify the blocking factor on the command\nline.   Note  that this determines the physical block size on tape only in variable-block\nmode.\n\n3.  In order to use SCSI tape drives, the basic SCSI driver, a SCSI-adapter  driver  and  the\nSCSI  tape driver must be either configured into the kernel or loaded as modules.  If the\nSCSI-tape driver is not present, the drive is recognized but the tape  support  described\nin this page is not available.\n\n4.  The  driver  writes error messages to the console/log.  The SENSE codes written into some\nmessages are automatically translated to text if verbose SCSI  messages  are  enabled  in\nkernel configuration.\n\n5.  The  driver's  internal  buffering  allows  good throughput in fixed-block mode also with\nsmall read(2) and write(2) byte counts.  With direct transfers this is not  possible  and\nmay cause a surprise when moving to the 2.6 kernel.  The solution is to tell the software\nto use larger transfers (often telling it to use larger blocks).  If this is  not  possi‐\nble, direct transfers can be disabled.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "mt(1)\n\nThe  file  drivers/scsi/README.st  or  Documentation/scsi/st.txt (kernel >= 2.6) in the Linux\nkernel source tree contains the most recent information about the driver and  its  configura‐\ntion possibilities\n",
                "subsections": []
            },
            "COLOPHON": {
                "content": "This  page  is  part  of  release  5.10 of the Linux man-pages project.  A description of the\nproject, information about reporting bugs, and the latest version of this page, can be  found\nat https://www.kernel.org/doc/man-pages/.\n\n\n\nLinux                                        2020-04-11                                        ST(4)",
                "subsections": []
            }
        }
    }
}