Getting hard drive serial number from USB devices

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Jan 16 20:48:35 UTC 2006


On Sat, Jan 14, 2006 at 02:29:35PM -0500, Madison Kelly wrote:
> Peter wrote:
> >
> >lsusb -v|...|grep iSerial
> 
> Thanks for the reply!
> 
>   Unfortunately, that only gives the serial number of the USB 
> controller, not the hard drive itself. This is a problem because I use 
> USB drives with removable disk carriers. If I rely on the USB/IDE ASIC's 
> serial number my program would not be able to tell the difference 
> between different hard drives connected through the common carrier.

What filesystem do you format the drives with?

If you use ext2/ext3 you can do this:
tune2fs -l /dev/sda1 |grep UUID

There are probably similar things you can do on other filesystems.

Each filesystem is assigned a unique id, which is a very reliable way to
identify a drive.  If you reformat it, the ID changes of course, but at
that point it is a new filesystem and hence would have none of the old
data anymore.

Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list