SCSITAPE(1)
π SCSITAPE(1) π
okay so this is the scsitape page from the General Commands Manual, section 1 β the whole vibe is "there's a tape drive and I'm gonna control it" and honestly? slay. π¦
β¨ NAME β¨
scsitape β control SCSI tape devices. that's it, that's the whole job, and it eats π
π SYNOPSIS π
scsitape [-f <scsi-generic-device>] commands
πΈ DESCRIPTION πΈ
okay bestie, so scsitape controls SCSI tape drives in a platform-independent way. like, genuinely β as long as mtx works on your platform, scsitape works too. no cap. β¨
β οΈ but here's the thing, and I need you to hear me:scsitapeand your OS's native tape driver may stomp on each other. literally. in particular, if you usesetblkand your OS's native tape driver has a different notion of the block size, you may get evil results. evil. π
so the recommendation (and I'm being so serious rn) is to use scsitape only for software where you've written your own low-level READ and WRITE routines that use the SCSI command set to directly talk to tape drives β i.e., you do not use the OS's native tape driver at all. periodt. π₯
π¦ OPTIONS π¦
The first argument, given following -f, is the SCSI generic device corresponding to your tape drive. consult your operating system's documentation for more info, iykyk β for example:
- on Linux these are generally
/dev/sg0through/dev/sg15 - on FreeBSD these are
/dev/pass0through/dev/passX - on Solaris this is usually the same as your tape drive (Solaris has a SCSI passthrough ioctl)
also, you can set the STAPE or TAPE environment variable rather than use -f. ur welcome π«Ά
-f<scsi-generic-device>β points at the SCSI generic device for ur tape drive. or just setSTAPE/TAPEand skip it entirely, main character energy π
π COMMANDS π
setblk <n>β Set the tape drive's SCSI block size to<n>bytes.
(NOTE: if you are using your OS's native tape driver, THIS IS EVIL!). π not me warning you twice. run.
fsf <n>β Go forward by<n>tapemarks.bsf <n>β Go to immediately previous the<n>th previous tapemark.
(WARNING: This probably doesn't do what you expect β e.g. if you are immediately after a tapemark and type bfs 1, it moves to immediately before that tape mark, for a sum total of zero effective movement!). π literally going nowhere. iconic but useless.
eodβ Go to end of data.rewindβ Rewind the tape drive.ejectβ Eject the tape currently in the drive.eraseβ Does a *short* erase.
(warning: does NOT work on all drives!). π
mark <n>β write<n>filemarks. and hey,mark 0flushes the drive's buffers β¨seek <n>β Seek to a logical position<n>that was reported by a previoustapeinfocommand.write <blocksize>β write blocks from stdin to the tape. Chunk the data into<blocksize>-sized chunks.
*DOES NOT WRITE OUT A TAPEMARK!* π± (you will need to use a subsequent mark 1 command to write out a tape mark). don't forget, bestie, the tape will simply not know where ur data ends and that's giving chaos.
read [<blocksize>] [ <#blocks/#bytes> ]β read blocks from the tape, write them to stdout. here's the tea:- If we are in variable block mode,
<blocksize>should be zero.
- If we are in variable block mode,
(note: The maximum block size we currently support in variable block mode is 128K, MAX_READ_SIZE will need to be turned into a settable variable to allow bigger reads). π§
- If
<blocksize>is ommitted, we assume that we're in variable block mode, and that we are going to read from tape until we hit a tapemark or end of partition or end of tape.
π AUTHORS π
This program was written by Eric Lee Green <eric@badtux.org>. Major portions of the mtxl.c library used herein were written by Leonard Zubkoff. two legends, fr fr π«Ά
The SCSI read and write routines are based upon those that Richard Fish wrote for Enhanced Software Technology's BRU 16.1 product, substantially modified to work in our particular environment. and when I say substantially, I mean:
- all the variable block stuff is new, since BRU only does fixed block reads and writes
- the BRU code uses bitmasks rather than bitfields for the various flags and such in return values
- the BRU code has a different SCSI API
- the BRU code has variable names considerably shorter than the rather sesquipedalian
mtxidentifiers π (sesquipedalian. she said that. on a manpage.)
As required by mtxl.c, these routines are licensed under the GNU General Public License.
π HINTS π
Under Linux: cat /proc/scsi/scsi will tell you what SCSI devices you have. You can then refer to them as /dev/sga, /dev/sgb, etc. by the order they are reported.
Under FreeBSD: camcontrol devlist will tell you what SCSI devices you have, along with which pass device controls them.
Under Solaris 7 and 8: /usr/sbin/devfsadm -C will clean up your /devices directory. Then find /devices -name 'st@*' -print will return a list of all tape drives. /dev on Solaris is apparently only of historical interest. π ok grandma let's get you to bed.
π BUGS AND LIMITATIONS π
okay, deep breath, this is the part where I hold ur hand π«Ά
- for
scsitape read 0 <n>where you are doing variable-block-size reads and wish for<n>bytes, it instead reads one and exactly one block from tape and prints that (no matter what its size). Useddon the output ofscsitapeif you want finer control. π scsitape read 0attempts reads ofMAX_READ_SIZE, which is currently 128K. If blocks on tape are larger than 128K, only the first 128K will be read β the remainder will be silently dumped in the toilet. not a metaphor. the toilet. π½π- This program does not interact well (or at all :-) with your OS's native tape driver. You will likely see weird things happen if you attempt to intermingle
scsitapecommands with native tape driver operations. Note that BRU 16.1 for Solaris (and possibly others, but Solaris I know about) will have a'scsi'keyword to bypass the native tape driver and write via direct uscsi commands, so if you useΒ΄scsitapeΒ΄to bypass the flaws of the native Solaris driver, you can use BRU 16.1 to write your actual tape archives. (Assuming that BRU 16.1 has been released at the time that you read this). β
β AVAILABILITY β
This version of scsitape is currently being maintained by Robert Nelson <robertnelson@users.sourceforge.net> as part of the mtx suite of programs. The mtx home page is http://mtx.sourceforge.net and the actual code is currently available there and via SVN from http://sourceforge.net/projects/mtx. go get it, bestie πββοΈπ¨
π SEE ALSO π
loaderinfo(1), tapeinfo(1), mtx(1)
go read those too, they're literally the friend group π
and that's the whole page! π this one was SCSITAPE1.0 β shoutout to that version tag, she's serving vintage and we love her for it. mwah, go tape something. πβ¨
π¦ where this page comes from
- alpine 3.22: mtx-doc 1.3.12-r4 Β· GPL-2.0-only
- alpine 3.23: mtx-doc 1.3.12-r5 Β· GPL-2.0-only
- alpine 3.24: mtx-doc 1.3.12-r5 Β· GPL-2.0-only
- centos-stream 10: mtx 1.3.12-35.el10 Β· GPL-2.0-only
- centos-stream 9: mtx 1.3.12-27.el9 Β· GPLv2
- fedora 43: mtx 1.3.12-36.fc43 Β· GPL-2.0-only
- fedora 44: mtx 1.3.12-37.fc44 Β· GPL-2.0-only
- nixos 26.05: mtx 1.3.12
- nixpkgs unstable: mtx 1.3.12
- Copyright 2001 Eric Lee Green
- Copyright 2007-2008 by Robert Nelson <robertn@the-nelsons.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms