chiark / gitweb /
replace binary firmware helper with shell script
[elogind.git] / extras / scsi_id / scsi_id.8
1 .TH SCSI_ID 8 "December 2003" "" "Linux Administrator's Manual"
2 .SH NAME
3 scsi_id \- retrieve and generate a unique SCSI identifier
4 .SH SYNOPSIS
5 .BI scsi_id 
6 [\fIoptions\fP]
7 .SH "DESCRIPTION"
8 .B scsi_id
9 queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or
10 0x83 and uses the resulting data to generate a value that is unique across
11 all SCSI devices that properly support page 0x80 or page 0x83. 
12
13 If a result is generated it is sent to standard output, and the program
14 exits with a zero value. If no identifier is output, the program exits
15 with a non\-zero value.
16
17 \fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP
18 that require a unique SCSI identifier.
19
20 By default all devices are assume black listed, the \fB\-g\fP option must
21 be specified on the command line or in the config file for any useful
22 behaviour.
23
24 SCSI commands are sent directly to the device via the SG_IO ioctl
25 interface.
26
27 In order to generate unique values for either page 0x80 or page 0x83, the
28 serial numbers or world wide names are prefixed as follows.
29
30 Identifiers based on page 0x80 are prefixed by the character 'S', the SCSI
31 vendor, the SCSI product (model) and then the the serial number returned
32 by page 0x80. For example:
33
34 .sp
35 .nf
36 # scsi_id -p 0x80 -s /block/sdg
37 SIBM     3542           1T05078453
38 .fi
39 .P
40
41 Identifiers based on page 0x83 are prefixed by the identifier type
42 followed by the page 0x83 identifier. For example, a device with a NAA
43 (Name Address Authority) type of 3 (also in this case the page 0x83
44 identifier starts with the NAA value of 6):
45
46 .sp
47 .nf
48 # /sbin/scsi_id -p 0x83 -s /block/sdg
49 3600a0b80000b174b000000d63efc5c8c
50 .fi
51 .P
52
53 .SH OPTIONS
54 .TP
55 .BI subsystem
56 Deprecated method: when called with only a single argument without a
57 leading \-, runs in a hotplug mode, and expects the environment variable
58 DEVPATH to specify the corresponding sysfs device. See section below on
59 usage with \fBudev\fP.
60 .TP
61 .BI \-a
62 Always print information (model, vendor strings) about the device even
63 if it does not support VPD pages.
64 .TP
65 .BI \-b
66 The default behaviour \- treat the device as black listed, and do nothing
67 unless a white listed device is found in the scsi_id config\-file.
68 .TP
69 .BI \-d "\| device\^"
70 Instead
71 of determining and creating a device node based on a sysfs dev
72 entry as done for the \fB\-s\fP, send SG_IO commands to 
73 \fBdevice\fP, such as \fB/dev/sdc\fP.
74 This argument should also be used when invoked via udev to avoid problems
75 with creation of temporary files on not-yet writable directories.
76 .TP
77 .BI \-f "\| config\-file"
78 Read configuration and black/white list entries from
79 .B config\-file 
80 rather than the default
81 .B /etc/scsi_id.config
82 file.
83 .TP
84 .BI \-g
85 Treat the device as white listed. The \fB\-g\fP option must be specified
86 on the command line or in the scsi_id configuration file for 
87 .B scsi_id
88 to generate any output.
89 .TP
90 .BI \-i
91 Prefix the identification string with the  driver model (sysfs) bus id of
92 the SCSI device.
93 .TP
94 .BI \-p "\| 0x80 | 0x83 | pre-spc3-83"
95 Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83.
96 .sp
97 The default
98 behaviour is to query the availabe VPD pages, and use page 0x83 if found,
99 else page 0x80 if found, else nothing.
100 .sp
101 Page pre-spc3-83 should only be utilized for those scsi devices which
102 are not compliant with the SPC-2 or SPC-3 format for page 83.  While this
103 option is used for older model 4, 5, and 6 EMC Symmetrix devices, its
104 use with SPC-2 or SPC-3 compliant devices will fallback to the page 83
105 format supported by these devices.
106 .TP
107 .BI \-s "\| sysfs\-device"
108 Generate an id for the
109 .B sysfs\-device.
110 The sysfs mount point must not be included. For example, use /block/sd,
111 not /sys/block/sd.
112 .TP
113 .BI \-u
114 Reformat the output : replace all whitespaces by underscores.
115 .TP
116 .BI \-x
117 Export all data in KEY=<value> format used to import in other programs.
118 .TP
119 .BI \-v
120 Generate verbose debugging output.
121 .TP
122 .BI \-V
123 Display version number and exit.
124 .RE
125
126 .SH USAGE WITH UDEV 
127
128 If \fBscsi_id\fP is invoked with one argument without a leading \-, it
129 assumes it is called for a hotplug event, and looks for the sysfs device
130 in the DEVPATH environment variable. This mode is deprecated, but
131 available for backwards compatibility.
132
133 If the DEVPATH environment variable is set, scsi_id assumes it has been
134 invoked via udev (or some other hotplug program), and all errors or
135 warnings are sent using syslog.
136
137 To determine the specific value needed in a RESULT key, use the \-s option,
138 for example:
139
140 .sp
141 .nf
142 /sbin/scsi_id -s /block/sda
143 .fi
144 .P
145
146 \fBscsi_id\fP is one of the tools used in the "Linux Persistent Device Names"
147 scheme that creates persistent device links in /dev/disk. It is called with
148 the -x option which will print all values in a defined format to let udev
149 import it into its own environment for later event processing.
150 .sp
151 An example custom \fBudev\fP rule using \fBscsi_id\fP, that will name a block
152 device and any partitions for the device matching the \fBscsi_id\fP output
153 of 312345:
154
155 .sp
156 .nf
157 BUS=="scsi", PROGRAM=="/sbin/scsi_id -d %N -s %p", RESULT=="312345", NAME="disk%n"
158 .fi
159 .P
160
161 .SH "FILES"
162 .nf
163 .ft B
164 .ft
165 /etc/scsi_id.config                  configuration and black/white list entries
166 .fi
167 .LP
168 .SH "SEE ALSO"
169 .BR udev (7)
170 .SH AUTHORS
171 Developed by Patrick Mansfield <patmans@us.ibm.com> based on SCSI ID
172 source included in earlier linux 2.5 kernels, sg_utils source, and SCSI
173 specifications.