The sg3_utils package

Introduction

Contents of sg3_utils

Sub directories

Exit status

Changing mode page settings

Examples

libsgutils

NVME Support

Download and build

Git mirrors

Introduction

The sg3_utils package contains utilities that send SCSI commands to devices. As well as devices on transports traditionally associated with SCSI (e.g. Fibre Channel (FCP), Serial Attached SCSI (SAS) and the SCSI Parallel Interface(SPI)) many other devices use SCSI command sets. ATAPI cd/dvd drives and SATA disks that connect via a translation layer or a bridge device are examples of devices that use SCSI command sets.

SCSI command sets are divided into a common set and several device class specific sets. The common set of commands is referred to as the SCSI Primary Commands (SPC) with SPC-4 being the most recent standard. The mandatory SCSI INQUIRY command is defined in SPC-4. The SCSI Block Commands (SBC) cover direct access devices such as disks. The MultiMedia Commands (MMC) cover CD, DVD and BD drives and the media within them. SCSI command sets and transport definitions can be found at the www.t10.org . That site includes this helpful diagrammatic overview: www.t10.org/scsi-3.htm .

The sg3_utils package was developed for the Linux kernel 2.4, 2.6, 3 and 4 series and is still being enhanced. An earlier package called sg_utils targeted the Linux kernel 2.2 series with some support for the 2.0 series. See an earlier version of this web page for further information about sg_utils.  This document describes version 1.44 of sg3_utils .  The majority of these utilities have been ported to the FreeBSD, Solaris, Tru64 and the Windows operating systems (Windows 2000 and later supported).

In the Linux kernel (lk) 2.4 series most of these utilities must be used with a SCSI generic (sg) driver device name (e.g. /dev/sg0). In the lk 2.6, 3 and 4 series almost all of these utilities can be used with the primary device names as well (e.g. /dev/sda, /dev/scd0, /dev/st0 and /dev/hdd (if it is an ATAPI device)). From lk 2.6.28 bsg devices can also be used (e.g. /dev/bsg/3:0:0:0 ).

A list of SCSI and storage utility programs can be found on this tools page.

Contents of sg3_utils

This package contains over 50 utilities, their "man" pages, build files and general documentation. The utilities have a command line interface which in general has this form:

     UTILITY_NAME [OPTIONS] DEVICE

No more than one DEVICE name can be given (and in a few cases, no DEVICE name is required). Below is a table in alphabetical order of the utilities in the sg3_utils package:

Table 1. Main utilities in sg3_utils

Utility name

Main SCSI commands
invoked

CLI

Ported

Notes

sginfo
[legacy, use sdparm]

MODE SENSE/SELECT, READ DEFECT
[6, 10] [RD: 10, 12]

adhoc


symbolic decoding (optional changing) of mode pages. Can also output (disk) defect lists. Port of older scsiinfo utility.

sgm_dd

READ, WRITE
[6, 10, 12, 16]

dd


sg_dd variant that uses memory mapped IO (only on Linux sg devices)

sgp_dd

READ, WRITE
[6, 10, 12, 16]

dd


sg_dd variant that uses POSIX threads

sg_bg_ctl

BACKGROUND CONTROL

getopt

f,s,t,w

start/stop advance background control operations on disk

sg_compare_and_write

COMPARE AND WRITE

getopt

f,s,t,w

if compare successful then write

sg_copy_results

RECEIVE COPY RESULTS

getopt


used to get the results from the previous sg_xcopy (EXTENDED COPY(LID1))

sg_dd

READ, WRITE
[6, 10, 12, 16]

dd


Unix dd command variant, uses SG_IO ioctl to send SCSI commands to copy data. See the sg_dd page. Newer ddpt utility adds features and is ported to "f,s,w"

sg_decode_sense


getopt

f,s,t,w

decodes sense data given as a string of hexadecimal bytes or in binary. Also may decode command opcodes and sg3_utils exit status values.

sg_emc_trespass

MODE SELECT

adhoc


utility specialized for EMC Clariion series

sg_format

FORMAT UNIT (SBC) and
FORMAT MEDIUM (SSC)

getopt

f,s,t,w

format or resize a SCSI disk (with FORMAT UNIT). Alternatively sg_format can format a tape (with FORMAT MEDIUM)

sg_get_config

GET CONFIGURATION

getopt

f,s,t,w

fetch features and profiles of a cd/dvd drive and/or its current media

sg_get_lba_status

GET LBA STATUS

getopt

f,s,t,w

logical block provisioning support

sg_ident

REPORT/SET IDENTIFYING INFORMATION

getopt

f,s,t,w

default is to report (fetch) the device identifier. With the '--set' option a new identifier is sent to the device.

sg_inq

INQUIRY

getopt+

f,s,t,w

fetch standard response, VPD pages or version descriptors. Also can perform IDENTIFY (PACKET) DEVICE ATA command in Linux. If given an NVMe device and no VPD page is requested or implied by the given options then show NVMe Identify controller and namespace responses. VPD page decoding also performed by sg_vpd and sdparm.

sg_logs

LOG SENSE

getopt+

f,s,t,w

fetch log sense pages, decode standard and some vendor pages

sg_luns

REPORT LUNS

getopt

f,s,t,w

fetch luns reported by a device (lun 0 or "well known lu")

sg_map

INQUIRY

adhoc


shows mapping between sg devices and primary device node (if any). Instead of using sg_map, in lk 2.6 and later the lsscsi utility is recommended.

sg_map26


getopt


maps between single Linux sg device and primary device node (and vice versa). Also does mapping in to, and out of, sysfs. For the Linux 2.6 series and later. Instead of using sg_map26, the lsscsi utility is recommended.

sg_modes

MODE SENSE
[6, 10]

getopt+

f,s,t,w

fetch mode pages (output mainly in hex, to decode output use sdparm)

sg_opcodes

REPORT SUPPORTED OPERATION CODES

getopt+

f,s,t,w

fetch supported SCSI commands or supported task management functions

sg_persist

PERSISTENT RESERVE IN/OUT

getopt

f,s,t,w

control persistent reservations and report reservation status

sg_prevent

PREVENT ALLOW MEDIUM REMOVAL

getopt

f,s,t,w

control media removal, mainly for those SCSI devices which have removable media (e.g. CD/DVD and tape drives)

sg_raw

<user specified>

getopt

f,s,t,w

send user supplied cdb

sg_rbuf

READ BUFFER

getopt+


read from SCSI device cache. Typically for testing the SCSI transport (for throughput or errors)

sg_rdac

MODE SENSE/SELECT
[6, 10]

adhoc

f,s,t,w

display or modify RDAC redundant controller mode page

sg_read

READ
[6, 10, 12, 16]

dd


read continually from same offset. Syntax similar to sg_dd (without write side). Can test SCSI device cache and transport performance.

sg_read_attr

READ ATTRIBUTE

getopt+

f,s,t,w

fetch and decode attributes. Modern tape systems implement this SCSI command.

sg_readcap

READ CAPACITY
[10, 16]

getopt+

f,s,t,w

fetch the number of blocks and the individual block size for disks and CD/DVD media

sg_read_buffer

READ BUFFER(10) and
READ BUFFER(16)

getopt

f,s,t,w

retrieve descriptors, error history or data from device.

sg_read_long

READ LONG

getopt

f,s,t,w

read data from given LBA which includes the block and ECC data.

sg_reassign

REASSIGN BLOCKS

getopt

f,s,t,w

reassign a LBA from one sector on a disk (typically damaged) to a new (spare) sector. User data copied if it is recoverable.

sg_referrals

REPORT REFERRALS

getopt

f,s,t,w

report data segment accessibility from target port groups

sg_rep_zones

REPORT ZONES

getopt

f,s,t,w

sends this command to a ZBC (SMR) device and decodes the result. A SAT layer may translate SCSI ZBC commands to ATA ZAC commands that a disk understands

sg_requests

REQUEST SENSE

getopt

f,s,t,w

fetch sense data from the given device. Modern uses include getting a progress indication (e.g. during a format) or finding the power condition state.

sg_reset

-

adhoc


Issue a driver, (SCSI) bus or device (target or lun?) reset.

sg_reset_wp

RESET WRITE POINTER

getopt

f,s,t,w

sends this command to a ZBC (aka shared magnetic recording [SMR]) device. The corresponding ATA standard is known as ZAC.

sg_rmsn

READ MEDIA SERIAL NUMBER

getopt

f,s,t,w

Relatively new command added to SPC-3. Format of response is vendor specific so this utility outputs it in hex (default) or binary.

sg_rtpg

REPORT TARGET PORT GROUPS

getopt

f,s,t,w

Specialized for multi-ported SCSI devices where one port (or a group of them) is preferred for IO over another (or others).

sg_safte

READ BUFFER

getopt

f,s,t,w

fetch information from a SAF-TE processor

sg_sanitize

SANITIZE

getopt

f,s,t,w

Send SCSI SANITIZE command

sg_sat_identify

ATA PASS-THROUGH
[12, 16]

getopt

f,s,t,w

Send ATA IDENTIFY DEVICE or IDENTIFY PACKET DEVICE  commands via the SAT ATA PASS-THROUGH SCSI command.

sg_sat_phy_event

ATA PASS-THROUGH
[12, 16]

getopt

f,s,t,w

Sends an ATA READ LOG EXT command via a SAT to fetch log page 11h which contains SATA phy event counters.

sg_sat_read_gplog

ATA PASS-THROUGH
[12, 16]

getopt

f,s,t,w

Sends an ATA READ LOG (DMA) EXT command via a SAT to fetch a log page

sg_sat_set_features

ATA PASS_THROUGH
[12, 16]

getopt

f,s,t,w

Sends ATA SET FEATURES command via SAT

sg_scan
[.c.linux]

[INQUIRY]

adhoc

Linux
only

maps each sg device name to the corresponding numeric <host, channel, target, lun> tuple. In lk 2.6 series (and later) the "lsscsi -g" command is similar.

sg_scan
[.c.win32]

[INQUIRY]

getopt

win32
only

shows one device per line, with the device's various names and INQUIRY response string on that line.

sg_seek

SEEK, PRE-FETCH[10, 16]

getopt

f,s,t,w

These commands move no data, they suggest to the device what may be useful to add to the device's cache. Useful for random (i.e. non-sequential as read-ahead is now useless) reads, when the LBA of the next read access is known.

sg_senddiag

SEND DIAGNOSTIC

getopt+

f,s,t,w

Issues either a default self test or a short/extended foreground/background self test. With no arguments it uses RECEIVE DIAGNOSTIC RESULTS to list all supported diagnostic pages.

sg_ses

SEND/RECEIVE DIAGNOSTIC

getopt

f,s,t,w

Fetches status diagnostic pages from, and sends some control pages to, a SCSI Enclosure Services (SES) device. See the sg_ses page. Can pass-through to NVMe enclosure if present.

sg_ses_microcode

SEND/RECEIVE DIAGNOSTIC

getopt

f,s,t,w

This microcode (firmware) download (to device) is SES specific. A more general way, typically used with disks, is with sg_write_buffer.

sg_start

START STOP UNIT

getopt+

f,s,t,w

Controls the power condition state of a SCSI device. Primary use is to spin up and down SCSI disks. Can also load and eject removable media.

sg_stpg

SET TARGET PORT GROUPS

getopt

f,s,t,w

Specialized for multi-ported SCSI devices where one port (or a group of them) is preferred for IO over another (or others).

sg_stream_ctl

STREAM CONTROL, GET STREAM STATUS

getopt

f,s,t,w

these commands together with WRITE STREAM command (in the sg_write_x utility) support streams in SCSI. Streams associate data of similar expected lifetime together. The Block limits VPD page (and the coresponding extension VPD page) contain information about streams on a disk, typically a SSD.

sg_sync

SYNCHRONIZE CACHE
[10, 16]

getopt

f,s,t,w

Causes disk caches to be flushed to media

sg_test_rwbuf

READ/WRITE BUFFER

getopt


Random pattern written to SCSI device buffer then read back and checked. Used in testing for data corruption.

sg_timestamp

REPORT/SET TIMESTAMP

getop

f,s,t,w

Report or set timestamp which is a 48 bit unsigned integer containing the number of milliseconds since 1970-01-01 00:00:00 UTC

sg_turs

TEST UNIT READY

getopt+

f,s,t,w

Issue one or more Test Unit Ready commands. Can be used to time SCSI command overhead.

sg_unmap

UNMAP

getopt

f,s,t,w

logical block provisioning support ("Trim" in the ATA world)

sg_verify

VERIFY
[10, 16]

getopt

f,s,t,w

reads indicated blocks on a SCSI disks, stops on the first error found. Does not yield any data. Useful for media scans.

sg_vpd

INQUIRY

getopt

f,s,t,w

Decodes standard and some vendor Vital Product Data (VPD) pages.

sg_write_buffer

WRITE BUFFER

getopt

f,s,t,w

write data; can be used to download firmware

sg_write_long

WRITE LONG
[10, 16]

getopt

f,s,t,w

writes to a LBA, data which includes the block and ECC data. Suitable data typically fetched by prior sg_read_long utility.

sg_write_same

WRITE SAME
[10, 16, 32]

getopt

f,s,t,w

writes a single block to one or more (consecutive) LBAs. Also supports some logical block provisioning options.

sg_write_verify

WRITE AND VERIFY
[10, 16]

getopt

f,s,t,w

send one or more commands to consecutive LBAs, reading data from a given file or stdin.

sg_write_x

WRITE [16,32]
ORWRITE [16,32]
WRITE ATOMIC [16,32]
WRITE SAME [16,32]
WRITE SCATTERED [16,32]
WRITE STREAM [16, 32]

getopt

f,s,t,w

command line options will pick 1 of the 6 variants with 1 of the 2 cdb lengths. Almost all will require the --in=IF option which identifies the file (IF) holding the data (in binary) to be written. The exception is --same=1 which sets the NDOB (no data-out buffer) flag in the WRITE SAME command. Of the 32 byte cdb variants, ORWRITE(32) is the only one that does not require the device to be formatted with either type 1, 2 or 3 protection information.

sg_wr_mode

MODE SELECT
[6, 10]

getopt

f,s,t,w

writes mode pages supplied in ASCII hex (e.g. from "sg_modes -r") to the  SCSI device. See sdparm for another method of setting mode page parameters.

sg_xcopy

EXTENDED COPY(LID1)

dd


Uses the EXTENDED COPY(LID1) command to copy between disks. Note: the ddpt utility contains this functionality and adds ODX (a subset of XCOPY(LID4)) capability. ddpt is ported to f,s,w. Note that "LID1" EXTENDED COPY commands have been removed from SPC-5 drafts. The remaining "LID4" commands in SPC-5 have dropped the "LID4" suffix.

sg_zone

CLOSE ZONE, FINISH
ZONE, OPEN ZONE, SEQUENTIALIZE ZONE

getopt

f,s,t,w

Sends one of these commands to the given ZBC device. See related sg_rep_zones and sg_reset_wp.


More SCSI commands may be issued than shown in the Main SCSI commands invoked column. For example many utilities issue a SCSI INQUIRY command to find out the peripheral device type of the given device. Some SCSI commands listed above are only relevant to a specific device type (e.g. FORMAT UNIT for disks) and should not be sent to a device belonging to another peripheral device type. See the COVERAGE file in the main directory for a more exhaustive list of SCSI (and ATA) commands issued by the sg3_utils utilities.

The source code for all the main utilities in table 1 is found in the src sub-directory. Prior to version 1.25 this source was found in the main directory. Each utility listed has a corresponding "man" page in the doc sub-directory. There is also a 'man sg3_utils' page that documents conventions common to all utilities in this package (e.g. their exit status values).

The CLI column indicates what kind of Command Line Interface the utility has. Recent utilities have a CLI based on the getopt_long() function which offers both long option names (e.g. "--verbose") and a short form (e.g. '-v'). Both forms can take an argument. Experience has led to consistent use of various options such as "--help", "--verbose" and "--version" across these utilities and is documented in 'man sg3_utils'. Utilities with this type of CLI are marked with "getopt" in the CLI column. The earlier utilities had an "ad hoc" type CLI that unfortunately lacked consistency and had a mix of long and short forms (with the long form sometime prefixed with "-" and on other occasions with "--"). Utilities with this type of CLI are marked with "adhoc". There is also a group of utilities that are related to the Unix dd command and share its quirky CLI. Finally a group of well used utilities with ad hoc command line interfaces had a getop_long() based interface added in sg3_utils version 1.23 . This group contains significant utilities such as sg_inq, sg_logs and sg_modes. The default CLI for this group is "getopt" but by using "--old" or "-O" as the first option the older ad hoc options can be used. This group will default to the older ad hoc interface if the environment variable SG3_UTILS_OLD_OPTS is defined. Utilities with this type of CLI are marked with "getopt+".

If the Ported column is empty then the utility is only found in Linux. Support for other ports is indicated by "f" for FreeBSD, "s" for Solaris, "t" for Tru64 (OSF), and "w" for Windows. See the README, README.freebsd, README.solaris, README.tru64, README.win32, and the INSTALL files for more information. Linux now has a sub-architecture of Android.

Below is a table of executable scripts (based on the bash shell, other Unix shells may work) found in the scripts directory and installed in some environments. In many cases these scripts use executables listed in table 1. In several cases these scripts overcome the restriction on the utilities in table 1 of only accepting one device per invocation (e.g. scsi_readcap can report on multiple devices while sg_readcap can only report on one). These scripts have an "-h" option for help/usage and a '-v' option for increased verbosity, amongst other options.

Table 2. Executable scripts in scripts directory

script name

<devices>
on cl

Description           

rescan-scsi-bus.sh

0

copy of Kurt Garloff's useful script with additions from Suse amongst others

scsi_logging_level

0

create, get or set Linux scsi logging level

scsi_mandat

1

check for mandatory SCSI command support

scsi_readcap

1 or more

use SCSI READ CAPACITY command on each given device

scsi_ready

1 or more

use SCSI TEST UNIT READY on each given <device>

scsi_satl

1

check for SCSI to ATA Translation Layer (SATL) support

scsi_start

1 or more

use SCSI START STOP UNIT command to start each <device>

scsi_stop

1 or more

use SCSI START STOP UNIT command to stop each <device>

scsi_temperature

1 or more

use SCSI LOG SENSE command to fetch temperature of each <device>



Below is a table of other utilities (and scripts) found in sg3_utils and related packages.


Table 3. Other utilities in sg3_utils or related

Utility

Main SCSI commands
invoked

directory

CLI

Ported

Notes

ddpt

READ, WRITE

-->

dd

f,s,w

dd variant, rewrite of sg_dd. In its own package: ddpt

hxascdmp

-

utils

adhoc

f,s,w

converts stdin (assumed binary) to ASCII hex and ASCII, sending its output to stdout (like the Unix od command and hexdump in BSD)

sas_disk_blink

MODE SELECT

-->



script in sdparm package. It blinks the ready LED on a SAS disk

scsi_inquiry

INQUIRY

examples

adhoc


uses deprecated SCSI_IOCTL_SEND_COMMAND ioctl

sdparm

MODE SENSE/SELECT, INQUIRY

-->

getopt

f,s,t,w

was in the sg3_utils package for a while; now in own package, see sdparm . sdparm manipulates mode pages, reads VPD pages and sends simple commands

sg_chk_asc

-

utils

getopt

f,s

check asc/ascq codes from www.t10.org page against sg3_utils internal table

sg__sat_identify

ATA PASS-THROUGH

examples

adhoc


Simpler version of sg_sat_identify that uses the Linux SG_IO ioctl directly.

sg__sat_phy_event

ATA PASS-THROUGH

examples

getopt


Simpler version of sg_sat_phy_event

sg__sat_set_features

ATA PASS_THROUGH

examples

getopt


Simpler version of sg_sat_set_features that uses the Linux SG_IO ioctl directly.

sg_simple1,2,3,4,5

INQUIRY, TEST UNIT READY

examples

adhoc


Simple code examples of using the scsi generic (sg) driver interface

sg_simple16

READ

examples

adhoc


Simple code example of sending a 16 byte cdb SCSI READ command

smp_discover

SAS SMP commands

-->


f,s

discover phy attachments within a SAS expander. In separate package: smp_utils



The directory column contains the name of the sub-directory in which the utility source code is found. Source code in these sub-directories may, in some cases, be built by Makefiles in those sub-directories. See the README file for more information. Not all the code in the examples sub-directory is listed in table 3. Some utilities in these sub-directories have "man" pages.

This paragraph contains Linux specific information. All utilities that issue SCSI commands and that appear in table 1, with the exception of sgp_dd, issue SG_IO ioctls. The sgp_dd utility issues SCSI commands using the sg driver's asynchronous ( write()/read() ) interface to device nodes that have the sg driver's major device number (i.e. "char" major 21). This means that all utilities in table 1 are "safe" with any given device node. If the device node does not support the SG_IO ioctl then that is reported and the utility exits. sg3_utils version 1.27 introduces support for bsg: the ./configure stage of the package build needs to find /usr/include/linux/bsg.h and at run time the bsg char device needs to be present in the /proc/devices pseudo file. Then if the device given to utility has a char major that matches bsg then the SG_IO ioctl is used with the sg version 4 interface.

Irrespective of the device node used to access a device, care should be taken not to interfere with a device while it is "active". For example invoking a "sg_format -F" utility on a disk with one or more of its partitions in use (e.g. a mounted file system) is obviously unwise.

Sub directories

The sg3_utils package has several sub-directories that are outlined in the following paragraphs. Prior to sg3_utils version 1.25 the Makefile in the main directory only build code from the main directory (thus, for example, it did not build the code in the examples sub-directory). From sg3_utils version 1.25 the build infrastructure files (i.e. configure.ac, Makefile.am, src/Makefile.am, include/Makefile.am, lib/Makefile.am and doc/Makefile.am) build code found in the lib, src, doc and include sub-directories.

The archive sub-directory contains code that was recently displaced from the src sub-directory. To reduce the size of the overall package, the amount of code carried forward from one release to the next is reduced from time to time.

The debian sub-directory contains rules for building a Linux debian package (i.e. ".deb") from the source code. There is a build_debian.sh shell script in the main directory that can be executed to build a debian package. Note that various distributions that use debian packages and include sg3_utils may vary their build scripts from the ones supplied in this sub-directory.

The doc sub-directory contains a README file which contains urls of web documents related to sg3_utils. The html code used to be present in this sub-directory but it was bloating the package. From sg3_utils version 1.25 the source for the man pages is found in this sub-directory. Those files end with the extension ".8" indicating that they are grouped in the system administration command section. Information common to all utilities has been placed in a man page called sg3_utils.

The examples sub-directory contains relatively simple code examples that may be useful to those trying to use the SCSI pass-through mechanism in the supported operating systems. It also shows the usage of the common library code. There is a test script and data for the sg_persist utility. There is also some test data for sg_reassign and sg_senddiag utilities.

The getopt_long sub-directory contains code for implementing the getopt_long() library call which is not present in Tru64 (osf).

The include sub-directory was introduced in version 1.25 and contains C header files. These header files are common to many utilities in this package. The header files are written in such a way so that they compile cleanly in C++ .

The lib sub-directory was introduced in version 1.25 and contains C source files that are used by many of the utilities. Depending on the target architecture and configure options, these files may be build into a library. The source files are written to compile cleanly as C or C++.

The suse sub-directory contains rules for building a Linux Suse package (i.e. ".rpm") from the source code.

The src sub-directory was introduced in version 1.25 . It contains the C source code for each of the main utilities. In most cases each utility has a single C source file (e.g. sg_inq.c for the sg_inq utility). In some cases there may be an additional helper file (e.g. the sg_vpd utility has both sg_vpd.c and sg_vpd_vendor.c).

The scripts sub-directory contain shell scripts for common chores and for checking compliance. Unlike most utilities in the src sub-directory, many of these scripts can take multiple device names. For example: 'scsi_stop /dev/sd*' will attempt to stop (spin down) all SCSI disks. See the README file in that directory for more information.

Exit status

These command line utilities run as processes and finish with an exit status of 0 when successful. Prior to version 1.21 all errors yielded an exit status of 1. Having finer grain error reporting via the exit status from relatively low level sg3_utils utilities allows higher level scripts and other program wrappers to do more useful error processing.

Indicative exit status values were first added in version 1.22 , the current list is shown below.

Table 4.  Exit status values

Exit
status

  Description

0

no error detected. Utility completed successfully

1

syntax error in command line options or their arguments, or an illegal combination of options

2

the device reports that it is not ready for the operation requested. The device may be in the process of becoming ready (e.g. spinning up but not at speed) so the utility may work a little while later

3

the device reports a medium or hardware error (or a blank check). For example an attempt to read a corrupted block on a disk will yield this value

5

the device reports an "illegal request" with an additional sense code other than "invalid operation code". This is often a supported command with a field set requesting an unsupported capability. For commands that require a "service action" field (e.g. READ CAPACITY(16) ) this value can indicate that the command is not supported

6

the device reports a "unit attention" condition. This usually indicates that something, unrelated to the requested command, has occurred (e.g. a device reset) potentially before the current SCSI command was sent. The requested command has not been executed by the device. Note that unit attention conditions are usually only reported once by a device

7

the device reports  a  "data  protect" sense key. This implies some mechanism has blocked writes (or possibly all access to the media).

9

the device reports an illegal request with an additional sense code of "invalid operation code" which means that the device doesn't support the requested command

10

the device reports a "copy aborted" sense key

11

the device (or transport) reports an aborted command. In some cases this can be caused by congestion on the transport and retrying the command may be successful

14

the device reports a "miscompare" sense key. sg_verify and sg_compare_and_write may report this. Introduced in version 1.37

15

the utility is unable to open, close or use the given device or another file. The given file name could be incorrect or there may be permission problems. Adding the '-v' option may give more information

17

a SCSI "Illegal request" sense code received with a flag indicating the Info field is valid.

18

the DEVICE reports a medium or hardware error (or a blank check) with a flag indicating the Info field is valid. This is often a LBA (of the first encountered error) but its meaning is command specific.

20

the device reports it has a check condition but "no sense". Some polling commands (e.g. REQUEST SENSE) can react this way. It is unlikely that this value will occur as an exit status

21

the device reports a "recovered error". The requested command was successful. Most likely a utility will report a recovered error to stderr and continue, probably leaving the utility with an exit status of 0

22

LBA out-of-range

24

the device reports a SCSI status of "reservation conflict". This implies that some other initiator holds a reservation on this device; that reservation may block writes or almost all access to that device via the current initiator

25

the device reports a SCSI status of "condition met". Currently only the PRE-FETCH command (see SBC-4) yields this status.

26

the device reports a SCSI status of "busy". SAM-5 defines this status as the logical unit is temporarily unable to process a command.  It is recommended to re-issue the command.

27

the device reports a SCSI status of "task set full".

28

the device reports a SCSI status of "ACA active". ACA is "auto contingent allegiance" and is seldom used.

29

the device reports a SCSI status of "task aborted". SAM-5 says: "This status shall be returned if a command is aborted by a command or task management  function on another I_T nexus and the Control mode page TAS bit is set to one".

31

error involving two or more command line options, or a missing second option that is needed. Often two or more options contradict one another. These tend to be more complicated than "syntax error" (exit status 1) which typically are associated with a single command line option.

32

there is a logic error in the utility's code. This may warrant an email to the author.

33

the command sent to the device has timed out. This occurs in Linux, in other ports a command timeout will appear as a transport (or OS) error

36

no error has occurred plus the utility wants to convey a boolean value of false. The corresponding true value is conveyed by a 0 exit status.

40

the command sent to device has received an "aborted command" sense key with an additional sense code of 0x10. This is related to problems  with  protection information (PI or DIF). Examples include reading unmapped blocks or blocks that have never been written to (since the last format)

41

similar to error code 40 plus a flag indicating the Info field is valid.

48

An NVMe command terminated with a non-zero status (status = ((SCT << 8) | SC) )

49

Low Level Driver (LLD) reports a residual count that is too high. This means that not enough data has been returned from the device (i.e. the "data-in" buffer) to continue.

50

A Unix error ("errno") has occurred and its value is too large (> 46) to fit in the alotted range which is 51 to 96. Since errno=0 means there is no error, this value (50) is used to map all "too large" errno_s to.

51-96

This is a Unix "errno" value plus 50. Unix errno values are relatively small positive integers. Errno values 1 through 46 are mapped to 51 to 96. All larger errno values are mapped to 50.

97

the response to a SCSI command failed sanity checks

98

the device reports it has a check condition but the error doesn't fit into any of the above categories

99

any errors that can't be categorized into values 1 to 98 may yield this value. This includes transport and operating system errors

100-125

used by the ddpt utility, mainly for specialized offloaded copy errors.

126

utility found but could not be executed. Possibly a permissions problem or executable is for a different architecture

127

utility not found

128+
<signum>

utility was interrupted by signal <signum>

255

utility tried to yield an exit status of 255 or higher



Many of the above exit status values will be repeatable so executing the utility again with one or more '-v' options may yield more information. Unit attentions (exit status 6) are only reported once per condition. Notice that some of the lower exit status values (e.g. 2 to 11) correspond to the SCSI sense key values. Exit status 14 (miscompare) was added in version 1.37 while 7, 10, 24 and 40 were added in version 1.39 . Exit status values 0 plus 126 and above are conventions for all Unix executables and scripts (i.e. they are not sg3_utils specific). For examples of bash scripts that use these exit values see the script files in the scripts sub-directory.

Changing mode page settings

SCSI devices store settings (meta-data) that may possibly be changed by the user program (called the "application client" in SCSI jargon) in mode pages. It is a common requirement to find mode page settings and in some cases change them. An example is the Writeback Cache Enable (WCE) bit in the Caching mode page of SCSI disks. Usually the manufacturer's default setting for WCE is set (on) however in some RAID configurations it may be cleared (off).

Generic command line tools to change mode page settings tend to be difficult to use (which in some small part is due to the SCSI rules for manipulating mode pages). Here is a list of some Linux utilities for changing mode pages:

The author's recommendation is to use sdparm unless the features of another utility better suit your needs.

Aside: device meta-data that cannot be changed by the user is often placed in Vital Product Data (VPD) pages. The VPD pages can be accessed via the SCSI INQUIRY command. The sg_vpd utility in this package and sdparm utility list the contents of various VPD pages.

Examples

Most of these examples use Linux device names. See the device naming page for appropriate device names in other supported operating systems.

Apart from the examples below, many of the utilities in this package have an EXAMPLES section in their manpages. Also several utilities have their own web page on this site (e.g. the sg_ses and sg_dd pages).

The fundamental SCSI command whose support is mandatory for all SCSI devices is INQUIRY. All devices should respond to a "standard" (i.e. when no Vital Product Pages are requested) INQUIRY.

$ sg_inq /dev/sda
standard INQUIRY:
  PQual=0  Device_type=0  RMB=0  LU_CONG=0  version=0x06  [SPC-4]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=1  Resp_data_format=2
  SCCS=0  ACC=0  TPGS=0  3PC=0  Protect=1  [BQue=0]
  EncServ=0  MultiP=1 (VS=0)  [MChngr=0]  [ACKREQQ=0]  Addr16=0
  [RelAdr=0]  WBus16=0  Sync=0  [Linked=0]  [TranDis=0]  CmdQue=1
  [SPI: Clocking=0x0  QAS=0  IUS=0]
    length=144 (0x90)   Peripheral device type: disk
 Vendor identification: SEAGATE
 Product identification: ST200FM0073    
 Product revision level: CB02
 Unit serial number: xxxxxxx


Some SCSI devices have version descriptor information showing which standards (and drafts) they support:

$ 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

Many modern SCSI devices also support "Vital Product Data" (VPD) pages. Here is a request to list available VPD pages:

$ 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

For displaying VPD pages, sg_vpd (or sdparm) may be a better choice than sg_inq as sg_vpd has a simpler, less cluttered command line interface and additional support for vendor specific VPD pages.

# sg_vpd /dev/sdh
Supported VPD pages VPD page:
  Supported VPD pages [sv]
  Unit serial number [sn]
  Implemented operating definition (obs) [iod]
  Device identification [di]

The following displays a subset of the device identification VPD page, namely the designators for the target port:

# sg_vpd --page=di_port /dev/sdh
Device Identification VPD page:
  Target port:
    designator type: Relative target port,  code_set: Binary
     transport: Serial Attached SCSI (SAS)
      Relative target port: 0x1
    designator type: NAA,  code_set: Binary
     transport: Serial Attached SCSI (SAS)
      0x5222222000000f9e

The sg_scan and sg_map utilities show the relationships between Linux sg devices, their <bus, channel, target, lun> tuples and their primary device node names:

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

In the lk 2.6 series of kernels sg_scan and sg_map are less important as most utilities in the sg3_utils package can be issued directly against the primary device node (e.g. /dev/sda).  However the sg driver is still needed to "talk" to devices such as enclosures which have no specialized driver in Linux. Instead of using sg_map, in lk 2.6 and later the lsscsi utility is recommended.

Some examples of the use of the sg_persist utility can be found in the source tarball in examples/sg_persist_tst.sh . Some more information about that utility can be found in examples/transport_ids.txt .

The Windows port has its own sg_scan utility which attempts to list the common storage devices, one per line. On recent Windows operating systems sg_scan needs to be run in a shell with Administrator privileges. Volume names corresponding to a storage device (or a partition on that device) are shown in brackets. Here are two examples, the second one adds a bus type field:

$ sg_scan
PD0     [C]     FUJITSU   MHY2160BH         0000
PD1     [DF]    WD        2500BEV External  1.05  WD-WXE90
CDROM0  [E]     MATSHITA DVD/CDRW UJDA775  CB03

$ sg_scan -b
PD0     [C]     <Ata  >  FUJITSU   MHY2160BH         0000
PD1     [DF]    <Usb  >  WD        2500BEV External  1.05  WD-WXE90
CDROM0  [E]     <Atapi>  MATSHITA DVD/CDRW UJDA775  CB03

The PD0 device name is a shortened form of PhysicalDrive0 and corresponds to volume C: . The USB connected PD1 contains two partitions recognized by Windows and they are D: and F: . Apart from the storage device names PD<n> and CDROM<n>, there is TAPE<n> for tape drives.

libsgutils

The various utilities in this package were found to have a lot of common code (e.g. use of the SCSI INQUIRY command and SCSI error processing). So a library called libsgutils has been created. Following Unix conventions the library is packaged in two parts: the main part is needed at runtime by the utilities in this package; and a second "dev" package is required for any code that wants to compile and built using this library. The "dev" package contains the header files defining the libraries API amongst other things.

The library API is relatively stable but is expanded and sometimes changed in response to changes by www.t10.org . The most recent Debian naming of this library was libsgutils2-2 . Some other packages depend on this library.

Shared and static libraries are built by default. To build these utilities so they don't depend on this shared library use './configure --disable-shared'.

NVME Support

On one hand NVM Express (usually written as "NVMe") doesn't have much in common with SCSI. They have different command sets and don't share many transports. The SOP/PQI project which uses the SCSI command set over PCIe (PCI Express) has not caught on, probably closely related to NVMe's success on PCIe.

On the other hand both SCSI and NVMe offer alternative approaches to accessing solid state disks (SSDs), approaches that have much in common. SCSI has been around a little longer (1981 compared to 2011) . In the early days of NVMe there was a SCSI to NVMe Translation Layer (SNTL) but that was dropped in 2017 from the Linux kernel as Intel were not prepared to support it any longer. Strange, since the equivalent mechanism for (mainly) SATA disks called SCSI to ATA Translation (SAT) has been quite successful both for SATA and the SAS (SCSI serial protocol).

There are some signs of the two protocols co-existing with the NVME-MI (Management Interface) group accepting the SES-3 standard for (storage) enclosure management. To this end two NVME-MI commands have been added: SES Send and SES Receive. The library underpinning sg3_utils has been extended to detect NVMe devices in Linux and FreeBSD (not yet working for Windows) has been extended and to pass-through SCSI SEND DIAGNOSTIC and RECEIVE DIAGNOSTIC RESULTS commands to those new NVME-MI commands. The sg3_utils library implements a small SNTL that emulates the mandatory SPC commands (e.g. INQUIRY and REPORT LUNS) and a few others so that the sg_ses utility can interact with a NVMe enclosure with almost no code changes to sg_ses itself. sg_inq has been modified to detect NVMe devices and partially decode the Identify Controller and Identify namespace responses. The lsscsi utility (see the lsscsi package) now lists NVMe namespaces (after SCSI logical units) and NVMe controllers (after SCSI hosts (HBAs)).

The sg_senddiag utility applied to a NVMe device will attempt to tunnel the associated data in NVME-MI SES Send and SES Recieve commands. That should fail unless the NVMe controller has an enclosure attached. The sg_raw command can issue NVME Admin command. The sg_inq command has two modes when applied to a NVME (namespace or controller); without options it will send Identify controller and namespace (assuming there is one) and partially decode the response; with the "--page=sinq" option ("sinq" means standard Inquiry, so for SCSI devices that is the same as the default (no option) usage) will issue a SCSI INQUIRY which the above mentioned SNTL will emulate an INQUIRY response.

Since there is no standard SNTL, this package has taken the liberty of defining its own "vendor specific" VPD page: 0xde . When fetched (with sg_inq, sg_vpd or sdparm) on a NVMe device it will yield the Identify controller response which is 4096 bytes long.

Download and build

Several recent versions of the sg3_utils package are listed below. The tarballs contain README, CHANGELOG (renamed "ChangeLog" in version 1.25), INSTALL, COVERAGE and CREDITS files plus man pages as well as source and build files.  Here is the most recently released sg3_utils ChangeLog .

Table 5. sg3_utils tarballs and packages

1.20
20060418

sg3_utils-1.20.tgz

sg3_utils-1.20-1.src.rpm

sg3_utils-1.20-1.i386.rpm
libsgutils-1_0-1.20-1.i386.rpm

sg3-utils_1.20-0.1_i386.deb
libsgutils1-0_1.20-0.1_i386.deb

1.21
20060706

sg3_utils-1.21.tgz

sg3_utils-1.21-1.src.rpm

sg3_utils-1.21-1.i386.rpm
libsgutils-1_0-1.21-1.i386.rpm

sg3-utils_1.21-0.1_i386.deb
libsgutils1-0_1.21-0.1_i386.deb

1.22
20061016

sg3_utils-1.22.tgz

sg3_utils-1.22-1.src.rpm

sg3_utils-1.22-1.i386.rpm
libsgutils-1_0-1.22-1.i386.rpm

sg3-utils_1.22-0.1_i386.deb
libsgutils1-0_1.22-0.1_i386.deb

1.23
20070131

sg3_utils-1.23.tgz
sg3_utils-1.23exe.zip

sg3_utils-1.23-1.src.rpm

sg3_utils-1.23-1.i386.rpm
sg3_utils-libs-1.23-1.i386.rpm

sg3-utils_1.23-0.1_i386.deb
libsgutils1_1.23-0.1_i386.deb

1.24
20070507

sg3_utils-1.24.tgz
sg3_utils-1.24exe.zip

sg3_utils-1.24-1.src.rpm

sg3_utils-1.24-1.i386.rpm
sg3_utils-libs-1.24-1.i386.rpm

sg3-utils_1.24-0.1_i386.deb
libsgutils1_1.24-0.1_i386.deb

1.25
20071016

sg3_utils-1.25.tgz
sg3_utils-1.25exe.zip

sg3_utils-1.25-1.src.rpm

sg3_utils-1.25-1.i386.rpm
sg3_utils-libs-1.25-1.i386.rpm

sg3-utils_1.25-0.1_i386.deb
libsgutils1_1.25-0.1_i386.deb

1.26
20080625

sg3_utils-1.26.tgz
sg3_utils-1.26exe.zip

sg3_utils-1.26-1.src.rpm

sg3_utils-1.26-1.i386.rpm
sg3_utils-libs-1.26-1.i386.rpm

sg3-utils_1.26-0.1_i386.deb
libsgutils2_1.26-0.1_i386.deb

1.27
20090406

sg3_utils-1.27.tgz
sg3_utils-1.27exe.zip

sg3_utils-1.27-1.src.rpm

sg3_utils-1.27-1.i386.rpm
sg3_utils-libs-1.27-1.i386.rpm

sg3-utils_1.27-0.1_i386.deb
libsgutils2_1.27-0.1_i386.deb

1.28
20091002

sg3_utils-1.28.tgz
sg3_utils-1.28exe.zip

sg3_utils-1.28-1.src.rpm

sg3_utils-1.28-1.i386.rpm
sg3_utils-libs-1.28-1.i386.rpm

sg3-utils_1.28-0.1_i386.deb
libsgutils2-2_1.28-0.1_i386.deb

1.29
20100406

sg3_utils-1.29.tgz
sg3_utils-1.29exe.zip

sg3_utils-1.29-1.src.rpm

sg3_utils-1.29-1.i386.rpm
sg3_utils-libs-1.29-1.i386.rpm

sg3-utils_1.29-0.1_i386.deb
libsgutils2-2_1.29-0.1_i386.deb

1.30
20101111

sg3_utils-1.30.tgz
sg3_utils-1.30exe.zip

sg3_utils-1.30-1.src.rpm

sg3_utils-1.30-1.i386.rpm
sg3_utils-libs-1.30-1.i386.rpm

sg3-utils_1.30-0.1_i386.deb
libsgutils2-2_1.30-0.1_i386.deb

1.31
20110216

sg3_utils-1.31.tgz
sg3_utils-1.31exe.zip

sg3_utils-1.31-1.src.rpm

sg3_utils-1.31-1.i386.rpm
sg3_utils-libs-1.31-1.i386.rpm

sg3-utils_1.31-0.1_i386.deb
libsgutils2-2_1.31-0.1_i386.deb

1.32
20110803

sg3_utils-1.32.tgz
sg3_utils-1.32exe.zip

sg3_utils-1.32-1.src.rpm

sg3_utils-1.32-1.i386.rpm
sg3_utils-libs-1.32-1.i386.rpm

sg3-utils_1.32-0.1_i386.deb
libsgutils2-2_1.32-0.1_i386.deb

1.33
20120118

sg3_utils-1.33.tgz
sg3_utils-1.33exe.zip

sg3_utils-1.33-1.src.rpm

sg3_utils-1.33-1.i386.rpm
sg3_utils-libs-1.33-1.i386.rpm

sg3-utils_1.33-0.1_i386.deb
libsgutils2-2_1.33-0.1_i386.deb

1.34
20121013

sg3_utils-1.34.tgz
sg3_utils-1.34exe.zip

sg3_utils-1.34-1.src.rpm

sg3_utils-1.34-1.i386.rpm
sg3_utils-libs-1.34-1.i386.rpm

sg3-utils_1.34-0.1_i386.deb
libsgutils2-2_1.34-0.1_i386.deb

1.35
20130114

sg3_utils-1.35.tgz

sg3_utils-1.35-1.src.rpm

sg3_utils-1.35-1.i386.rpm
sg3_utils-libs-1.35-1.i386.rpm
sg3_utils-1.35-1.x86_64.rpm
sg3_utils-libs-1.35-1.x86_64.rpm

sg3-utils_1.35-0.1_i386.deb
libsgutils2-2_1.35-0.1_i386.deb
sg3-utils_1.35-0.1_amd64.deb
libsgutils2-2_1.35-0.1_amd64.deb

1.36
20130602

sg3_utils-1.36.tgz
sg3_utils-1.36.tar.xz

sg3_utils-1.36-1.src.rpm

sg3_utils-1.36-1.i386.rpm
sg3_utils-libs-1.36-1.i386.rpm
sg3_utils-1.36-1.x86_64.rpm
sg3_utils-libs-1.36-1.x86_64.rpm

sg3-utils_1.36-0.1_i386.deb
libsgutils2-2_1.36-0.1_i386.deb
sg3-utils_1.36-0.1_amd64.deb
libsgutils2-2_1.36-0.1_amd64.deb

1.37
20131015

sg3_utils-1.37.tgz
sg3_utils-1.37.tar.xz

sg3_utils-1.37-1.src.rpm

sg3_utils-1.37-1.i386.rpm
sg3_utils-libs-1.37-1.i386.rpm
sg3_utils-1.37-1.x86_64.rpm
sg3_utils-libs-1.37-1.x86_64.rpm

sg3-utils_1.37-0.1_i386.deb
libsgutils2-2_1.37-0.1_i386.deb
sg3-utils_1.37-0.1_amd64.deb
libsgutils2-2_1.37-0.1_amd64.deb

1.38
20140402

sg3_utils-1.38.tgz
sg3_utils-1.38.tar.xz

sg3_utils-1.38-1.src.rpm

sg3_utils-1.38-1.i386.rpm
sg3_utils-libs-1.38-1.i386.rpm
sg3_utils-1.38-1.x86_64.rpm
sg3_utils-libs-1.38-1.x86_64.rpm

sg3-utils_1.38-0.1_i386.deb
libsgutils2-2_1.38-0.1_i386.deb
sg3-utils_1.38-0.1_amd64.deb
libsgutils2-2_1.38-0.1_amd64.deb

1.39
20140612

sg3_utils-1.39.tgz
sg3_utils-1.39.tar.xz

sg3_utils-1.39-1.src.rpm



sg3_utils-1.39-1.i386.rpm
sg3_utils-libs-1.39-1.i386.rpm
sg3_utils-1.39-1.x86_64.rpm
sg3_utils-libs-1.39-1.x86_64.rpm

sg3-utils_1.39-0.1_i386.deb
libsgutils2-2_1.39-0.1_i386.deb
sg3-utils_1.39-0.1_amd64.deb
libsgutils2-2_1.39-0.1_amd64.deb

1.40
20141113

sg3_utils-1.40.tgz
sg3_utils-1.40.tar.xz

sg3_utils-1.40-1.src.rpm

sg3_utils-1.40-1.i386.rpm
sg3_utils-libs-1.40-1.i386.rpm
sg3_utils-1.40-1.x86_64.rpm
sg3_utils-libs-1.40-1.x86_64.rpm

sg3-utils_1.40-0.1_i386.deb
libsgutils2-2_1.40-0.1_i386.deb
sg3-utils_1.40-0.1_amd64.deb
libsgutils2-2_1.40-0.1_amd64.deb

1.41
20150707

sg3_utils-1.41.tgz
sg3_utils-1.41.tar.xz

sg3_utils-1.41-1.src.rpm

sg3_utils-1.41-1.i386.rpm
sg3_utils-libs-1.41-1.i386.rpm
sg3_utils-1.41-1.x86_64.rpm
sg3_utils-libs-1.41-1.x86_64.rpm

sg3-utils_1.41-0.1_i386.deb
libsgutils2-2_1.41-0.1_i386.deb
sg3-utils_1.41-0.1_amd64.deb
libsgutils2-2_1.41-0.1_amd64.deb

1.42
20160217

sg3_utils-1.42.tgz
sg3_utils-1.42.tar.xz

sg3_utils-1.42-1.src.rpm

sg3_utils-1.42-1.i386.rpm
sg3_utils-libs-1.42-1.i386.rpm
sg3_utils-1.42-1.x86_64.rpm
sg3_utils-libs-1.42-1.x86_64.rpm

sg3-utils_1.42-0.1_i386.deb
libsgutils2-2_1.42-0.1_i386.deb
sg3-utils_1.42-0.1_amd64.deb
libsgutils2-2_1.42-0.1_amd64.deb

1.43

20180911

sg3_utils-1.43.tgz

sg3_utils-1.43.tar.xz

sg3_utils-1.43-1.src.rpm



sg3_utils-1.43-1.x86_64.rpm
sg3_utils-libs-1.43-1.x86_64.rpm

sg3-utils_1.43-0.1_i386.deb
libsgutils2-2_1.43-0.1_i386.deb
sg3-utils_1.43-0.1_amd64.deb
libsgutils2-2_1.43-0.1_amd64.deb

1.44

20180912

sg3_utils-1.44.tgz

sg3_utils-1.44.tar.xz

sg3_utils-1.44-1.src.rpm

sg3_utils-1.44-1.x86_64.rpm
sg3_utils-libs-1.44-1.x86_64.rpm

sg3-utils_1.44-0.1_i386.deb
libsgutils2-2_1.44-0.1_i386.deb
sg3-utils_1.44-0.1_amd64.deb
libsgutils2-2_1.44-0.1_amd64.deb


The sg3_utils-1.44mgw32.zip file is a zip archive of Windows 32 bit executables made in a MinGW environment. The sg3_utils-1.44mgw64.zip file is a zip archive of Windows 64 bit executables made with MinGW tools. The sg3_utils_man_html.tgz file is a tarball of man pages converted to html by man2html.

Version 1.25 of sg3_utils adds an autotools based './configure ; make ; make install' build system. This replaced the previously hand-crafted Makefiles that were getting a bit hard to maintain, especially in ported (i.e. non-Linux) environments. The configure.ac and several Makefile.am files guide the autotools build. If these files are changed then the './autogen.sh' script should be run. The autotools based logic builds the code found in the src, lib, include and doc sub-directories. The utils and examples sub-directories still have hand-crafted Makefiles. If the ./configure or  make steps fail then it may be worth trying to run the './autogen.sh' script as there are many versions of autotools and the mysterious libtool to be found. Many options can be given to ./configure  and ./configure --help  will list many of those options. By default  './configure ' will produce Makefiles that install under the /usr/local directory (e.g. executables are placed in the /usr/local/bin directory). To place executables in the more usual (at least for Linux) /usr/bin directory then use './configure --prefix=/usr ; make ; make install'.

* tarball also available with a ".tar.gz" extension and bzipped with a ".tar.bz2" extension. From version 1.31 the tarball is available with a ".xz" extension as well.

** Around the time of Fedora 11, RedHat changed their package checksums from MD5 to SHA256. The above rpm packages are typically built with the most recent Fedora at time of release. It has been reported that adding "--nomd5" to the rpm command line may help with unpacking problems. See bug 490613 at RedHat's bugzilla.

*** Some browsers (e.g. firefox) may interpret a file with an extension of "rpm" as an audio file. In which case press the right button over the link and select "Save link as ..." to download the file.


Below is the most recent version of the sg_utils package which targets the Linux kernel 2.2 series with some support for the lk 2.0 series. No further work is being done on this package.

Table 6.  sg_utils tarballs and packages

sg_utils
version

  tarballs 

rpm source rpms **

i386 rpm binaries **

1.02

sg_utils-1.02.tgz

sg_utils-1.02-1.src.rpm

sg_utils-1.02-1.i386.rpm



Git mirrors

The sg3_utils package is developed by the author using subversion. Subversion revisions, which are ascending integers, can be seen in the ChangeLog file. Many users have asked for git access and two contributors have set up git mirrors on github:

Updates are sent to those mirrors whenever a beta is placed on the main page, perhaps more often than that. Please report any problems to me.

Return to main page.

Last updated: 12th September 2018