All times are UTC - 5 hours [ DST ]


Forum rules


Please do not post questions about data recovery cases here (use this forum instead). This forum is for topics on finding new ways to recover data. Accessing firmware, writing programs, reading bits off the platter, recovering data from dust...



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Help Help Help! How to read serial number of SCSI hard disk?
PostPosted: November 24th, 2011, 21:57 
Offline

Joined: November 24th, 2011, 21:46
Posts: 1
Location: Shanghai, China
Hello,

I want to find a source code can read the serial number of SCSI hard disk.
I have the source code to read it on IDE (SATA) disk, but not work for SCSI.

I have searched many many places, and finally I got this magic site.
I saw there are many software here, many of them can read serial number, and SCSI supported.

Could you any one give me some instractions or kindly give me some source code to let me continue to next step?


Thank you very much!


Top
 Profile  
 
 Post subject: Re: Help Help Help! How to read serial number of SCSI hard d
PostPosted: November 25th, 2011, 15:08 
Offline

Joined: May 6th, 2008, 22:53
Posts: 2138
Location: England
This sounds like a nice "homework" question :)

You didn't say which OS you are trying to use - the API to send raw SCSI commands varies significantly between OS, but a few minutes with Google will allow you to find examples for many of the common OS versions. For Linux you can look at the sg3_utils package (e.g. the source to sg_inq).

FYI some SCSI disks include a serial number in the "vendor unique" area of a standard Inquiry response. Others include it only in the response to Inquiry VPD page 0x80.


Top
 Profile  
 
 Post subject: Re: Help Help Help! How to read serial number of SCSI hard d
PostPosted: November 25th, 2011, 15:17 
Offline
User avatar

Joined: September 29th, 2005, 12:02
Posts: 3564
Location: Chicago
Code:
function SCSI_Inquery (hFile : THandle;var InqBuff : array of byte): Results;
var
CDBCmd : array [0..5] of byte;
Size : ulong;
SenseBuff : array [0..31] of byte;
begin
    CdbCmd[0] := $12; //   OperationCode := SCSIOP_INQUIRY;
    CdbCmd[1] := $00; //   Flags := CDB_INQUIRY_EVPD=0;  Vital product data
    CdbCmd[2] := $00; //   Total
    CdbCmd[3] := $00;
    CdbCmd[4] := 96; // AllocationLength
    CdbCmd[5] := $00;
     Size := 96;


    Result :=SCSI_IN_Command(hFile,CdbCmd,6,InqBuff,Size, SenseBuff, 3);
end;


////////////////
SetString( S, PAnsiChar(@InqBuff[8])+28, 9 );
  Trim(s);
  fSerial :=s;

_________________
SAN, NAS, RAID, Server, and HDD Data Recovery.


Top
 Profile  
 
 Post subject: Re: Help Help Help! How to read serial number of SCSI hard d
PostPosted: November 26th, 2011, 18:51 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 15538
Location: Australia
Two more open source references:
http://linux.die.net/man/8/sdparm
http://smartmontools.sourceforge.net/sm ... _scsi.html

_________________
A backup a day keeps DR away.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 40 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group