MultiDrive – free backup, clone & wipe disk utility from Atola Technology

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  [ 12 posts ] 
Author Message
 Post subject: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 23rd, 2012, 18:02 
Offline

Joined: January 23rd, 2012, 17:37
Posts: 9
Location: Texas
I'll keep this short, as it seems the answer should be available somewhere - but I'm not finding.

I've got a RAID system that came in with 4 Samsung HDDs.

Three of them have similar 14 digit serial numbers (SN), varying only in the last digit:
S26CJ1KZ118182
S26CJ1KZ118183
S26CJ1KZ118184

These are printed on the label, AND our customer has some proprietary 3rd party software that displays these same 14 digits.

Our software sent the ATA Identity command to each drive, and all three of those drives returned only 13 non-zero bytes in the 20-byte serial-number field of the ATA Identity: S26CJ1KZ11818; the last digit is missing.

There is also the ATA WWI, or "unique ID" field in the Identity, and it is truly unique for each of the three drives in question.

So, where did that last digit come from? How is it determined?
Is this unique to samsung?

Any help appreciated!


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 23rd, 2012, 18:57 
Offline

Joined: May 6th, 2008, 22:53
Posts: 2138
Location: England
With (S)ATA drives, the only standard (i.e. non vendor-specific) command that reports the drive serial number is the Identify Device command. Therefore:

a) What exactly is that proprietary software which reports the full 14 chars? Is that from the RAID array or some other s/w? Unless that utility has intimate knowledge of Samsung drives specifically, I doubt it is sending anything different than Identify Device.

b) What is the full hex output (i.e. all 512 bytes, not just the part containing the serial number) from your ATA Identify Device utility collecting the info from one of these drives?

P.S. Other approaches are possible (e.g. using other utilities to collect the ATA Identify Device data for comparison), but I'll start with those 2 quick questions. :) Don't expect an immediate reply after supplying that info, as I'm up to my neck in debugging, but I'll review it when full answers to both points have been supplied.


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 23rd, 2012, 19:08 
Offline

Joined: January 23rd, 2012, 17:37
Posts: 9
Location: Texas
I believe the customer said they were using something from ASTRA in the UK.

We're writing software on top of FreeBSD. We're sending commands straight through to the underlying ATA drives through the drivers. My reading of the driver code paths are that the data we obtain is not touched between me and the drive.

I pulled a Samsung off the shelf here, and ran. Duplicates exactly what the customer suggests.

Label SN: S0DFJ1IL222175
ATA ID SN: S0DFJ1IL22217

Code:
ATA IDENTITY:
0000: 0040 3fff c837 0010 8856 022a 003f 0000
0008: 0000 0000 3053 4644 314a 4c49 3232 3132
0016: 0037 0000 0000 0000 0003 4000 0004 4d5a
0024: 3031 2d30 0033 4153 534d 4e55 2047 4448
0032: 3631 4a30 2f4a 0050 0000 0000 0000 0000
0040: 0000 0000 0000 0000 0000 0000 0000 8010
0048: 0000 2f00 4000 0200 0200 0007 3fff 0010
0056: 003f fc10 00fb 0110 ffff 0fff 0000 0007
0064: 0003 0078 0078 0078 0078 0000 0000 0000
0072: 0000 0000 0000 001f 0706 0000 004c 0040
0080: 00fe 0021 746b 7f01 4023 7469 3e01 4023
0088: 40ff 003c 003c 0000 fffe 0000 fe80 0000
0096: 0000 0000 0000 0000 9eb0 12a1 0000 0000
0104: 0000 0000 0000 0000 5000 0f00 0bdf 0100
0112: 0000 0000 0000 0000 0000 0000 0000 0000
0120: 0000 0000 0000 0000 0000 0000 0000 0000
0128: 0021 0000 0000 0000 0000 0000 0000 0000
0136: 0000 0000 0000 0000 ffff 0400 1700 0000
0144: 0000 9a00 0300 2400 0000 0000 0000 0000
0152: 0000 0000 0000 0000 0000 0000 0000 0000
0160: 0000 0000 0000 0000 0000 0000 0000 0000
0168: 0000 0000 0000 0000 0000 0000 0000 0000
0176: 0000 0000 0000 0000 0000 0000 0000 0000
0184: 0000 0000 0000 0000 0000 0000 0000 0000
0192: 0000 0000 0000 0000 0000 0000 0000 0000
0200: 0000 0000 0000 0000 0000 0000 003f 0000
0208: 0000 0000 0000 0000 0000 0000 0000 0000
0216: 0000 0000 0000 0000 0000 0000 0000 0000
0224: 0000 0000 0000 0000 0000 0000 0000 0000
0232: 0000 0000 0000 0000 0000 0000 0000 0000
0240: 0000 0000 0000 0000 0000 0000 0000 0000
0248: 0000 0000 0000 0000 0000 0000 0000 9aa5


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 23rd, 2012, 19:33 
Offline

Joined: January 23rd, 2012, 17:37
Posts: 9
Location: Texas
And now I'm feeling silly. Just ran HDAT2, and I can see the correct SN there.
Apparent bug in FreeBSD. I'll track that down.

Thanks for the quick response, sorry for the distraction.


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 23rd, 2012, 20:10 
Offline

Joined: May 6th, 2008, 22:53
Posts: 2138
Location: England
Thanks for the info and for the follow-up - who would have guessed the problem would be there :(

Interestingly, from a quick glance the ASCII data (serial number, model name etc.) is also wrong in another way - it's not space-padded to the full size of each string, which is required per the ATA spec. I'm very surprised that any driver or OS could cause the specific issues that are seen in that Identify Device response. Personally, I find it hard to believe :)

I was initially thinking about another possible cause, not FreeBSD. It would be interesting to compare the full raw Identify Device data collected by HDAT2 (if HDAT2 shows that), with that you got via FreeBSD (above). I'm expecting several differences between those two sets of data, not just the serial number.


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 24th, 2012, 14:02 
Offline

Joined: January 23rd, 2012, 17:37
Posts: 9
Location: Texas
From HDAT2 screen dump [of a different Samsung HDD]. This doesn't show big/little endian very well for comparison with that of my earlier dump as it's byte oriented. The FreeBSD 7.4 ATA driver rearranges the serial number, model number, and revision fields so that they're (close to) C style.

This was SUPPOSE to be a pass-through command [i.e. I issued the a "generic" ATA command giving it the ATA Identify byte code] instead of through the driver [issuing a request for the ATA Identity from the driver].

ah well.

Code:
0000 ³ 40 00 FF 3F 37 C8 10 00 56 88 2A 02 3F 00 00 00   @.ÿ?7È.Vˆ*?... ³
0001 ³ 00 00 00 00 20 20 20 20 20 20 30 53 46 44 31 4A   ....      0SFD1J ³
0002 ³ 4C 49 32 32 31 32 35 37 03 00 00 40 04 00 4D 5A   LI221257..@.MZ ³
0003 ³ 30 31 2D 30 34 33 41 53 53 4D 4E 55 20 47 44 48   01-043ASSMNU GDH ³
0004 ³ 36 31 4A 30 2F 4A 20 50 20 20 20 20 20 20 20 20   61J0/J P         ³
0005 ³ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 10 80                 € ³
0006 ³ 00 00 00 2F 00 40 00 02 00 02 07 00 FF 3F 10 00   .../.@...ÿ?. ³
0007 ³ 3F 00 10 FC FB 00 10 01 FF FF FF 0F 00 00 07 00   ?.üû.ÿÿÿ... ³
0008 ³ 03 00 78 00 78 00 78 00 78 00 00 00 00 00 00 00   .x.x.x.x....... ³
0009 ³ 00 00 00 00 00 00 1F 00 06 07 00 00 4C 00 40 00   .........L.@. ³
000A ³ FE 00 21 00 6B 74 01 7F 23 40 68 74 01 3E 23 40   þ.!.kt#@ht>#@ ³
000B ³ FF 20 3C 00 3C 00 00 00 FE FF 00 00 80 FE 00 00   ÿ <.<...þÿ..€þ.. ³
000C ³ 00 00 00 00 00 00 00 00 B0 9E A1 12 00 00 00 00   ........°ž¡.... ³
000D ³ 00 00 00 00 00 00 00 00 00 50 00 0F DF 0B 00 01   .........P.ß . ³
000E ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
000F ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
0010 ³ 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   !............... ³
0011 ³ 00 00 00 00 00 00 00 00 FF FF 00 04 00 17 00 00   ........ÿÿ.... ³
0012 ³ 00 00 00 9A 00 03 00 24 00 00 00 00 00 00 00 00   ...š..$........ ³
0013 ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
0014 ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
0015 ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
0016 ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
0017 ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
0018 ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
0019 ³ 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 00 00   ............?... ³
001A ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
001B ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
001C ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
001D ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
001E ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................ ³
001F ³ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A5 BB   ..............¥» ³


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 24th, 2012, 14:26 
Offline

Joined: January 23rd, 2012, 17:37
Posts: 9
Location: Texas
And for direct comparison, the same HDD on FreeBSD:

Code:
ATA IDENTITY:
0000: 0040 3fff c837 0010 8856 022a 003f 0000
0008: 0000 0000 3053 4644 314a 4c49 3232 3132
0016: 0037 0000 0000 0000 0003 4000 0004 4d5a
0024: 3031 2d30 0033 4153 534d 4e55 2047 4448
0032: 3631 4a30 2f4a 0050 0000 0000 0000 0000
0040: 0000 0000 0000 0000 0000 0000 0000 8010
0048: 0000 2f00 4000 0200 0200 0007 3fff 0010
0056: 003f fc10 00fb 0110 ffff 0fff 0000 0007
0064: 0003 0078 0078 0078 0078 0000 0000 0000
0072: 0000 0000 0000 001f 0706 0000 004c 0040
0080: 00fe 0021 746b 7f01 4023 7469 3e01 4023
0088: 40ff 003c 003c 0000 fffe 0000 fe80 0000
0096: 0000 0000 0000 0000 9eb0 12a1 0000 0000
0104: 0000 0000 0000 0000 5000 0f00 0bdf 0100
0112: 0000 0000 0000 0000 0000 0000 0000 0000
0120: 0000 0000 0000 0000 0000 0000 0000 0000
0128: 0021 0000 0000 0000 0000 0000 0000 0000
0136: 0000 0000 0000 0000 ffff 0400 1700 0000
0144: 0000 9a00 0300 2400 0000 0000 0000 0000
0152: 0000 0000 0000 0000 0000 0000 0000 0000
0160: 0000 0000 0000 0000 0000 0000 0000 0000
0168: 0000 0000 0000 0000 0000 0000 0000 0000
0176: 0000 0000 0000 0000 0000 0000 0000 0000
0184: 0000 0000 0000 0000 0000 0000 0000 0000
0192: 0000 0000 0000 0000 0000 0000 0000 0000
0200: 0000 0000 0000 0000 0000 0000 003f 0000
0208: 0000 0000 0000 0000 0000 0000 0000 0000
0216: 0000 0000 0000 0000 0000 0000 0000 0000
0224: 0000 0000 0000 0000 0000 0000 0000 0000
0232: 0000 0000 0000 0000 0000 0000 0000 0000
0240: 0000 0000 0000 0000 0000 0000 0000 0000
0248: 0000 0000 0000 0000 0000 0000 0000 9aa5


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 24th, 2012, 15:08 
Offline

Joined: May 6th, 2008, 22:53
Posts: 2138
Location: England
Thanks for supplying the data from the same drive in the two environments.

I don't have time for a full comparison between the two sets of data right now, but the most glaring issue to me is that the checksum is different (last 2 bytes). So if FreeBSD is reformatting the contents of the Identify Device response, even when using the pass-through command (ioctl?), it would also have to be changing the checksum in order to cause the output that you've shown. So the difference is not just changing the fields that you mentioned.

While anything is possible, I would be surprised that it changes the checksum, as well as being surprised that it snoops the command byte in a pass-through command/ioctl. Other *nix variants I've worked on, don't do either of those...

However, FreeBSD isn't a Unix variant that I've worked on. If you can point me at the FreeBSD ATA driver source code online for your specific version of the driver, and the details of the command/ioctl which you used to issue the Identify Device command (ideally the source code of your utility), then I'll look at the source of the ATA driver to see if the hypothesis of it reformatting the Identify Device response data (even on a pass-through command) and changing the checksum (to match the changed data?) is true.

Personally I have a different hypothesis for what you're seeing, but I can't think of a quick way to test it remotely and I'm not very confident of it without having the systems in front of me, hence why testing your hypothesis seems easier. I'm also interested whether if the Samsung drive is in the same system for both tests (i.e. are you dual-booting the same system between FreeBSD & DOS for HDAT2)? My bet is not, and it's 2 different systems - am I right? ;)


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 24th, 2012, 17:23 
Offline
User avatar

Joined: September 8th, 2009, 18:21
Posts: 16960
Location: Australia
Vulcan wrote:
... the most glaring issue to me is that the checksum is different (last 2 bytes).

The second set of Identify Device data is "from HDAT2 screen dump [of a different Samsung HDD]".

You should be comparing the first set with the third set. :-)

Code:
0008: 0000 0000 3053 4644 314a 4c49 3232 3132
0016: 0037 0000 0000 0000


I suspect that FreeBSD is being confused by the use of 0x00 pad bytes instead of the required spaces (0x20). Therefore it could be seeing the first 0x00 byte and then ignoring the succeeding 0x37 byte.

_________________
A backup a day keeps DR away.


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 24th, 2012, 20:56 
Offline

Joined: January 23rd, 2012, 17:37
Posts: 9
Location: Texas
... why yes... you've won that bet.

I imagine that the differences in checksums were related to BIOS choosing/setting DMA/UDMA? Or other? I'll have to run & log on the one system and compare results I guess.

That aside, I identified the final source of the error. Summary: FreeBSD is "fine." Drive is "fine." It's programmer-error (that'd be me... can I beg off that I inherited the code? Nah.. I reviewed it all once upon a time. Should have caught it then).

FreeBSD was returning the ATA Identity unmodified as I had originally expected. We got that unmodified Identity, and a rogue method in a parent class (OO goodness/badness) attempted to duplicate the FreeBSD driver's logic for scrubbing the serial number/model/revision for C consumption... and failed. [The FreeBSD driver does modify the ATA Identity in-place if the IOCTL asks directly for the identity - but it does it "correctly" [as I found as I began looking closer at that code] in the sense that if the SN is "short enough" it'll be null terminated]

Hey, I learned a lot already from this experience. Still curious on other thoughts related to diff checksums. Any other gotcha's I should be aware of?


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 24th, 2012, 20:58 
Offline

Joined: January 23rd, 2012, 17:37
Posts: 9
Location: Texas
@fzabcar: no, that's not an issue. This is an Intel platform, with a little-endian architecture.

Thanks for being helpful though.


Top
 Profile  
 
 Post subject: Re: Samsung HDD Serial Number vs ATA Identity
PostPosted: January 25th, 2012, 12:16 
Offline

Joined: May 6th, 2008, 22:53
Posts: 2138
Location: England
@rsitze:

Although I thought I had understood you, I'm now a bit confused about which data came from which drive, after the comment from fzabkar. Anyway, further analysis by me doesn't seem necessary, as you've now found the problem - well done! As you saw, I didn't think that FreeBSD was the cause :)

If a drive is reporting a different Identify Device data checksum, depending on whether you use FreeBSD or HDAT 2 to read it, then I suggest you just "diff" the real raw data (and in the case of FreeBSD, obviously bypass that problematic OO routine in your utility) and look for where the difference(s) is/are, before the checksum. I guess that's what you were referring to, in your comment.

Well done again and have fun :)


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

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 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