scsi_id Command Examples in Linux

scsi_id is the command used for finding out the WWN numbers for the external LUNS attached to the host via a FC cable and can’t be used for finding out UUID of devices. scsi_id is primarily for use by other utilities such as udev that require a unique SCSI identifier. 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 behavior.

Output from blkid command shows the UUID of devices as shown below.

/dev/sdbh: UUID="r1PHiD-EMu0-oMBa-zzX7-1MT5-YK7R-hJrsjJ" TYPE="LVM2_member" 
/dev/sdbi: UUID="cNTqqN-JRW7-sEWz-fEmw-yWeu-fMEe-0It4ey" TYPE="LVM2_member" 
/dev/mapper/testdevice: UUID="0h3qmS-y1Gk-pEZE-KbfN-gZ7u-Da8O-FkUHJS" TYPE="LVM2_member" 
/dev/mapper/9af08d4e--f055--4200--ad79--d66185ed32fb-master: UUID="1abc78f9-a153-4d9d-b0c4-c8f274bad46a" TYPE="ext3" 

Output of the scsi_id command will give the WWN number of the External storage attached to the server as shown below.

# scsi_id --whitelisted --device=/dev/sda
3600508e000000000d6580ba0eaf2e107

scsi_id Command Examples

1. To retrieve and generate a unique SCSI identifier:

# scsi_id 

2. To Send SG_IO commands to device:

# scsi_id --device=device /dev/sdc 

4. To treat the device as black listed, and do nothing unless a white listed device is found:

# scsi_id --blacklisted 

5. To read configuration and black/white list entries from config-file:

# scsi_id --config=config-file 

6. To treat the device as white listed:

# scsi_id --whitelisted 

7. To use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83:

# scsi_id --page=0x80|0x83|pre-spc3-83 

8. To reformat the output:

# scsi_id --replace-whitespace 

9. To export all data in KEY= format used to import in other programs:

# scsi_id --export 

10. To generate verbose debugging output:

# scsi_id --verbose 

11. To display the version:

# scsi_id --version 
Related Post