Windows + HDD serial number = ouch.

Whatever pisses you off. Whatever you want to yell out to the world. POST IT HERE, DARNIT!

Moderator: poppycat

Post Reply
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

Windows + HDD serial number = ouch.

Post by ^rooker »

Sorry.
I had to write about this.

I have a bunch of disks in one computer, and I wanted to know which drive exactly is at which physical port.
The best, easiest and most failsafe way is to identify the drives by their serial-numbers.

On a GNU/Linux system, this is child's play:
1) Use "/dev/disk/by-path" to identify which drive is connected where:

Code: Select all

$ ls -la /dev/disk/by-path/
The output looks like this:
total 0
lrwxrwxrwx 1 root root 9 Nov 26 2012 pci-0000:00:1f.2-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 26 2012 pci-0000:00:1f.2-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 26 2012 pci-0000:00:1f.2-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Nov 26 2012 pci-0000:00:1f.2-scsi-1:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Nov 26 2012 pci-0000:00:1f.2-scsi-1:0:0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov 26 2012 pci-0000:00:1f.2-scsi-1:0:0:0-part2 -> ../../sdb2
Excellent.
Now we know exactly which drive is physically connected to which SATA port.
You can ignore the entries that contain "part" in their name, because they're the partitions.

2) If we want to know the serial number of the physical disk, we just use "hdparm":

Code: Select all

$ hdparm -i /dev/sda
The output looks as follows:
/dev/sda:

Model=SAMSUNG HD103SJ, FwRev=1AJ10001, SerialNo=S246J1KZ405465
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=80
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: disabled (255) WriteCache=enabled
Drive conforms to: unknown: ATA/ATAPI-0,1,2,3,4,5,6,7
Wonderful!
Know we know everything about the physical drive, including the details about its current transfer/communication settings, etc.

And look: In the first row, there's the drive's actual serial number, along with model, manufacturer and firmware revision:
Model=SAMSUNG HD103SJ, FwRev=1AJ10001, SerialNo=S246J1KZ405465
In our server with 45 disks in one chassis, this is vitally necessary when locating disks to be replaced, etc.


Now, the reason for this short bitching-post is, that we tried to run a software RAID on Windows 7.
In order to know which physical drive is assigned to which RAID, it's useful to know exactly which physical drive you configure in the GUI.

No problem. Let's look for the equivalent of "/dev/disk/by-path" and "hdparm" on Windows.
That's something a serious storage server admin will need, so it has to be documented. It can't be too difficult, right?

Obviously, I was wrong. :evil:

First of all:
Those Windows dumbfscks don't even know what a drive's serial number looks like:
http://superuser.com/questions/498083/h ... mmand-line

All the threads I found, returned the same nonsense as above. Or similar useless hints.

After questioning myself, why this is so difficult to find, I found the answer in how Windows-users approach the question:
http://www.daniweb.com/hardware-and-sof ... ial-number

Ouch.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply