scsi_id examples on RHEL7,SL7,CentOS7, I have another scsi_id article for RHEL6/SL6/CentOS6


scsi_id is a tool to retrieve and generate a unique SCSI identifier, it's being widly used lots of system admin tools, primarily used by udev.

 

Also, the usage has been changed on RHEL7/SL7.

Marjor changes on RHEL6 are that by  default all devices are assumed black listed.

  --whitelisted option must be specified on the command line or in the config file 
for any useful behaviour, as well less options for the command.

# /lib/udev/scsi_id -h
Usage: scsi_id [OPTION...] DEVICE

SCSI device identification.

  -h --help                        Print this message
     --version                     Print version of the program

  -d --device=                     Device node for SG_IO commands
  -f --config=                     Location of config file
  -p --page=0x80|0x83|pre-spc3-83  SCSI page (0x80, 0x83, pre-spc3-83)
  -s --sg-version=3|4              Use SGv3 or SGv4
  -b --blacklisted                 Treat device as blacklisted
  -g --whitelisted                 Treat device as whitelisted
  -u --replace-whitespace          Replace all whitespace by underscores
  -v --verbose                     Verbose logging
  -x --export                      Print values as environment keys


# scsi_id --version
219

Get Vendor, module and SN of device

#/lib/udev/scsi_id --page 0x80 --whitelisted --device=/dev/sda
SLSI     Logical Volume   394949227760212329
#/lib/udev/scsi_id --page 0x80 --whitelisted --device=/dev/sdb
SIBM     1818      FAStTSV14408879     

Get device WWNA

Default is page code is 0x83, to get WWNA
#/lib/udev/scsi_id--whitelisted --device=/dev/sda
#/lib/udev/scsi_id--whitelisted --device=/dev/sdb
360080e50002d26520000067a4f7a3f

List of VPD pages

  --page=0x80|0x83|pre-spc3-83|0x80-0x83|0x83-0x80
  Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83.

  The default behaviour is to query the available VPD pages, and use page 0x83 if found,
else page 0x80 if found, else nothing.

 Page pre-spc3-83 should only be utilized for those scsi devices which are not compliant with
the SPC-2 or SPC-3 format for page 83.  While this option is used for older model 4, 5,
and 6 EMC Symmetrix devices, its use with SPC-2 or SPC-3 compliant devices will fallback to
the page 83 format supported by these devices.

0x80-0x83 is like 0x80, and exports ID_SERIAL and ID_SERIAL_80,
but also exports 0x83 in ID_SERIAL_83.
0x83-0x80 is like 0x83, and exports ID_SERIAL and ID_SERIAL_83,
but also exports 0x80 in ID_SERIAL_80.


You can also reformat the output

--replace-whitespace
    Reformat the output : replace all whitespaces by underscores

#/lib/udev/scsi_id -p 0x80 --whitelisted --device=/dev/sdb --replace-whitespace
SIBM_1818_FAStTSV14408879