chiark / gitweb /
591bb79366a03bad8769fcdf45b84800cf66175a
[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 When called with only a single argument without a leading \-, runs in a hotplug
57 mode, and expects the environment variable DEVPATH to specify the
58 corresponding sysfs device. See section below on usage with \fBudev\fP.
59 .TP
60 .BI \-b
61 The default behaviour \- treat the device as black listed, and do nothing
62 unless a white listed device is found in the scsi_id config\-file.
63 .TP
64 .BI \-d "\| device\^"
65 Instead
66 of determining and creating a device node based on a sysfs dev
67 entry as done for the \fB\-s\fP, send SG_IO commands to 
68 \fBdevice\fP, such as \fB/dev/sdc\fP.
69 .TP
70 .BI \-f "\| config\-file"
71 Read configuration and black/white list entries from
72 .B config\-file 
73 rather than the default
74 .B /etc/scsi_id.config
75 file.
76 .TP
77 .BI \-g
78 Treat the device as white listed. The \fB\-g\fP option must be specified
79 on the command line or in the scsi_id configuration file for 
80 .B scsi_id
81 to generate any output.
82 .TP
83 .BI \-i
84 Prefix the identification string with the  driver model (sysfs) bus id of
85 the SCSI device.
86 .TP
87 .BI \-p "\| 0x80 | 0x83"
88 Use SCSI INQUIRY VPD page code 0x80 or 0x83. The default behaviour is to
89 query the available VPD pages, and use page 0x83 if found, else page 0x80
90 if found, else nothing.
91 .TP
92 .BI \-s "\| sysfs\-device"
93 Generate an id for the
94 .B sysfs\-device.
95 The sysfs mount point must not be included. For example, use /block/sd,
96 not /sys/block/sd.
97 .TP
98 .BI \-u
99 Reformat the output : replace all whitespaces by underscores
100 .TP
101 .BI \-v
102 Generate verbose debugging output.
103 .TP
104 .BI \-V
105 Display version number and exit.
106 .RE
107
108 .SH USAGE WITH UDEV 
109 If \fBscsi_id\fP is invoked with one argument without a leading \-, it
110 assumes it is called for a hotplug event, and looks for the sysfs device
111 in the DEVPATH environment variable. 
112
113 This mode is used when run via the \fBudev\fP PROGRAM key. Passing any
114 arguments or options as part of the PROGRAM rule breaks this assumption,
115 and the results will likely not be as expected.
116
117 When in this mode, all errors and warnings are sent via syslog.
118
119 To determine the specific value needed in a RESULT key, use the \-s option,
120 for example:
121
122 .sp
123 .nf
124 /sbin/scsi_id -s /block/sda
125 .fi
126 .P
127
128 An example \fBudev\fP rule using \fBscsi_id\fP, that will name a block
129 device and any partitions for the device matching the \fBscsi_id\fP output
130 of 312345:
131
132 .sp
133 .nf
134 BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="312345", NAME="disk%n"
135 .fi
136 .P
137
138 .SH "FILES"
139 .nf
140 .ft B
141 .ft
142 /etc/scsi_id.config                  configuration and black/white list entries
143 .fi
144 .LP
145 .SH "SEE ALSO"
146 .BR udev (8), hotplug (8)
147 .SH AUTHORS
148 Developed by Patrick Mansfield <patmans@us.ibm.com> based on SCSI ID
149 source included in earlier linux 2.5 kernels, sg_utils source, and SCSI
150 specifications.