0

I'm copying files to a USB 3.0 stick. The USB stick is plugged to a blue USB port.

I'm copying 22 files of 1.5GB.

When I do the copy (simple drag and drop), the copy dialog reports a speed of ~60MB/s, then, after copying the first 1.5 GB (surely the first file), progression stops for several minutes and after that, transfer speed is reported to be less than 3MB/s. The original transfer time estimated to a few minutes is now estimated to few hours...

enter image description here enter image description here

lsusb -t

reports:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 480M
    |__ Port 1: Dev 6, If 0, Class=Mass Storage, Driver=usb-storage, 480M
    |__ Port 9: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 2: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 10: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

The device is on Bus 01, reported 480M, is that a speed? If so, I see Bus 02 has a higher rate of 5000M, but I tried all ports accessible and I could not have the USB stick appear under this Bus.

lsb_release -a

reports

Distributor ID: LinuxMint
Description:    Linux Mint 18.3 Sylvia
Release:    18.3
Codename:   sylvia

Note:

  • Same files are copied in less than an hour using the same USB stick on a Windows computer, takes more than 6 hours using my Linux machine. So I really suspect the Linux system does not handle USB 3 correctly (as it shows the key as 480M, while it IS a USB 3 memory stick: has a blue USB connector and is sold as USB 3)
  • Tried a different USB 3 stick. It appears under Bus 02 5000M this time and copy is much faster (even if estimation remains hazardous). So apparently my computer can handle some USB 3 devices correctly but not the one I'm using in my original post. As apparently Windows is able to it, hopefully there is something that can be done for Linux to manage it a better way.

How can I make the copy faster?

11
  • 1
    "480M" is typical of USB2.0 ports. What you're observing is normal and expected for that USB standard (the apparent high speed at the beginning is a sort of RAM buffering). Apr 24 at 23:05
  • OK thank you, does the lsusb output mean I'm supposed to have USB3 ports? How can I confirm this from the hardware and make those available in my system?
    – jpo38
    Apr 25 at 5:17
  • 1
    3 MB/s can't be the limit of the bus, but it can be the writing speed of a cheap USB stick. It starts with 60 MB/s (which indicates USB3, because you won't get this as effective rate on USB2), until the stick's cache is filled, then it stalls to continue with the actual writing speed. What does the data sheet of the stick say?
    – Philippos
    Apr 25 at 8:28
  • 1
    There's no "cache" for 99.999% of USB flash sticks out there (only rare "SSD" USB flash sticks have it), you're solely looking at dirty buffers being filled up. Apr 25 at 9:16
  • 1
    @Philippos, you say it indicates "USB 3" but lsusb shows I'm on a USB 2 bus, doesn't it? I have no USB stick datasheet, it comes from Amazon... it's cheap.
    – jpo38
    Apr 25 at 10:23

1 Answer 1

1

progression stops for several minutes and after that, transfer speed is reported to be less than 3MB/s

First dirty buffers are being filled up and you're not seeing the real write speed, and once they are filled up, you're starting to get the real write speed.

More info here:

Why were "USB-stick stall" problems reported in 2013? Why wasn't this problem solved by the existing "No-I/O dirty throttling" code?

https://lwn.net/Articles/572911/

Here's how I've solved it for myself:

/etc/sysctl.d/dirty_buffers.conf
# Per Torvalds advice
vm.dirty_background_bytes = 33554432
vm.dirty_bytes = 134217728

For some reasons this is still relevant even with Linux 6.2.

11
  • Thank you for your help. What do you mean by "I've solved it". Will this make the estimated speed and remaining time shown more accurate or will it actually make the copy be faster?
    – jpo38
    Apr 25 at 10:21
  • 1
    This "solution" will make your applications show the real estimated speed. Performance cannot be "fixed", it's a property of your USB flash drive. Apr 25 at 10:52
  • 1
    I don't understand the version of Linux you are talking about. uname -r reports me 4.15.0-96-generic and software update proposes me ``4.15.0-142`, this is far from 6.2...
    – jpo38
    Apr 26 at 21:42
  • 1
    @sudodus. It's Linux Mint 18.3
    – jpo38
    Apr 28 at 9:57
  • 1
    Version 18.3 is unsupported, you really could update: linuxmint.com/download_all.php Apr 28 at 10:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .