SCUZZ(8)SCUZZ(8)

NAME

scuzz – SCSI target control

SYNOPSIS

scuzz [ -6eq ] [ -m max-xfer ] [ [ -r ] sddev ]

DESCRIPTION

Scuzz is an interactive program for exercising raw SCSI devices. Its intended purpose is to investigate and manipulate odd devices without the effort of writing a special driver, such as shuffling the media around on an optical jukebox. It reads commands from standard input and applies them to a SCSI target (other devices accessed through the sd(3) interface, such as ATA(PI) devices, may also work). If sddev is given on the command line, an open (see below) is immediately applied to the target. On successful completion of a command, ok n is printed, where n is the number of bytes transferred to/from the target; the -q command line option suppresses the ok message.

The -6 forces the use of 6-byte SCSI commands rather than 10-byte ones. Some older devices require this, though scuzz attempts to adapt automatically. The -e makes scuzz more willing to retry I/O errors but less tolerant of other errors and implies -6. This option is often needed to read Exabyte 8mm tapes. The -m option sets the maximum I/O transfer size to max-xfer. Exabyte drives often require this to be 1024 or the exact tape block size and some 4mm drives require this to be the exact tape block size or larger.

Commands

help command

Help is rudimentary and prints a one line synopsis for the named command, or for all commands if no argument is given.  

probe

Probe attempts an inquiry command on all SCSI units, and prints the result preceded by the name of those targets which respond.  

The help and probe commands may be given at any time.

open [-r]sddev

Open must be given before any of the remaining commands will be accepted. Internally, unless the -r option is given, open issues ready then inquiry, followed by a device class-specific command to determine the logical block size of the target. Sddev is an sd(3) device directory like /dev/sdC0.  

close

Close need only be given if another target is to be opened in the current session.  

The remaining commands are in rough groups, intended for specific classes of device. With the exception of the read, write, and space commands, all arguments are in the style of ANSI-C integer constants.

ready

Test Unit Ready checks if the unit is powered up and ready to do read and write commands.  

rezero

Rezero Unit requests that a disk be brought to a known state, usually by seeking to track zero.  

rewind

Rewind positions a tape at the beginning of current partition (there is usually only one partition, the beginning of tape).  

reqsense

Request Sense retrieves Sense Data concerning an error or other condition and is usually issued following the completion of a command that had check-condition status. Scuzz automatically issues a reqsense in response to a check-condition status and prints the result.  

format

Format Unit performs a “low level” format of a disk.  

rblimits

Read Block Limits reports the possible block lengths for the logical unit. Tapes only.  

read file nbytes

Read transfers data from the target to the host. A missing nbytes causes the entire device to be read.  

write file nbytes

Write transfers data from the host to the target. A missing nbytes causes the entire input file to be transferred.  

The first argument to the read and write commands specifies a source (write) or destination (read) for the I/O. The argument is either a plain file name or | followed by a command to be executed by rc(1). The argument may be quoted in the style of rc(1).  

seek offset whence

Seek requests the target to seek to a position on a disk, arguments being in the style of seek(2); whence is 0 by default.  

Scuzz maintains an internal notion of where the current target is positioned. The seek, read, write, rewind, rezero, and wtrack commands all manipulate the internal offset.  

filemark howmany

Write Filemarks writes one (default) or more filemarks on a tape.  

space [-b] [-f] [[--]howmany]

Space positions a tape forwards or backwards. The arguments specify logical block (-b) or filemark (-f) spacing; default is -b. If howmany is negative it specifies spacing backwards, and should be preceded by -- to turn off any further option processing. Default is 1.  

inquiry

Inquiry is issued to determine the device type of a particular target, and to determine some basic information about the implemented options and the product name.  

modeselectbytes...

 

modeselect6bytes...

Mode Select is issued to set variable parameters in the target. Bytes given as arguments comprise all the data for the target; see an appropriate manual for the format. The default is the 10-byte form of the command; modeselect6 is the 6-byte version.  

modesense [page[nbytes]]

 

modesense6 [page[nbytes]]

Mode Sense reports variable and fixed parameters from the target. If no page is given, all pages are returned. Nbytes specifies how many bytes should be returned. The default is the 10-byte form of the command; modesense6 is the 6-byte version.  

start [code]

 

stop [code]

 

eject [code]

 

ingest [code]

Start, stop, eject, and ingest are synonyms for Start/Stop Unit with different default values of code. Start/Stop Unit is typically used to spin up and spin down a rotating disk drive. Code is 0 to stop, 1 to start and 3 to eject (if the device supports ejection of the medium).  

capacity

Read Capacity reports the number of blocks and the block size of a disk.  

The following commands are specific to CD and CD-R/RW devices. A brief description of each is given; see the SCSI-3 Multimedia Commands (MMC) Specification for details of arguments and interpretation of the results.

blank [track/LBA[type]]

Erase a CD-RW disk. Type identifies the method and coverage of the blanking.  

rtoc [track/session-number[ses]]

The Read TOC/PMA command transfers data from one of the tables of contents (TOC or PMA) on the CD medium.  

rdiscinfo

(Note the spelling.) Provides information about disks, including incomplete CD-R/RW.  

rtrackinfo [track]

Provides information about a track, regardless of its status.  

cdpause

 

cdresume

Pause/resume playback.  

cdstop

Stop playback.  

cdplay [track-number] or [-r[LBA[length]]]

Play audio. With no arguments, starts at the beginning of the medium. If a track number is given, the table of contents is read to find the playback start point. If the -r option is given, block addressing is used to find the playback start point.  

cdload [slot]

 

cdunload [slot]

Load/unload a disk from a changer.  

cdstatus

Read the mechanism status.  

The following commands are specific to Media Changer devices. A brief description of each is given; see the SCSI-3 Medium Changer Commands (SMC) Specification for details of arguments.

einit

Initialize element status.  

estatus type [ length ]

Report the status of the internal elements. Type 0 reports all element types.  

mmove transport source destination [ invert ]

Move medium.  

FILES

/dev/sdXX/raw

raw SCSI interface for command, I/O, and status.  

SOURCE

/sys/src/cmd/scuzz

SEE ALSO

sd(3)
Small Computer System Interface - 2 (X3T9.2/86-109) , Global Engineering Documents
SCSI Bench Reference , ENDL Publications
SCSI-3 Multimedia Commands (MMC) Specification , www.t10.org
SCSI-3 Medium Changer Commands (SMC) Specification , www.t10.org

BUGS

Only a limited subset of SCSI commands has been implemented (as needed).

Only one target can be open at a time.

LUNs other than 0 are not supported.

No way to force 10-byte commands, though they are the default.

Should be recoded to use scsi(2) in order to get more complete sense code descriptions.

Scuzz betrays its origins by spelling rdiscinfo with a c even though the devices it manipulates are spelled with a k.

The max-xfer value is currently limited to 245760 to limit kernel memory consumption.

It may be necessary to set max-xfer to exactly the block size used to write a tape in order to read it on some drives.