The  Linux sg_utils and sg3_utils packages

Introduction
Utilities
1. dd variants
2. Scanning and mapping
3. SCSI support
4. Timing and testing
5. Example programs
6. Miscellaneous
Notes
Download
Programs from other sources
 

Introduction

The sg3_utils and sg_utils are two closely related packages of utilities that send SCSI commands to Linux devices. As well as devices on SCSI transports (e.g. Fibre channel and the SCSI parallel interface) many other devices use SCSI command sets. Examples are ATAPI cd/dvd writers and sATA disks (typically via a translation layer or bridge device). The SCSI command set is divided into what are called "primary" commands (e.g. SPC-3) and device class specific sets (e.g. SBC-2 for disks and MMC-4 for cd/dvd devices).  SCSI command sets and transports definitions can be found at www.t10.org .

The main difference between the two packages is the linux kernel series that they target: sg_utils for the lk 2.2 (with some support for the lk 2.0 series); sg3_utils for the lk 2.4 and 2.6 series. The sg3_utils package is still in active development while sg_utils is in maintenance mode. This document describes version 1.12 for sg3_utils and version 1.02 for sg_utils.

In the linux kernel 2.0, 2.2 and 2.4 series these utilities must be used with the SCSI generic (sg) driver device names (e.g. /dev/sg0). In the lk 2.6 series almost all of the utilities can be used with the primary device names as well (e.g. /dev/sda, /dev/sdc0, /dev/st0 and /dev/hdd (if it is an ATAPI device)). The SCSI generic (sg) interface still represents a cleaner interface than the primary device names. This occurs since the drivers behind primary device names have their own policies and may interfere with error processing and run their own state machines (e.g. the cdrom driver interferes with attempts to prevent media removal with sg_prevent).

SCSI utility programs for Linux from other sources are listed and briefly described in the final section.

Utilities

Here is a (somewhat arbitrary) categorization of the utilities included in the sg_utils and sg3_utils packages:
  1. dd variants: sg_dd, sgp_dd, sgm_dd and sgq_dd
  2. scanning and mapping: sg_scan, sg_map and scsi_devfs_scan
  3. SCSI support: sg_inq, scsi_inquiry, sginfo, sg_readcap, sg_start, sg_whoami, sg_modes, sg_logs, sg_senddiag, sg_reset, sg_persist, sg_opcodes, sg_write_long, sg_read_long, sg_ses, sg_requests, sg_verify, sg_emc_trespass, sg_luns, sg_sync, sg_prevent, sg_get_config, sg_wr_mode, sg_rtpg and sg_reassign
  4. timing and testing: sg_rbuf, sg_test_rwbufsg_read, sg_turs, and sg_debug
  5. example programs: sg_simple1, sg_simple2, sg_simple3, sg_simple4, sg_runt_ex and sg_simple16
  6. miscellaneous programs: isosize
Those utilities that are in bold typeface are in both sg_utils and sg3_utils; those in normal typeface are only found in sg3_utils; and those in italics are only found in sg_utils. All utilities in the main directory have man pages; some utilities in the subdirectories  (e.g. archive, examples and utils) have man pages. In some cases the information in the man pages will be more up to date than information in this page.

There is a brief description of each utility in the following sections.

1. dd variants

The dd(1) command in Unix is used to copy data between files and optionally convert it in the process. In Linux various types of device files (e.g. /dev/sda and /dev/hda3) may be one (or both) of the files given to dd. Raw devices (in lk 2.4 and a patch in the lk 2.2 series) can also be used with recent dd implementations (that meet the alignment requirements). dd is very useful for copying data and timing disk performance but cannot take a sg device as one of its files. Therefore there are several variants of dd in these packages that can interact with sg devices. These utilities mimic the syntax and semantics of the dd copy functionality but not its ability to convert data.

The dd variants support these command line arguments:
     bs=<n>        typically 512 or 2048, must match device
   ibs=<n>       if given must be the same as "bs"
   obs=<n>       if given must be the same as "bs"
   if=<name>     read from this file or device, "-" (read from stdin)
   of=<name>     write to this file or device, "-" (write to stdout)
     skip=<n>      block offset to start reading "if"
   seek=<n>      block offset to start writing "of"
   count=<n>     number of "bs" sized blocks to copy from "if" to "of"

Extra options:
   bpt=<n>       blocks per transfer [per SCSI command] (default 128)
   coe=<n>       continue on error, 0->exit (def), 1->zero + continue
   dio=<n>       1->select Direct IO, 0->indirect IO [sg3_utils only]
   time=0|1      1->time transfer and calculate throughput
   cdbsz=6|10|12|16  select size of SCSI READ and WRITE command
                     blocks (default 10) [sg3_utils only]
   sync=0|1      1-> do SYNCHRONIZE CACHE after transfer

All numeric arguments can be in decimal or hexadecimal (only in sg3_utils). Hexadecimal values are prefixed with either '0x' or'0X'. Decimal argument accept these suffix multipliers:
  "c", "C"        * 1
  "b", "B"        * 512
  "k"             * 1024           [2 ^ 10]
  "K"             * 1000           [10 ^ 3]
  "m"             * 1048576        [2 ^ 20]
  "M"             * 1000000        [10 ^ 6]
  "g"             * 1073741824     [2 ^ 30]
  "G"             * 1000000000     [10 ^ 9]
  "t"             * 1099511627776  [2 ^ 40]    <skip, seek and count only in sg3_utils>
  "T"             * 1000000000000  [10 ^ 12]   <skip, seek and count only in sg3_utils>

The 'skip' and 'seek' options lead to the use of the system command lseek() to a byte offset when used on raw devices and normal files. For sg devices 64 bit block addresses are used in sg3_utils (32 bit block addresses for sg_utils thus limiting accesses on disks with 512 byte blocks to 1 TB). On 32 bit architectures the normal lseek() is limited to a signed 32 bit byte offset (i.e. 2 GB). These dd variants bypass this limit by using Linux's _llseek() [while modern dd commands use read loops to "walk" around the limit]. If 'count' is not given then the SCSI READ CAPACITY command (and, if necessary, its 16 byte variant in sg3_utils)will be used (on sg devices) if appropriate. Alternatively (in sg3_utils version 1.07 and later) if 'count' is not given and a block device (or partition) is specified (e.g.  /dev/hdb or /dev/sda2) then the block device (or partition) sector count is used. Disk partition information can be found with a command like "fdisk -ul /dev/sda".

The dd variants are careful to send all informative and error output to stderr so that it doesn't interfere with stdout which may be selected for output (by either not giving a "of=" argument or giving "of=-"). Since the output file is often /dev/null, a "." is taken as meaning /dev/null: hence these two arguments are synonymous: "of=/dev/null" and "of=." .

sg_dd

This utility will accept sg and raw devices as well as any file types that dd will accept as its input or output file. It is implemented in a similar fashion to dd in that it reads from the input file and then writes to the output file in sequence and in a single thread of execution. sg_dd requires that the 'bs' argument matches the block size of the physical device. [For disks this is usually 512 bytes.] It has an additional argument for controlling the number of blocks read or written per transfer called 'bpt' whose default is 128.

A command such as:
    $ dd if=/dev/sda skip=278 of=raw.dat bs=512 count=45
is equivalent to:
    $ sg_dd if=/dev/sg0 skip=278 of=raw.dat bs=512 count=45
if /dev/sda and /dev/sg0 refer to the same device.

sgp_dd

This utility uses POSIX threads to run multiple worker threads each doing repeated read write sequences. There is synchronization to make sure that IO operations on the input and output files are started in sequence. In cases where the input and output file are SCSI disks with the similar IO speeds this utility can give speed benefits.

The sgp_dd utility has these command line arguments in addition to those accepted by sg_dd:
Extra options:
   thr=<n>   is number of threads, must be > 0, default 4, max 16
   deb=<n>   0->none (def), >0 -> varying degrees of debug
 

The sg_dd and sgp_dd commands are also very useful for stress testing and measuring performance. Timing a 100 Megabyte read time from  block 0 of a disk becomes:
  $ time sg_dd if=/dev/sg0 of=/dev/null bs=512 count=200K
 

sgm_dd

This program is very similar to sg_dd and takes the same arguments. The only difference is that it uses mmap-ed IO instead of indirect IO. Since mmap-ed IO was introduced in sg version 3.1.22 (lk 2.4.17) then this command will not work on earlier versions. If either 'if' or 'of' is a sg device then mmap-ed IO will be use on it. If both 'if' and 'of' are sg devices then mmap-ed IO is used on the 'if' sg device and normal (indirect) IO is used on the 'of' sg device. The program is only available in sg3_utils.
 

sgq_dd

This program is very similar to sgp_dd and takes the same arguments. Instead of using POSIX threads for parallelism, sgq_dd uses non-blocking file descriptors, polling and a state machine. Performance is similar. The program is only available in the archive directory of sg3_utils (and needs to be build separately - it is not normally built or installed).

2. Scanning and mapping

sg_scan

This rather simple but useful program scans the sg devices and outputs information about each device found and optionally does an INQUIRY. It is roughly similar to the command: 'cat /proc/scsi/scsi'. Both of these commands will show the same number of devices in the same order. [An exception to the last statement occurs when "add-single-device" and "remove-single-device" are used.]

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 thus:
$ 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

sg_map

This utility shows the mapping of the available sg device names to the corresponding name of the sd, sr, st or osst device. Some sg devices such as scanners don't have a corresponding sd, sr, st or osst device name. The sg_map output for the SCSI devices shown in the previous section is probably:
$ sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/scd0
/dev/sg2  /dev/scd1
 

scsi_devfs_scan

This is a utility for doing a directory scan on a system running devfs to identify SCSI (and optionally IDE) devices. Various information (including an INQUIRY) can be listed for each found device. In sg3_utils this utility ha been moved to the archive directory.

3. SCSI support

sg_inq

This utility executes a SCSI INQUIRY command on the given device and interprets the results according to SPC-3 document. The term "standard INQUIRY" refers to a INQUIRY cdb that neither requests a Vital Product Data (VPD) page nor  Command Detail information (via the CmdDt bit). Here is the output from a standard INQUIRY. Actually the last entry ("Unit serial number") comes from the VPD page [0x80] of the same name if it is available. Older SCSI devices often put a serial number in a vendor specific area of a standard INQUIRY response (typically between bytes 36 and 55 inclusive).
$ sg_inq /dev/sda
standard INQUIRY:
  PQual=0  Device_type=0  RMB=0  version=0x03  [SPC]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=1  Resp_data_format=2
  SCCS=0  ACC=0  TGPS=0  3PC=0  Protect=0
  BQue=0  EncServ=0  MultiP=0  MChngr=0  [ACKREQQ=0]  Addr16=1
  [RelAdr=0]  WBus16=1  Sync=1  Linked=1  [TranDis=1]  CmdQue=1
  Clocking=0x3  QAS=0  IUS=0
    length=144 (0x90)   Peripheral device type: disk
 Vendor identification: SEAGATE
 Product identification: ST318451LW
 Product revision level: 0003
 Unit serial number: xxxxxxxxx

VPD pages are available from an INQUIRY, either in hex (e.g. with the option '-p=<vpd_page_hex>') or, in some cases, in decoded form. The importance of VPD pages is illustrated by two being made mandatory in latter versions of SPC-3: Supported VPD pages [0x0] and the Device Identification page [0x83]. Several VPD pages are now decoded. The "Supported VPD pages" page [0x0] is decoded when the '-e' option is given [without the '-p=<vpd_page_hex>' option] (sg3_utils >= v1.08). The Device Identification page [0x83] is decoded when the '-i' option is given (sg3_utils >= v1.07). The Extended INQUIRY page [0x86] is decoded when the '-x' option is given (sg3_utils >= v1.09). The SCSI Ports page [0x88] is decoded when the '-s' option is given (sg3_utils >= v1.11). The EMC (i.e. vendor) specific Unit Path Report page [0xc0] is decoded when the '-P' option is given (sg3_utils >= v1.09). Here is an example of the output from requesting the "Supported VPD pages" page:
$ sg_inq -e /dev/sg1
VPD INQUIRY, page code=0x00:
   [PQual=0  Peripheral device type: disk]
   Supported VPD pages:
     0x0        Supported VPD pages
     0x80       Unit serial number
     0x83       Device identification

There are still many (older and non-native) SCSI devices that ignore the EVPD bit (enable VPD in the INQUIRY cdb) and simply return a standard INQUIRY response. Various checks are made on the response when a VPD page is requested and if they fail an appropriate message is output.

The '-c' and  '-cl' options permit supported SCSI commands to be listed by using the CmdDt bit in an INQUIRY request. However SPC-3 has obsoleted this feature and introduced the new REPORT SUPPORTED OPERATION CODES SCSI command (see the sg_opcodes utility introduced in sg3_utils version 1.07). Not many SCSI devices support the new command yet.

In sg3_utils version 1.08 a '-d' switch has been added to decode version descriptors. A standard INQUIRY response optionally contains up to 8 of these. For example a SCSI disk might have 4 version descriptors: SAM-2, SPC-2, SBC and SPI-4. SAM-2 is general architectural compliance, SPC-2 for SCSI primary (i.e. common) commands supported, SBC for SCSI block command set and SPI-4 indicates Ultra 320 support. Here is an example of the version descriptors on a disk:
$ sg_inq -d /dev/sdb
standard INQUIRY:
  PQual=0  Device_type=0  RMB=0  version=0x03  [SPC]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=0  Resp_data_format=2
  SCCS=0  ACC=0  TGPS=0  3PC=0  Protect=0
  BQue=0  EncServ=0  MultiP=0  MChngr=0  [ACKREQQ=0]  Addr16=1
  [RelAdr=0]  WBus16=1  Sync=1  Linked=1  [TranDis=1]  CmdQue=1
  Clocking=0x0  QAS=0  IUS=0
    length=96 (0x60)   Peripheral device type: disk
 Vendor identification: FUJITSU
 Product identification: MAM3184MP
 Product revision level: 0106
 Unit serial number: xxxxxxxxx

  Version descriptors:
    SAM-2 (no version claimed)
    SPI-3 T10/1302-D revision 10
    SPC ANSI X3.301:1997
    SBC T10/0996-D revision 08c

scsi_inquiry

This program demonstrates the use of the SCSI_IOCTL_SEND_COMMAND ioctl to send a SCSI INQUIRY command. That ioctl() is supported by the SCSI sub system mid level and so is common to all sd, sr, st (osst) and sg devices. In sg3_utils this utility has been moved to the archive directory.

sginfo

This is a program for reporting MODE SENSE information about a SCSI device. It is a rework of the scsiinfo program written by Eric Youngdale. The difference is that sginfo obtains the information using the sg interface. The 'sginfo -l' command shows all SCSI block and character devices (i.e. sg devices) and the mapping between them. Disk defect sector lists are also available. [The original scsiinfo program can only report the first 4 KB (i.e. page size) of a defect list).]

sg_readcap

This call performs a READ CAPACITY command on the given device. For a disk this should yield the sector size and the number of sectors. The given name may be any SCSI device (i.e. not just sg devices).

sg_start

This is a program that has been provided by Kurt Garloff <garloff@suse.de> for spinning up (or down) disks.

sg_modes

Outputs MODE SENSE pages and does some decoding (mainly into hex).

sg_logs

Outputs LOG SENSE pages. These pages contain error counters, start-stop cycle counters, the current device temperature and the "informational exception" log. "Informational Exception" is SCSI standardese for "S.M.A.R.T." information.

sg_senddiag

This utility is mainly used to request the device to perform a self-test. Later devices can do both foreground and background, short and extended self tests. An option of this command list the time taken by the previous extended self test.

sg_whoami

This program prints out the scsi adapter number, channel, scsi id and lun (and optionally does a read capacity) on the given sg device. It is only available in the sg_utils package.

sg_reset

This program exercises the SCSI device/bus/host reset capability. It is supported by the sg driver in lk 2.2.16 and beyond but associated SCSI mid level driver changes have not been accepted into the standard kernel at this time (but may be shortly: lk 2.4.18). Some distributions contain the patch to the mid level that activates this feature (see the FAQ on the main page for these patches).

sg_persist

This utility accesses the Persistent Reservation In and Out SCSI commands. Persistent reservations are defined in SPC-3 and replace the Reserve and Release SCSI commands. This is a relatively low level facility that could be used to probe a storage network that already uses persistent reservations.

sg_opcodes

This utility invokes the REPORT SUPPORTED OPERATION CODES SCSI command to list all commands that a logical unit supports or to examine the support for a specific command. This relatively new SPC-3 command was introduced in February 2002. It replaces the now obsolete "CmdDt" facility in the INQUIRY command. When the '-t' command line option is used it invokes the REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS SCSI command and outputs the response.

sg_write_long

This utility invokes the WRITE LONG(10) SCSI command. This will write the given data (by default 0xff bytes) to the given logical block address on a disk. This will overwrite the user data component (typically 512 bytes), ECC and associated data. This can be useful  for creating MEDIUM ERRORs for testing purpose. A normal write (e.g. with sg_dd) to the same logical block address will remove the MEDIUM ERROR condition.

sg_read_long

This utility invokes the READ LONG(10) SCSI command. This utility can be used to view damaged blocks; also it can be used in conjunction with sg_write_long. The "--correct" option can be used to (attempt to) correct the returned data component given the associated ECC data.

sg_ses

This utility is designed primarily to query a processor (typically in a storage array) that supports SCSI Enclosure Services (see SES-2 at http://www.t10.org ). There is a crude facility to send controls to a SES device.

sg_requests

This utility issues a SCSI REQUEST SENSE command to the given device. Optionally descriptor sense format can be requested.

sg_verify

This utility allows a SCSI block device (e.g. a disk) to be verified. It uses the SCSI VERIFY (10) command for this purpose.

sg_emc_trespass

This utility is specific to certain EMC products. It allows the ownership of a LUN to be changes from some other service processor to the processor issuing this utility.

sg_luns

This utility sends a SCSI REPORT LUNS command to the given device and lists the luns returned. If the '--decode' option is given then the 64 bit luns are decoded according to section 4.9 of the SAM-3 (rev 14) draft standard.

sg_sync

This utility sends a SCSI SYNCHRONIZE CACHE command to the given device. This command is typically used before a storage device is removed, taken offline or powered down.

sg_prevent

This utility sends a SCSI PREVENT ALLOW MEDIUM REMOVAL command to the given device. This command is currently defined in SPC-3 and the MMC series which means that it has a slightly different meaning for cd/dvd devices from other SCSI devices that support removable media.

sg_get_config

This utility sends a SCSI GET CONFIGURATION command to the given device. This command is only defined for MMC devices (i.e. cd/dvd devices) and yields features and profiles of a device (e.g. whether DVD+R DL discs can be written) and the media currently in the device.

sg_wr_mode

This utility modifies mode pages with the SCSI MODE SELECT command. It can use the existing contents of the mode page (fetched by a SCSI MODE SENSE command) as a template than new values are masked into as the new mode page contents. Views mode pages as a series of bytes. [sginfo can also modify mode pages but only standard one through an awkward interface.]

sg_rtpg

This utility sends a SCSI REPORT TARGET PORT GROUPS command to the given device.

sg_reassign

This utility sends a SCSI REASSIGN BLOCKS command to the given device which should be a disk. Blocks that report unrecoverable errors can be reassigned (with potential loss of data). Blocks with recoverable errors which are not automatically reassigned (by the AWRE and ARRE bits in the "read write error recovery" mode page) can also be reassigned (with no loss of data).

4. Timing and testing

sg_rbuf

This utility can be used to test SCSI bus throughput. It uses the SCSI Read Buffer command to get data from the data buffer on the SCSI device into the user space. The author uses it on his mounted root partition disk without any ill effects. With the '-q' switch the final transfer from the kernel DMA buffers to the user space is by-passed. There is also a '-d' switch for direct IO and a '-m' switch for mmap-ed IO. A '-t' switch times the operation and calculates a MB/sec throughput figure.

sg_test_rwbuf

This test program has been written by Kurt Garloff <garloff@suse.de>. It issues read and write commands to a device's buffer (typically the disk cache in the drive electronics) and calculates checksums.

sg_read

This program reads multiple blocks of data starting at the same logical address. It can time the transfers (potentially ignoring the first issued command) and calculate a MB/sec figure. [In keeping with most disk manufacturers, "MB" is 1,000,000 bytes in this context.] Its command line syntax is modelled on sg_dd. It allows SCSI device, SCSI bus bandwidth and the SCSI sub-system throughput to be measured. This can be done in 3 modes: normal transfer to user space, direct IO or mmap-ed IO.

sg_turs

This command executes a user specified number of TEST UNIT READY commands on the given device. This can be used to time SCSI command overhead.

sg_debug

In the sg_utils package, this program prints out the internal state of the sg driver at the instant when it is called. In the sg3_utils package is simply prints out a short message advising the user to execute the command 'cat /proc/scsi/sg/debug' (rather than call this program).

5. Example programs

There are two simple programs for first time users that send SCSI INQUIRY and TEST UNIT READY commands to a sg device. They are called sg_simple1 and sg_simple2. The latter program has simpler but more basic SCSI error processing while the former uses "sg_err.[hc]" discussed below. The sg_simple3 program demonstrates user space scatter gather offered by the sg_io_hdr interface in the sg version 3 driver.  The sg_simple4 program demonstrates mmap-ed IO on the response of an INQUIRY. The sg_simple16 program does a READ_16 (a 16 byte long SCSI
command) which is available on kernel >= lk 2.4.15 (and only on adapters that support it).

sg_runt_ex is a program demonstrating run time selection of the sg driver and using extra features when available. It is meant to be example code for those who base their applications on sg. It performs INQUIRY and TEST UNIT READY commands. Code compiled under 2.0, 2.2 or 2.3 series kernels may be run on any of the 3 series with extra features available if the run time kernel is >= 2.2.6 . This program is only available in the sg_utils package.

6. Miscellaneous

isosize

This utility gives the number of bytes in an iso9660 file system. It is a rewrite by Andries Brouwer<Andries.Brouwer@cwi.nl> of a utility that first appeared in the cdwrite package but is now difficult to obtain. Note that the value given by isosize is usually 2 or more blocks less than the READ CAPACITY SCSI command yields on a CD-ROM (due to run out sectors). This utility has been placed in the archive directory since it can now be found in the util-linux-2.10s package (and later).

Notes

Starting with sg3_utils-1.09 a library called libsgutils is built and is required by all utilities. The library is made up of two source files: sg_lib.c and sg_cmds.h . The sg_lib.c file contains SCSI command, sense key and additional sense code strings and various related helper functions. The sg_cmds.c file contains low level wrapper functions for commonly used SCSI commands. The library is built both as a shared object and a static library. The binary rpm package only contains the shared library while the sg3_utils-devel rpm package contains the static library, sg_lib.h and sg_cmds.h . If users do not want libraries (shared or static) than they can refer to the "lib_no_lib" subdirectory in the tarball which contains "no_lib" versions of the Makefile and the rpm "spec" file.

Many of the utilities in the sg3_utils package use the SG_IO ioctl (rather than the older write()/read() interface) in the sg driver. In the lk 2.6  series the SG_IO ioctl (or at least a stripped down version of it) has been implemented in the block subsystem. That means that commands that previously only worked on sg device names will now work on block device names as well (e.g. "sg_inq /dev/sda"). To use this facility safely version sg3_utils-1.02 or later should be used. Note that SCSI tape devices (both st and osst device drivers) are char devices and support the SG_IO ioctl from lk 2.6.6 onwards.

See the notes about header file problems in the README file inside each package.

Download

Various tarballs that include the source, a README, CHANGELOG, INSTALL and a Makefile can be found in the sg_utils tables on the main page (link at the bottom of this page). There are also source and i386 binary rpm and deb packages available. Both sg3_utils and the older sg_utils can be found on http://freshmeat.net .

Programs from other sources

scu

The SCSI Command Utility (SCU) implements various SCSI commands necessary for normal maintenance and diagnostics of SCSI peripherals. Some of its features include: formatting, scanning for (and reassigning) bad blocks, downloading new firmware, executing diagnostics and obtaining performance information. It is available on several Unix platforms (and NT), however it is only currently available in binary form. See www.bit-net.com/~rmiller/scu.html for more details.

dt

The Data Test (DT) program is modelled on dd's syntax but dt can do a lot more than sequential copies. It is a comprehensive data test program for SCSI devices such as disks, tapes and cdrom/dvds. It is available on several Unix platforms (and NT), and its source is available (unlike its stable mate scu discussed earlier). See www.bit-net.com/~rmiller/dt.html for more details. Both scu and dt are written by Robin T. Miller <Robin.Miller@compaq.com>

scsidev

Kurt Garloff <garloff@suse.de> describes this utility thus: "This program scans the SCSI bus and creates device nodes in /dev/scsi/, which have a naming corresponding to their SCSI IDs and LUNs, just like with devfs. (The devfs has no notion of host adapter IDs, scsidev is better here.) Furthermore, the devices are inquired to tell their names and serial numbers. Those can be compared with the entries in a database /etc/scsi.alias and device nodes corresponding to these entries are being built. So,this will even work if you change the SCSI IDs of a device, where the devfs approach would fail". For more information see: www.garloff.de/kurt/linux/scsidev . He also has the useful rescan-scsi-bus.sh script at the same location.

ddrescue

This is another utility from  Kurt Garloff <garloff@suse.de> for rescuing damage media. It is a variant of dd that will continue passed errors on the input file. It is applicable to any device that can be read by dd (e.g. IDE and SCSI disks, cds and tapes). For more information see: www.garloff.de/kurt/linux/ddrescue

mapscsi

Michael Clark <michael@metaparadigm.com> describes his utility thus: "mapscsi is a small utility that creates a consistent mapping to Linux scsi devices. mapscsi achieves this by creating symbolic links to linux scsi disk devices after scanning all scsi disk devices, finding out their host, channel, id, lun, pci location (if available), Fibre Channel world wide node and port names, loop and port ids (with qla2x00 v4.46.5 driver) vendor, product and serial number details and using this information plus a mapping rules file containing device templates to dynamically create link names". For more information see: http://gort.metaparadigm.com/mapscsi .

scsimap

Steve Cameron <smcameron@yahoo.com> has the following description at his site:

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 .

smartsuite

This is a package that supports S.M.A.R.T. capabilities built into modern IDE and SCSI-3 disks. Self-Monitoring, Analysis and Reporting Technology (S.M.A.R.T.) is described at www.pc.ibm.com/us/infobrf/ibsmart.html. For smartsuite see sourceforge.net/projects/smartsuite .

smartmontools

This project seems to have taken over from the aforementioned smartsuite which is currently not actively maintained. See http://smartmontools.sourceforge.net .

scsirastools

"This project includes changes that enhance the Reliability, Availability and Serviceability (RAS) of the drivers that are commonly used in a Linux software RAID-1 configuration. Other efforts have been made to enable various common hardware RAID adapters and their drivers on Linux." See http://scsirastools.sourceforge.net . The pacakage contains some low level scsi utilities including sgdskfl to load disk firmware, sgmode to get and set mode pages, sgdefects to read primary and grown defect lists and sgdiag to perform format and other test functions.
 

SeaTools

SeaTools is a freely available (binary, not source) utility for disk diagnostics from Seagate which is a disk manufacturer. It can be found at http://www.seagate.com under support. They have both a command line and a graphical utility.  Some of the facilities will work on any SCSI disks while others are Seagate specific. Selt tests, mode page settings and formats (to different block sizes) are amongst the facilities available.

devlabel

Devlabel is "a small userspace app which maps symlinks to underlying disk names. It uses [INQUIRY VPD] Page83/Page80 data to track the true locations of disks even if their hd/sd name changes and simply updates the symlink to point to the right place." Sysfs support for the lk 2.6 series and support for multi-path configurations is on the author's "to do" list. See http://www.lerhaupt.com/linux.html .

plscsi

This utility allows arbitrary SCSI commands to be sent to a device. See http://members.aol.com/plscsi .

Return to main page.

Last updated: 21st January 2005, 17:00