SCSI utility programs from other sources are listed and briefly described in the final section.
Utility |
Main
SCSI commands |
subdirectory |
Ported |
Notes |
hxascdmp |
- |
utils |
converts stdin (assumed binary)
to ASCII hex and ASCII on stdout (like Unix od command) |
|
isosize |
- |
archive |
size of an ISO 9660 file system,
now in the util-linux package |
|
rescan-scsi-bus.sh |
- |
archive |
copy of Kurt Garloff's useful
script |
|
scsi_devfs_scan |
INQUIRY |
archive |
more relevant to lk 2.4 (in lk
2.6 sysfs replaces devfs; see lsscsi
) |
|
scsi_inquiry |
INQUIRY |
examples |
uses deprecated
SCSI_IOCTL_SEND_COMMAND ioctl |
|
sdparm |
MODE SENSE/SELECT, INQUIRY |
**** |
was in sg3_utils for a short
time; now in own package, see sdparm .
sdparm manipulates mode pages, reads VPD pages and sends simple
commands. |
|
sginfo |
MODE SENSE/SELECT, READ DEFECT |
symbolic decoding (optional
changing) of mode pages. Can also output (disk) defect lists. In lk 2.4
can be given primary device nodes (e.g. /dev/sda) as well as sg device
nodes. See scsiinfo package
notes below. |
||
sgm_dd |
READ, WRITE |
sg_dd variant that uses memory
mapped IO (only on sg devices) |
||
sgp_dd |
READ, WRITE |
sg_dd variant that uses POSIX
threads |
||
sgq_dd |
READ, WRITE |
archive |
sg_dd variant that uses
asynchronous sg IO calls |
|
sg_dd |
READ, WRITE |
Unix dd command variant, uses SG_IO ioctl to send SCSI commands to do reads and writes when instructed. See the sg_dd page. | ||
sg_emc_trepass |
MODE SELECT |
utility specialized for EMC
Clariion series |
||
sg_format |
FORMAT |
fb,t64 |
format or resize a SCSI disk |
|
sg_get_config |
GET CONFIGURATION |
fb,t64 | fetch features and profiles of a
cd/dvd drive and/or its current media |
|
sg_ident |
REPORT/SET DEVICE IDENTIFIER |
fb,t64 | default is to report (fetch) the
device identifier. With the '--set' option a new identifier is sent
to the device. |
|
sg_inq |
INQUIRY |
fb,t64 | fetch standard response, VPD
pages (including device identification) or version descriptors. Also
can perform IDENTIFY (PACKET) DEVICE ATA command. |
|
sg_logs |
LOG SENSE |
fb,t64 | fetch log sense pages, decode
standard pages |
|
sg_luns |
REPORT LUNS |
fb,t64 | fetch luns reported by a device
(lun 0 or "well known lu") |
|
sg_map |
INQUIRY |
shows mapping between sg devices
and primary device node (if any). In lk 2.6 see lsscsi . |
||
sg_map26 |
maps between single sg device
and primary device node (and vice versa). Also does mapping in to and
out of sysfs. For the linux 2.6 series. |
|||
sg_modes |
MODE SENSE |
fb,t64 | dump mode pages (mainly in hex) |
|
sg_opcodes |
REPORT SUPPORTED OPERATION CODES |
fetch supported SCSI commands or
supported task management functions |
||
sg_persist |
PERSISTENT RESERVATION IN/OUT |
fb,t64 | control reservations and report
reservation status |
|
sg_prevent |
PREVENT ALLOW MEDIUM REMOVAL |
fb,t64 | control media removal, mainly
for those SCSI devices which have removable media (mainly CD/DVD drives) |
|
sg_rbuff |
READ BUFFER |
read from SCSI device cache.
Typically for testing the SCSI transport (for throughput or errors) |
||
sg_read |
READ |
read continually from same
offset. Syntax similar to sg_dd (without write side). Can test SCSI
device cache and transport performance (like sg_rbuff). |
||
sg_readcap |
READ CAPACITY |
fb,t64 | fetch the number of blocks and
the individual block size for disks and CD/DVD media |
|
sg_read_long |
READ LONG |
fb,t64 | read from given lba data which
includes the block and ECC data. |
|
sg_reassign |
REASSIGN BLOCKS |
fb,t64 | reassign a lba from one sector
on a disk (typically damaged) to a new (spare) sector. User data copied
if it is recoverable. |
|
sg_requests |
REQUEST SENSE |
fb,t64 | fetch sense data from the given
SCSI device. Useful if no autosense , to get progress indication (e.g.
during a format) or find the power condition state. |
|
sg_reset |
- |
Issue a driver, (SCSI) bus or
device (target or lun?) reset. |
||
sg_rmsn |
READ MEDIA SERIAL NUMBER |
fb,t64 | Relatively new command
added to SPC-3. Format of response is vendor specific so this utility
outputs it in hex. |
|
sg_rtpg |
REPORT TARGET PORT GROUPS |
fb,t64 | Specialized for multi-ported
SCSI devices where one port (or a group of them) is preferred for IO
over another (or others). |
|
sg_scan |
[INQUIRY] |
maps each sg device name to
the corresponding numeric <host, channel, target', lun> tuple. In
lk 2.6 series the "lsscsi -g" command is
similar. |
||
sg_senddiag |
SEND DIAGNOSTIC |
fb,t64 | Issues either a default self
test or a short/extended foreground/background self test. With no
arguments it uses RECEIVE DIAGNOSTIC to list all supported diagnostic
pages. |
|
sg_ses |
SEND/RECEIVE DIAGNOSTIC |
fb,t64 | Fetches status diagnostic
pages from, and sends some control pages to, a SCSI Enclosure Services
(SES) device. |
|
sg_simple1,2,3,4 |
INQUIRY, TEST UNIT READY |
examples |
Simple code examples of using
the scsi generic (sg) driver interface |
|
sg_simple16 |
READ |
examples |
Simple code example of sending a
16 byte cdb SCSI READ command |
|
sg_start |
START STOP UNIT |
fb,t64 | Controls the power condition
state of a SCSI device. Primary use is to spin up and down SCSI disks. |
|
sg_sync |
SYNCHRONIZE CACHE |
fb,t64 | Causes disk caches to be flushed
to media |
|
sg_test_rwbuf |
READ/WRITE BUFFER |
Random pattern written to SCSI
device buffer then read back and checked. Used in testing for data
corruption. |
||
sg_turs |
TEST UNIT READY |
fb,t64 | Issue one or more Test Unit
Ready commands. Can be used to time SCSI command overhead. |
|
sg_verify | VERIFY | fb,t64 | reads indicated blocks on a SCSI disks, stops on the first error found. Does not yield any data. Useful for media scans. | |
sg_write_long |
WRITE LONG |
fb,t64 | writes to a lba, data which
includes the block and ECC data. Suitable data typically fetched by
prior
sg_read_long utility. |
|
sg_wr_mode |
MODE SELECT |
fb,t64 | writes mode pages supplied in
ASCII hex (e.g. from "sg_modes -r") to the given SCSI device. See sdparm for another method of setting mode page
parameters. |
Example: given these 3 SCSI devices:
$ cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun:
00
Vendor: SEAGATE Model:
ST318451LW Rev: 0003
Type:
Direct-Access
ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 04 Lun:
00
Vendor: PIONEER Model:
DVD-ROM DVD-303 Rev: 1.10
Type:
CD-ROM
ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 06 Lun:
00
Vendor: YAMAHA
Model:
CRW4416S Rev: 1.0g
Type:
CD-ROM
ANSI SCSI revision: 02
then the output from sg_scan is:
$ sg_scan
/dev/sg0: scsi1 channel=0 id=0
lun=0 type=0
/dev/sg1: scsi2 channel=0 id=4 lun=0 type=5
/dev/sg2: scsi2 channel=0 id=6
lun=0 type=5
INQUIRY data can be added to that output with the "-i" option. The
sg_map utility shows the mapping between scsi generic (sg) devices and
the corresponding primary device node. For some peripheral device
types, SCSI enclosures for example, there is no mapping and the
enclosure device must be accessed via a sg device node.
$ sg_map
/dev/sg0 /dev/sda
/dev/sg1 /dev/scd0
/dev/sg2 /dev/scd1
See the notes about header file problems in the README file inside each package.
This is a utility to create and maintain symbolic links mapping a
predictable set of names to the rather unpredictable names used by
linux for disk devices. For example, you might map:
/dev/mydisk1 -> /dev/sda1
/dev/mydisk2 -> /dev/sdb1
/dev/mydisk3 -> /dev/sdc1
If you removed the disk corresponding to /dev/sdb1, then on reboot,
/dev/sdc1 will become /dev/sdb1, and /dev/sdc1 will be gone. and your
fstab will be wrong, etc. (Especially problematic on a SAN). scsimap
will maintain the mapping so that after the reboot, /dev/mydisk3 ->
will point to /dev/sdb1 and /dev/mydisk2 will be gone. scsimap also
handles later generation Compaq array controllers (those which use
the cciss driver.)
See: www.geocities.com/smcameron .
Return to main page.
Last updated: 27th January 2006