in reply to Can Perl read the hard drive registration #?
Try being more specific. What operating system, what do you mean by "registration numbers"?
For example, you can query a drive on capabilities and vendor strings under Linux with the hdparm command:
# hdparm -i /dev/hda /dev/hda: Model=WDC WD307AA-00BAA0, FwRev=10.09K11, SerialNo=WD-WMA2F2556865 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGap +Req } RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=40 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=1 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=60074784 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 udma0 udma1 *udma2 udma3 udma4 AdvancedPM=no WriteCache=enabled Drive Supports : Reserved : ATA-1 ATA-2 ATA-3 ATA-4
And if the serial number is what you're looking for, here's a Perl script to extract it:
#!/usr/bin/perl my $query = qx{hdparm -i /dev/hda} or die $!; print "HDD serial number is: $1\n" if $query =~ m/SerialNo=([^,\s]+)/s;
The output on my system is:
HDD serial number is: WD-WMA2F2556865
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Can Perl read the hard drive registration #?
by Anonymous Monk on Mar 20, 2004 at 17:20 UTC | |
by Koosemose (Pilgrim) on Mar 20, 2004 at 18:04 UTC | |
by calin (Deacon) on Mar 20, 2004 at 17:31 UTC |