File: sg_scan.8.linux

package info (click to toggle)
sg3-utils 1.42-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,940 kB
  • ctags: 4,701
  • sloc: ansic: 74,281; sh: 14,401; cpp: 2,830; makefile: 376
file content (78 lines) | stat: -rw-r--r-- 2,955 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.TH SG_SCAN "8" "May 2013" "sg3_utils\-1.36" SG3_UTILS
.SH NAME
sg_scan \- scans sg devices (or SCSI/ATAPI/ATA devices) and prints
results
.SH SYNOPSIS
.B sg_scan
[\fI\-a\fR]
[\fI\-i\fR]
[\fI\-n\fR]
[\fI\-w\fR]
[\fI\-x\fR]
[\fIDEVICE\fR]*
.SH DESCRIPTION
.\" Add any additional description here
.PP
If no \fIDEVICE\fR names are given, sg_scan does a scan of the sg
devices and outputs a line of information for each sg device that is
currently bound to a SCSI device. If one or more \fIDEVICE\fRs 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.
.PP
Any given \fIDEVICE\fR 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.
.PP
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 permissions to execute, as this utility
would typically need.
.SH OPTIONS
.TP
\fB\-a\fR
do alphabetical scan (i.e. sga, sgb, sgc). Note that sg device nodes with
an alphabetical index have been deprecated since the Linux kernel 2.2
series.
.TP
\fB\-i\fR
do a SCSI INQUIRY, output results in a second (indented) line. If the device
is an ATA disk then output information from an ATA IDENTIFY command
.TP
\fB\-n\fR
do numeric scan (i.e. sg0, sg1...) [default]
.TP
\fB\-w\fR
use a read/write flag when opening sg device (default is read\-only)
.TP
\fB\-x\fR
extra information output about queueing
.SH 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 alphabetical order, stopping
after there were 4 consecutive errors.
.PP
In the Linux kernel 2.6 series, this utility uses sysfs to find which
sg device nodes are active 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.
.SH EXIT STATUS
The exit status of sg_scan is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
.SH AUTHORS
Written by D. Gilbert and F. Jansen
.SH COPYRIGHT
Copyright \(co 1999\-2013 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
.B lsscsi(8)