getting model an serial information from SAS harddisk
platform: linux
I am writing a little program which requires to get the serial and model information out of harddisks. (SAS, FC, SATA etc)
for SATA it is very easy with an ioctl command (HDIO_GET_IDENTITY) which is defined in <linux/hdreg.h>.
However this doesnt work on SAS and FC drives. So I thought to myself they are SCSI based and thus a SCSI inquiry would work. So I write a neat little function which sends and inquiry for me and retrieves the output.
Now I get gibberish as the output from the inquiry(it doesnt 'fail' though). the drives are attached to a pci-e SAS card.
I suspect the SAS card does something odd as I have tried to use my program on a virtual machine with virtual SAS drives and that seems to work...
Also the SATA drives are hooked up to the same pci-e card (SAS offers backwards compatibility with SATA)
is there another way to get serial and model information out of a harddisk besides the ways I have done?
regards