Linux‎ > ‎

scsi_id examples in RHEL6

Thank you for visiting this page, this page has been update in another link scsi_id examples on Linux
scsi_id is a tool to retrieve and generate a unique SCSI identifier, not very necessarily to metion here, but for it's being widly used lots of system admin tools, primarily used by udev. Also, the usage has been changed on RHEL6/SL6, so I put few examples here for sharing.

Marjor changes on RHEL6 are that by  default all devices are assumed black listed, the --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.

# scsi_id -h
Usage: scsi_id OPTIONS <device>
  --device=                     device node for SG_IO commands
  --config=                     location of config file
  --page=0x80|0x83|pre-spc3-83  SCSI page (0x80, 0x83, pre-spc3-83)
  --sg-version=3|4              use SGv3 or SGv4
  --blacklisted                 threat device as blacklisted
  --whitelisted                 threat device as whitelisted
  --replace-whitespace          replace all whitespaces by underscores
  --verbose                     verbose logging
  --version                     print version
  --export                      print values as environment keys
  --help                        print this help text
# scsi_id --version
147

To get Vendor, module and SN of device

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

To get WWNA

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

Detail description about 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

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



Comments