2007-01-04 22:27:36

by Yakov Lerner

[permalink] [raw]
Subject: how to get serial_no from usb HD disk (HDIO_GET_IDENTITY ioctl, hdparm -i)

How can I get serial_no from usb-attached HD drive ?

The HDIO_GET_IDENTITY ioctl fails (like 'hdparm -i').
Any advice on how to extract the drive serialNo from the usb disk ?
Can I write kernel module to extract the SerialNo ?
(I don't need whole 'struct hd_driveid', only the SerialNo).

Thanks
Yakov


2007-01-06 04:57:20

by Greg KH

[permalink] [raw]
Subject: Re: how to get serial_no from usb HD disk (HDIO_GET_IDENTITY ioctl, hdparm -i)

On Fri, Jan 05, 2007 at 12:27:34AM +0200, Yakov Lerner wrote:
> How can I get serial_no from usb-attached HD drive ?

use the *_id programs that come with udev, they show you how to properly
do that.

good luck,

greg k-h

2007-01-06 15:15:36

by Kay Sievers

[permalink] [raw]
Subject: Re: how to get serial_no from usb HD disk (HDIO_GET_IDENTITY ioctl, hdparm -i)

On 1/6/07, Greg KH <[email protected]> wrote:
> On Fri, Jan 05, 2007 at 12:27:34AM +0200, Yakov Lerner wrote:
> > How can I get serial_no from usb-attached HD drive ?
>
> use the *_id programs that come with udev, they show you how to properly
> do that.

Only "advanced" ATA-USB bridges will offer you the serial number the
adapter reads from the disk on power-up. The usual id-tools will just
work fine on theses bridges.

There is no way to reach that information with most of the cheap USB
storage-adapters.

Kay

2007-01-06 17:00:05

by Stephen Clark

[permalink] [raw]
Subject: Re: how to get serial_no from usb HD disk (HDIO_GET_IDENTITY ioctl, hdparm -i)

Kay Sievers wrote:

>On 1/6/07, Greg KH <[email protected]> wrote:
>
>
>>On Fri, Jan 05, 2007 at 12:27:34AM +0200, Yakov Lerner wrote:
>>
>>
>>>How can I get serial_no from usb-attached HD drive ?
>>>
>>>
>>use the *_id programs that come with udev, they show you how to properly
>>do that.
>>
>>
>
>Only "advanced" ATA-USB bridges will offer you the serial number the
>adapter reads from the disk on power-up. The usual id-tools will just
>work fine on theses bridges.
>
>There is no way to reach that information with most of the cheap USB
>storage-adapters.
>
>Kay
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [email protected]
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
>
>
>
HI Kay,

I am looking to buy a usb to ata adapter can you name some of the
advanced adapters?

Thanks,
Steve

--

"They that give up essential liberty to obtain temporary safety,
deserve neither liberty nor safety." (Ben Franklin)

"The course of history shows that as a government grows, liberty
decreases." (Thomas Jefferson)



2007-01-06 18:02:41

by Kay Sievers

[permalink] [raw]
Subject: Re: how to get serial_no from usb HD disk (HDIO_GET_IDENTITY ioctl, hdparm -i)

On Sat, 2007-01-06 at 11:59 -0500, Stephen Clark wrote:
> Kay Sievers wrote:
> >On 1/6/07, Greg KH <[email protected]> wrote:
> >>On Fri, Jan 05, 2007 at 12:27:34AM +0200, Yakov Lerner wrote:
> >>
> >>>How can I get serial_no from usb-attached HD drive ?
> >>>
> >>use the *_id programs that come with udev, they show you how to properly
> >>do that.
> >
> >Only "advanced" ATA-USB bridges will offer you the serial number the
> >adapter reads from the disk on power-up. The usual id-tools will just
> >work fine on theses bridges.
> >
> >There is no way to reach that information with most of the cheap USB
> >storage-adapters.

> I am looking to buy a usb to ata adapter can you name some of the
> advanced adapters?

I have a nice working bridge, in a no-name 2.5" disk-enclosure:
$ lsusb
Bus 005 Device 007: ID 04b4:6830 Cypress Semiconductor Corp. USB-2.0 IDE Adapter

$ scsi_id -x -g -p0x80 -s/block/sdb -d/dev/sdb
ID_VENDOR=TOSHIBA
ID_MODEL=MK1017GAP
ID_REVISION=0000
ID_SERIAL=STOSHIBA_MK1017GAP_144M6603
ID_SERIAL_SHORT=144M6603
ID_TYPE=disk
ID_BUS=scsi

$ /lib/udev/usb_id -x /block/sdb
ID_VENDOR=TOSHIBA
ID_MODEL=MK1017GAP
ID_REVISION=0000
ID_SERIAL=TOSHIBA_MK1017GAP_DEF107727402
ID_TYPE=disk
ID_BUS=usb

Another one just shows for exactly the same disk put behind the bridge:
$ lsusb
Bus 005 Device 012: ID 0402:5621 ALi Corp. USB 2.0 Storage Device

$ scsi_id -x -g -p0x80 -s/block/sdb -d/dev/sdb

$ /lib/udev/usb_id -x /block/sdb
ID_VENDOR=USB_2.0
ID_MODEL=Storage_Device
ID_REVISION=0100
ID_SERIAL=USB_2.0_Storage_Device
ID_TYPE=disk
ID_BUS=usb


Kay