Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use machine with USB 2 and USB 3 ports, and I have USB 3 external disk which works perfectly in term of speed (I use it as backup drive so during the night new files are nicely transfered to this external drive).

Now I try to do simple script to check if USB drive connected to the right (USB 3) port, and not slow USB 2. Easy to say, but...

The disk is WD's Elements series, and camcontrol devlist tells me:

...
<WD Elements 1042 1007>            at scbus11 target 0 lun 0 (pass9,da1)
...

Ok, it shows the device (da1), but it won't tells me the speed.

At the same time usbconfig shows me:

...
ugen1.2: <Elements 1042 Western Digital> at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON
...

Here I see speed ("spd=SUPER (5.0Gbps)"), but I see no way to understand if this "Elements 1042 Western Digital" is the same "WD Elements 1042 1007" from above command.

So could please tell me if there is any way to clearly get given da's speed?

share|improve this question
    
Are there any other Western Digital Elements devices that could be a different match on? I use drives from so many different manufacturers, that I don't often have possible collisions like that for possible matches. Though I think that Elements 1042 should be a match for Elements 1042 unless you have multiple identical drives. –  killermist Jun 21 '12 at 15:39
    
In fact I use external USB drives for backup purposes and I got a few of them (three), so I'd also love to differentiate these drives so backup script can trace them (like 1st day I do backup to 1st disk, 2nd day to 2nd disk etc., so the script can check if I connect "right-for-today-disk" disk). I can surely won't care for the disk name (Elements 1042 Western Digital) at all and I'd rather want to know disk's serial or something unique –  Alexander Jul 26 '12 at 5:49
    
Just can't find right way to identify, despite the fact that even different utility reports different disk names. –  Alexander Jul 26 '12 at 5:56
1  
camcontrol inquiry da1 -S will return the serial number of the disk. In a script you could loop through the da* devices and match the serial to the da* name. With usbconfig you can then findout what usb port that da* device is using. Then the script can compare this with the desired situation and make a decision if that connection is 'correct'. –  Multimho Jul 26 '12 at 21:16

1 Answer 1

I almost have the same setup. Bunch of internal disks and one external USB.

# dmesg

ugen5.3: <Seagate> at usbus5
umass1: <Seagate External, class 0/0, rev 2.10/0.12, addr 3> on usbus5
umass1:  SCSI over Bulk-Only; quirks = 0x4100
umass1:9:1:-1: Attached to scbus9
da4 at umass-sim1 bus 1 scbus9 target 0 lun 0
da4: <Seagate External SG12> Fixed Direct Access SCSI-4 device 
da4: 40.000MB/s transfers
da4: 1907729MB (3907029164 512 byte sectors: 255H 63S/T 243201C)

# usbconfig

ugen5.3: <External Seagate> at usbus5, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON 

# camcontrol inquiry da4 -R

pass9: 40.000MB/s transfers


So to answer the first question "is it connected to the correct USB port" you can check that with the usbconfig -u 1 -a 2 command. If this returns ugen1.2: <Elements 1042 Western Digital> than it is connected correctly. Given that ugen1.2 is the USB3 port. And I think in your case you can safely assume that Elements 1042 should be a match for Elements 1042 like Killermist notes.

The speed can be checked (in your case) with either the usbconfig -u 1 -a 2 command or the camcontrol inquiry da1 -R. In my example 480 Mbps is approx 57.2 MB/s. But because of the usb protocol overhead, I probably can't reach that throughput. So the 40 MB/s that the passthrough driver returns sounds realistic to me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.