Get the hard disk hardware serial number

Nick Craig-Wood nick at craig-wood.com
Thu Jun 4 05:29:42 EDT 2009


MRAB <python at mrabarnett.plus.com> wrote:
>  Jorge wrote:
> > I need to know how to get the hardware serial number of a hard disk in 
> > python.
> > 
>  For Windows, see http://www.daniweb.com/forums/thread187326.html

For linux I'd run this and parse the results.

# smartctl -i /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Momentus 7200.2
Device Model:     ST9200420AS
Serial Number:    7QW138AK
Firmware Version: 3.AAA
User Capacity:    200,049,647,616 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   7
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Thu Jun  4 09:30:23 2009 BST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

According to the man page smartctl also runs under windows/mac/solaris
etc

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list