nof*_*fle 15
该pv
工具允许您查看流经它的数据的吞吐量。安装软件包后,您可以运行如下命令来查看写入速率:
$ cat /dev/zero | pv > /media/some_usb/tmp123
203.1MiB 0:00:02 [100.2MiB/s] [ <=> ]
Run Code Online (Sandbox Code Playgroud)
对于读取,使用新创建的tmp123
文件执行相反的操作:
$ cat /media/some_usb/tmp123 | pv > /dev/null
Run Code Online (Sandbox Code Playgroud)
Eld*_*eek 15
我对此很好奇,因为我有一个 SATA 3 SSD,我想用它来处理一些视频文件(以保持 I/O 等待的时间最少),但系统上只有 SATA 2 (3Gbps) 端口可用,而且还有一个USB3 端口可用。
您可以使用命令确定每个 USB 端口的端口理论最大速度 sudo lsusb -vvv |grep -i -B5 -A5 bcdUSB
bcdUSB 行返回端口的 USB 版本。
来自我的系统之一的示例:
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 1 Single TT
bMaxPacketSize0 64
idVendor 0x8087 Intel Corp.
--
Port 7: 0000.0100 power
Port 8: 0000.0100 power
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
bNumConfigurations 1
--
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
--
Bus 001 Device 003: ID 10d5:5a08 Uni Class Technology Co., Ltd
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x10d5 Uni Class Technology Co., Ltd
--
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 1 Single TT
bMaxPacketSize0 64
idVendor 0x8087 Intel Corp.
--
Port 5: 0000.0100 power
Port 6: 0000.0303 lowspeed power enable connect
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
bNumConfigurations 1
--
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
--
Bus 004 Device 002: ID 174c:5106 ASMedia Technology Inc. Transcend StoreJet 25M3
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 9
idVendor 0x174c ASMedia Technology Inc.
--
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 3
bMaxPacketSize0 9
idVendor 0x1d6b Linux Foundation
--
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 1 Single TT
bMaxPacketSize0 64
idVendor 0x1d6b Linux Foundation
Run Code Online (Sandbox Code Playgroud)
或者快速简便的替代方法lsusb -t
提供如下输出:
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 4: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 6: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 6: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
Run Code Online (Sandbox Code Playgroud)
由于通过 USB3 提供的 5 Gbps 更接近 SATA 3 额定的 6 Gbps,我决定将驱动器连接到那里Bus 004 Device 002
(通过 Asmedia USB3toSATA 适配器)。结果相当令人满意。
资料来源:本页
实验
https://en.wikipedia.org/wiki/USB
https://en.wikipedia.org/wiki/Serial_ATA 如何找到 USB 集线器速度
小智 7
您可以使用rsync
来给出传输速度的近似值,尽管它会因传输的文件是小文件还是大文件以及目标是慢速闪存驱动器还是快速外部硬盘而有所不同。例如:
rsync -avviu ~/Videos /media/Mik2
sent 874419803 bytes received 149 bytes 4427442.79 bytes/sec
total size is 874312527 speedup is 1.00
Run Code Online (Sandbox Code Playgroud)
(此外,如果您打开tail -f /var/log/kern.log
然后连接您的设备,您可以看到它是否正在设置为支持 USB 2 速度的 ehci(增强型主机控制器接口)。例如,内核日志应说明“新的高速 USB 设备” ...使用ehci_hcd'。)