Get the hard disk hardware serial number

Nick Craig-Wood nick at
Thu Jun 4 05:29:42 EDT 2009

MRAB <python at> wrote:
>  Jorge wrote:
> > I need to know how to get the hardware serial number of a hard disk in 
> > python.
> > 
>  For Windows, see

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

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

Nick Craig-Wood <nick at> --

More information about the Python-list mailing list