# 怎么提高MassFlash的烧写速度

**URL:** <https://forums.developer.nvidia.com/t/massflash/302548>\
**Category:** Jetson AGX Xavier\
**Tags:** chinese, performance\
**Created:** [August 7, 2024, 3:42am UTC](https://forums.developer.nvidia.com/t/massflash/302548 "2024-08-07T03:42:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pelva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/pelva/32/336240_2.png) [@Pelva](https://forums.developer.nvidia.com/u/Pelva)\
**Post date:** [August 7, 2024, 3:42am UTC](https://forums.developer.nvidia.com/t/massflash/302548/1 "2024-08-07T03:42:40Z")

</div>

我们使用Jetpack5.1.2 在Jetson Agx Xavier开发板上烧写一个rootfs大约为23G的镜像，测试的烧写时间如下：

| 烧写数量 | 用时（分） |
| --- | --- |
| 1 | 17 |
| 2 | 33 |
| 3 | 45 |

当数量增加时，单位烧写时间没有明显下降，是不是和主机的硬件配置有关系？

我们当前使用的磁盘性能比较低

| 顺序读取 | 1017 MB/s |
| --- | --- |
| 顺序写入 | 682 MB/s |
| 随机读写32KQD20 | 918 MB/s |
| IOPS 4KQD1 | 45 MB/s |

使用了一个USB Hub连接多个开发套件。

请问，刷写速度瓶颈是什么？

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [August 7, 2024, 5:18am UTC](https://forums.developer.nvidia.com/t/massflash/302548/3 "2024-08-07T05:18:43Z")

</div>

Hi,  
Do you use the massflash script? The throughput may be gated by USB interface. Please check if the connection is in USB3 SuperSpeed instead of USB2.

---

<div class="post-metadata">

**Author:** ![Pelva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/pelva/32/336240_2.png) [@Pelva](https://forums.developer.nvidia.com/u/Pelva)\
**Post date:** [August 7, 2024, 6:27am UTC](https://forums.developer.nvidia.com/t/massflash/302548/4 "2024-08-07T06:27:34Z")

</div>

> [@DaneLLL](#):
>
> Do you use the massflash script?

我使用下面的命令烧写

```auto
sudo ionice -c 1 -n 0 ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --massflash 5 --network usb0 

```

重新测试USB2.0 和USB3.0，下面是测试结果

| 数量 | USB2.0用时（分） | USB3.0用时（分） |
| --- | --- | --- |
| 3 | 43 | 44 |

二者没有明显差异。  
我注意到烧写过程中，会使tar 命令解压img文件，这是不是和主机的磁盘读写速度有关？  
可否告知，理论上使用massflash刷写多台设备，会节省多少时间吗，我没有参照，不知上面的速度是否正常。

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [August 12, 2024, 12:27am UTC](https://forums.developer.nvidia.com/t/massflash/302548/5 "2024-08-12T00:27:39Z")

</div>

Hi,  
You have 3 devices so please set

```auto
--massflash 3

```

And for first massflash please set _–keep_:

```auto
sudo ionice -c 1 -n 0 ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --massflash 3 --network usb0 --keep

```

And then please set _–reuse_:

```auto
sudo ionice -c 1 -n 0 ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --massflash 3 --network usb0 --reuse

```

---

<div class="post-metadata">

**Author:** ![Pelva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/pelva/32/336240_2.png) [@Pelva](https://forums.developer.nvidia.com/u/Pelva)\
**Post date:** [August 12, 2024, 2:45am UTC](https://forums.developer.nvidia.com/t/massflash/302548/6 "2024-08-12T02:45:31Z")

</div>

Hi,  
我会试试

```auto
--massflash 3

```

之前我也试了–keep 和 --reuse ，无论是第一次或再次刷写，并没有减少时间，我换了一块新的固态硬盘，重新试一下，稍后反馈结果。

---

<div class="post-metadata">

**Author:** ![Pelva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/pelva/32/336240_2.png) [@Pelva](https://forums.developer.nvidia.com/u/Pelva)\
**Post date:** [August 13, 2024, 3:39am UTC](https://forums.developer.nvidia.com/t/massflash/302548/7 "2024-08-13T03:39:45Z")

</div>

Hi, [DaneLLL](https://forums.developer.nvidia.com/t/massflash/302548/5)  
我尝试了所有可能的方法，都不能提高刷写速度。

最后，我使用`lsusb -t `发现，新增加了USB设备在USB2.0速度下  
插入USB线之前

```auto
lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 2: Dev 2, If 1, Class=Communications, Driver=cdc_mbim, 480M
    |__ Port 2: Dev 2, If 2, Class=CDC Data, Driver=cdc_mbim, 480M
    |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M
    |__ Port 4: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 2, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 3, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 4, Class=Application Specific Interface, Driver=, 480M
    |__ Port 10: Dev 5, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 10: Dev 5, If 1, Class=Wireless, Driver=btusb, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/3p, 20000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M

```

插入USB之后，新增了 `Port 5: Dev 68`

```auto
 lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 2: Dev 2, If 1, Class=Communications, Driver=cdc_mbim, 480M
    |__ Port 2: Dev 2, If 2, Class=CDC Data, Driver=cdc_mbim, 480M
    |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M
    |__ Port 4: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 2, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 3, Class=Video, Driver=uvcvideo, 480M
    |__ Port 4: Dev 4, If 4, Class=Application Specific Interface, Driver=, 480M
    |__ Port 5: Dev 68, If 0, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 10: Dev 5, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 10: Dev 5, If 1, Class=Wireless, Driver=btusb, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/3p, 20000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M

```

 ![image](https://global.discourse-cdn.com/nvidia/original/4X/b/7/7/b7732b310d41119ad0eb1ba56cca1f6ccc26ba8d.png)

我没有使用USB Hub，使用主机（都是3.0的USB口，或Type C口）直连目标板的方式， 并且尝试了各种USB线（Type C 或 USB3.0 数据线），使用`lsusb -t `显示都是480M速度。  
我对硬件或USB了解比较少，有办法让它工作在USB3.0模式下吗？

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [August 13, 2024, 5:52am UTC](https://forums.developer.nvidia.com/t/massflash/302548/9 "2024-08-13T05:52:29Z")

</div>

Hi,  
It is expected it shows USB2 in _lsusb -t_. It is USB2 in the beginning while running _initrd_ command. And in the middle Xavier device will be booted and re-enumerated as USB3.

Do you use Xavier developer kit or custom board? If you use Xavier developer kit, please connect the type-C port of developer kit to USB3 type-A port of host PC. If the host PC has multiple USB3 type-A ports, please connect single developer kit to each port. If you use custom board, please make sure the port is correctly set to otg mode and can be enumerated to USB3 device mode.

---

<div class="post-metadata">

**Author:** ![Pelva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/pelva/32/336240_2.png) [@Pelva](https://forums.developer.nvidia.com/u/Pelva)\
**Post date:** [August 13, 2024, 7:11am UTC](https://forums.developer.nvidia.com/t/massflash/302548/10 "2024-08-13T07:11:44Z")

</div>

Hi,  
我使用的是Xavier开发套件，连接 是将开发套件的type-C口与主机的USB3 type-A口相连。

现在我注意到，在刷写过程中使用`lsusb -t` 显示新出现的设备也在USB2.0速度下

下面是接入USB之前的状态：  
lsusb -t  
/: Bus 04.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/4p, 10000M  
/: Bus 03.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/12p, 480M  
|\_\_ Port 2: Dev 2, If 1, Class=Communications, Driver=cdc\_mbim, 480M  
|\_\_ Port 2: Dev 2, If 2, Class=CDC Data, Driver=cdc\_mbim, 480M  
|\_\_ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M  
|\_\_ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M  
|\_\_ Port 4: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 2, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 3, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 4, Class=Application Specific Interface, Driver=, 480M  
|\_\_ Port 10: Dev 5, If 0, Class=Wireless, Driver=btusb, 12M  
|\_\_ Port 10: Dev 5, If 1, Class=Wireless, Driver=btusb, 12M  
/: Bus 02.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/3p, 20000M  
/: Bus 01.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/1p, 480M

下面是开发套件进入Recovery模式下，接入USB，多了Dev 79  
和 Dev80两个设备  
lsusb -t  
/: Bus 04.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/4p, 10000M  
/: Bus 03.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/12p, 480M  
**|\_\_ Port 1: Dev 80, If 0, Class=Vendor Specific Class, Driver=, 480M**  
|\_\_ Port 2: Dev 2, If 1, Class=Communications, Driver=cdc\_mbim, 480M  
|\_\_ Port 2: Dev 2, If 2, Class=CDC Data, Driver=cdc\_mbim, 480M  
|\_\_ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M  
|\_\_ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M  
|\_\_ Port 4: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 2, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 3, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 4, Class=Application Specific Interface, Driver=, 480M  
**|\_\_ Port 7: Dev 79, If 0, Class=Vendor Specific Class, Driver=, 480M**  
|\_\_ Port 10: Dev 5, If 0, Class=Wireless, Driver=btusb, 12M  
|\_\_ Port 10: Dev 5, If 1, Class=Wireless, Driver=btusb, 12M  
/: Bus 02.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/3p, 20000M  
/: Bus 01.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/1p, 480M

下面是进入刷写过程中，多了Dev 81 和Dev 82  
lsusb -t  
/: Bus 04.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/4p, 10000M  
/: Bus 03.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/12p, 480M  
**|\_\_ Port 1: Dev 81, If 2, Class=Mass Storage, Driver=usb-storage, 480M  
|\_\_ Port 1: Dev 81, If 0, Class=Communications, Driver=rndis\_host, 480M  
|\_\_ Port 1: Dev 81, If 1, Class=CDC Data, Driver=rndis\_host, 480M**  
|\_\_ Port 2: Dev 2, If 1, Class=Communications, Driver=cdc\_mbim, 480M  
|\_\_ Port 2: Dev 2, If 2, Class=CDC Data, Driver=cdc\_mbim, 480M  
|\_\_ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 480M  
|\_\_ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M  
|\_\_ Port 4: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 2, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 3, Class=Video, Driver=uvcvideo, 480M  
|\_\_ Port 4: Dev 4, If 4, Class=Application Specific Interface, Driver=, 480M  
**|\_\_ Port 7: Dev 82, If 0, Class=Communications, Driver=rndis\_host, 480M  
|\_\_ Port 7: Dev 82, If 1, Class=CDC Data, Driver=rndis\_host, 480M  
|\_\_ Port 7: Dev 82, If 2, Class=Mass Storage, Driver=usb-storage, 480M**  
|\_\_ Port 10: Dev 5, If 0, Class=Wireless, Driver=btusb, 12M  
|\_\_ Port 10: Dev 5, If 1, Class=Wireless, Driver=btusb, 12M  
/: Bus 02.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/3p, 20000M  
/: Bus 01.Port 1: Dev 1, Class=root\_hub, Driver=xhci\_hcd/1p, 480M

我在两台笔记本电脑上测试，都是这样。  
请问，这种状态正常吗？

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [October 9, 2024, 2:04am UTC](https://forums.developer.nvidia.com/t/massflash/302548/12 "2024-10-09T02:04:29Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
