1SG_SCAN(8) SG3_UTILS SG_SCAN(8)
2
3
4
6 sg_scan - scans sg devices (or SCSI/ATAPI/ATA devices) and prints
7 results
8
10 sg_scan [-a] [-i] [-n] [-w] [-x] [DEVICE]*
11
13 If no DEVICE names are given, sg_scan does a scan of the sg devices and
14 outputs a line of information for each sg device that is currently
15 bound to a SCSI device. If one or more DEVICEs are given only those
16 devices are scanned. Each device is opened with the O_NONBLOCK flag so
17 that the scan will not "hang" on any device that another process holds
18 an O_EXCL lock on.
19
20 Any given DEVICE name is expected to comply with (to some extent) the
21 Storage Architecture Model (SAM see www.t10.org). Any device names
22 associated with the Linux SCSI subsystem (e.g. /dev/sda and /dev/st0m)
23 are suitable. Devices names associated with ATAPI devices (e.g. most
24 CD/DVD drives and ATAPI tape drives) are also suitable. If the device
25 does not fall into the above categories then an ATA IDENTIFY command is
26 tried.
27
28 In Linux 2.6 and 3 series kernels, the lsscsi utility may be helpful.
29 Apart from providing more information (by data-mining in the sysfs
30 pseudo file system), it does not need root permissions to execute, as
31 this utility would typically need.
32
34 -a do alphabetical scan (i.e. sga, sgb, sgc). Note that sg device
35 nodes with an alphabetical index have been deprecated since the
36 Linux kernel 2.2 series.
37
38 -i do a SCSI INQUIRY, output results in a second (indented) line.
39 If the device is an ATA disk then output information from an ATA
40 IDENTIFY command
41
42 -n do numeric scan (i.e. sg0, sg1...) [default]
43
44 -w use a read/write flag when opening sg device (default is
45 read-only)
46
47 -x extra information output about queuing
48
50 This utility was written at a time when hotplugging of SCSI devices was
51 not supported in Linux. It used a simple algorithm to scan sg device
52 nodes in ascending numeric or alphabetical order, stopping after there
53 were 4 consecutive errors.
54
55 In the Linux kernel 2.6 series, this utility uses sysfs to find which
56 sg device nodes are active and only checks those. Hence there can be
57 large "holes" in the numbering of sg device nodes (e.g. after an
58 adapter has been removed) and still all active sg device nodes will be
59 listed. This utility assumes that sg device nodes are named using the
60 normal conventions and searches from /dev/sg0 to /dev/sg4095 inclusive.
61
63 The exit status of sg_scan is 0 when it is successful. Otherwise see
64 the sg3_utils(8) man page.
65
67 Written by D. Gilbert and F. Jansen
68
70 Copyright © 1999-2013 Douglas Gilbert
71 This software is distributed under the GPL version 2. There is NO war‐
72 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
73 POSE.
74
76 lsscsi(8)
77
78
79
80sg3_utils-1.36 May 2013 SG_SCAN(8)