1SG_SCAN(8) SG3_UTILS SG_SCAN(8)
2
3
4
6 sg_scan - does a scan of sg devices (or given SCSI/ATAPI/ATA devices)
7 and prints the 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
29 -a do alphabetical scan (i.e. sga, sgb, sgc). Note that sg device
30 nodes with an alphabetical index have been deprecated since the
31 linux kernel 2.2 series.
32
33 -i do a SCSI INQUIRY, output results in a second (indented) line.
34 If the device is an ATA disk then output information from an ATA
35 IDENTIFY command
36
37 -n do numeric scan (i.e. sg0, sg1...) [default]
38
39 -w use a read/write flag when opening sg device (default is
40 read-only)
41
42 -x extra information output about queuing
43
45 This utility was written at a time when hotplugging of SCSI devices was
46 not supported in Linux. It used a simple algorithm to scan sg device
47 nodes in ascending numeric or alphabetical order, stopping after there
48 were 4 consecutive errors.
49
50 In the linux kernel 2.6 series, this utility uses sysfs to find which
51 sg device nodes are active and only checks those. Hence there can be
52 large "holes" in the numbering of sg device nodes (e.g. after an
53 adapter has been removed) and still all active sg device nodes will be
54 listed. This utility assumes that sg device nodes are named using the
55 normal conventions and searches from /dev/sg0 to /dev/sg4095 inclusive.
56
58 The exit status of sg_scan is 0 when it is successful. Otherwise see
59 the sg3_utils(8) man page.
60
62 Written by D. Gilbert and F. Jansen
63
65 Copyright © 1999-2006 Douglas Gilbert
66 This software is distributed under the GPL version 2. There is NO war‐
67 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
68 POSE.
69
70
71
72sg3_utils-1.23 December 2006 SG_SCAN(8)