# phpman > man > SG_SCAN(8)

[SG_SCAN(8)](https://www.chedong.com/phpMan.php/man/SGSCAN/8/markdown)                                    SG3_UTILS                                   [SG_SCAN(8)](https://www.chedong.com/phpMan.php/man/SGSCAN/8/markdown)



## NAME
       sg_scan - scans sg devices (or SCSI/ATAPI/ATA devices) and prints results

## SYNOPSIS
       **sg**___**scan** [_-a_] [_-i_] [_-n_] [_-w_] [_-x_] [_DEVICE_]*

## DESCRIPTION
       If no _DEVICE_ names are given, sg_scan does a scan of the sg devices and outputs a line of in‐
       formation for each sg device that is currently bound to a SCSI device. If one or more _DEVICE_s
       are  given only those devices are scanned.  Each device is opened with the O_NONBLOCK flag so
       that the scan will not "hang" on any device that another process holds an O_EXCL lock on.

       Any given _DEVICE_ name is expected to comply with (to some extent)  the  Storage  Architecture
       Model (SAM see www.t10.org).  Any device names associated with the Linux SCSI subsystem (e.g.
       /dev/sda and /dev/st0m) are suitable. Devices names associated with ATAPI devices (e.g.  most
       CD/DVD drives and ATAPI tape drives) are also suitable.  If the device does not fall into the
       above categories then an ATA IDENTIFY command is tried.

       In Linux 2.6 and 3 series kernels, the lsscsi utility may be helpful.  Apart  from  providing
       more information (by data-mining in the sysfs pseudo file system), it does not need root per‐
       missions to execute, as this utility would typically need.

## OPTIONS
### -a
              ical index have been deprecated since the Linux kernel 2.2 series.

### -i
              disk then output information from an ATA IDENTIFY command

### -n

### -w

### -x

## NOTES
       This utility was written at a time when hotplugging of SCSI  devices  was  not  supported  in
       Linux.  It used a simple algorithm to scan sg device nodes in ascending numeric or alphabeti‐
       cal order, stopping after there were 4 consecutive errors.

       In the Linux kernel 2.6 series, this utility uses sysfs to find which sg device nodes are ac‐
       tive  and  only  checks those. Hence there can be large "holes" in the numbering of sg device
       nodes (e.g. after an adapter has been removed) and still all active sg device nodes  will  be
       listed.  This utility assumes that sg device nodes are named using the normal conventions and
       searches from /dev/sg0 to /dev/sg4095 inclusive.

## EXIT STATUS
       The exit status of sg_scan is 0 when it is successful. Otherwise  see  the  [sg3_utils(8)](https://www.chedong.com/phpMan.php/man/sg3utils/8/markdown)  man
       page.

## AUTHORS
       Written by D. Gilbert and F. Jansen

## COPYRIGHT
       Copyright © 1999-2013 Douglas Gilbert
       This software is distributed under the GPL version 2. There is NO warranty; not even for MER‐
       CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO
### [lsscsi(8)](https://www.chedong.com/phpMan.php/man/lsscsi/8/markdown)



sg3_utils-1.36                                May 2013                                    [SG_SCAN(8)](https://www.chedong.com/phpMan.php/man/SGSCAN/8/markdown)
