Tuesday, June 3, 2014

Sometimes we want to query about our devices present in our computer. e.g. Hard Disks , DVD drives etc.These devices comes into the family of SCSI (Small Computer Systems Interface) devices.So we can use some of the SCSI commands to query the status of the SCSI devices.I use linux system to demonstrate this.First installation of sg3-utils package is required.You can get more information on sg3-utils package by clicking on below link:http://sg.danny.cz/sg/sg3_utils.htmlSo first step is to install sg3-utils package using command: sudo apt-get install sg3-utilsE.g. a-saurabh@a-saurabh:~$ sudo apt-get install sg3-utilsNow once the package is installed , we get access to numerous and helpful utilities which makes possible to send SCSI commands from terminal to SCSI devices.Suppose I want to see serial number of my hard disk, I can issue the below command.a-saurabh@a-saurabh:~$ sudo sg_inq -p 0x80 /dev/sdaVPD INQUIRY: Unit serial number page Unit serial number: WD-WMC2E7086390

Here we query about the supported inquiry pages by the device.We use -p option in the sg_inq command for specifying the page which is being queried,Likewise we can request information for more inquiry pages from SCSI devices.