Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disks plugged into USB don't show serial number, while direct SATA/IDE/SCSI do. #149

Closed
PartialVolume opened this issue Dec 6, 2019 · 3 comments · Fixed by #230
Closed
Assignees

Comments

@PartialVolume
Copy link
Collaborator

PartialVolume commented Dec 6, 2019

Update! USB serial numbers are now supported for specific USB to IDE/SATA adapters chipsets. See #230 and following comments for adapters that support this feature. If you have a USB to IDE/SATA adapter that shows the serial number in nwipe please feel free to post a comment with details and a photo of the adapter. Thanks.

Original comment:
This is because we need to use a slightly different method of acquiring the serial number for a USB disk as opposed to a SATA/IDE disc.

Self assigned as I've been looking at this issue. As always, anybody that has any knowledge of accessing disk info using IOCTL via the USB bus is more than welcome to comment with suggestions.

@PartialVolume PartialVolume self-assigned this Dec 6, 2019
@PartialVolume PartialVolume changed the title Disks plugged into USB don't show serial number. Disks plugged into USB don't show serial number, while direct SATA/IDE/SCSI do. Dec 6, 2019
@infrastation
Copy link
Contributor

It is possible to read the serial number from sysfs if you know how to map the block device name to corresponding entry in sysfs (follow a symlink from elsewhere?), for example, I have just tested with a USB HDD and it appeared as:

(lsscsi --generic)
Host: scsi7 Channel: 00 Target: 00 Lun: 00
  Vendor: ADATA    Model: HD720            Rev: 9201
  Type:   Direct-Access                    ANSI SCSI revision: 06

(lsusb -v)
Bus 001 Device 005: ID 125f:a51a A-DATA Technology Co., Ltd. 

$ cat /sys/bus/usb/devices/1-1.1/manufacturer 
ADATA
$ cat /sys/bus/usb/devices/1-1.1/product 
HD720
$ cat /sys/bus/usb/devices/1-1.1/serial 

Maybe that would be easier than a pure-C solution.

@PartialVolume
Copy link
Collaborator Author

PartialVolume commented Mar 24, 2020

I'm currently working on the code for this, however whether the serial number can be accessed has a lot to do with the chipset used in the USB to IDE/SATA adapter that you are using. Many do not support SAT ATA pass through. The three USB adapters I have don't support it. So I'm on the hunt for a suitable USB to IDE/SATA adapter that supports ATA pass through.

Chipsets that support this include:
ASMedia, Initio, Oxford, newer JMicron-JM20329, JM20335-39, Prolific PL2507/3507 PL2571/2771/2773/2775 ,Sunplus SPIF215/6, SPIF225/6.
Jmicron, Prolific and Sunplus supports fully ATA pass-through.

Further information can be found here:
https://www.smartmontools.org/wiki/USB

Getting the serial number of a drive via USB looks like it's going to be a challenge ! However I'll persevere and see if it gets me anywhere. First things first, means getting the right hardware that supports ATA pass through.

Just for reference most of the USB to IDE/SATA adapters will only return vendor/manufacturer/model info about the adapter itself not the drive you are plugging into it.

@PartialVolume
Copy link
Collaborator Author

PartialVolume commented Mar 24, 2020

I've dug a bit deeper and found a supported USB bridge in my pile of USB to IDE/SATA adapters. A model RXD-338U3.
IMAG4480
IMAG4479

PartialVolume added a commit to PartialVolume/nwipe that referenced this issue Mar 24, 2020
Add serial number support for USB devices for USB
to IDE/SATA adapters. Note this will only work
with USB IDE/SATA adapters that support ATA pass
through. See martijnvanbrummelen#149 for further details of
supported devices.

This patch requires readlink and smartmontools (smartctl)
to be installed. If not installed the serial number for
supported USB hardware will be missing.

The device type, i.e USB or ATA is now shown on the selection
and wipe windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants