A
A
Asparagales2019-01-04 15:08:52
linux
Asparagales, 2019-01-04 15:08:52

Why is the speed of writing to a flash drive so slow?

I have a USB 2.0 flash drive. Formatted it to ext4. I tried to write files with a total volume of several gigabytes. I tried to write as many small files, ranging in size from a few megabytes to several tens of megabytes, as well as large ones, several gigabytes. The picture is always the same: at first, the copying speed is very high, but after copying about half a gigabyte, the speed drops sharply. I know that this is USB 2.0, I know that the initial copy speed is copying somewhere to the buffer, but a speed of about 500 KiB / s seems to me not normal. In addition, copying often stops altogether for a long time, maybe forever - I did not have enough patience and I pulled out the flash drive after 10 minutes of waiting. Even if the copying was successful, the flash drive cannot be unmounted for a long time after that.
For comparison, a much older flash drive formatted in mbr/fat32 writes the same files many times faster. I thought that I got a defective one and bought another one with USB 3.0, but it has exactly the same picture: the write speed to Linux file systems (ext4, xfs) is extremely low and copying often stops altogether, but the write speed to the ntfs partition is noticeable higher, although it also jumps a lot.
Have you ever experienced that the speed of writing to a flash drive on Linux file systems is very slow? Does the partition table matter for speed - ms-dos or gpt? What programs do you format with?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
SOTVM, 2019-01-04
@sotvm

100% shit_flash drive
about speed at the beginning / end has already been answered,
I set the block size to 4kb

V
Vladimir, 2019-01-04
@MechanID

You are right in the beginning, the speed is high because everything falls into the buffer that is in RAM, then the speed drops, the speed of writing to a flash drive depends very much on the block size, you can use the dd utility to test writing to your flash drive:
dd if=/dev / zero of = / dev / sdH bs = $ BLOCK_SIZE count = 100,000 conv = fsync
variable BLOCK_SIZE substitute 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864
after each test, reset jackpots command echo 3> / proc/sys/vm/drop_caches
after getting the block size with good write speed you can format the flash drive to ext4 by specifying this block size e.g. mkfs.ext4 -b 4096 /dev/sdb

A
Asparagales, 2019-01-05
@Asparagales

In general, if anyone else is interested, I created an ms-dos partition table and the actual partition using fdisk. Then using dd filled the partition with zeros and after that created the ntfs and ext4 filesystems. It seems to have helped a little, although I did not take accurate measurements before and after.

D
Dmitry Kovalev, 2019-01-28
@PriestFromRL

It all depends on the flash drive and the write speed. If you have a write speed of, say, an average of 10Mb / s, namely to this flash drive, let's say 1Mb / s, then the problem is in the flash drive. And little depends on its format.

R
Rodion Vodeiko, 2019-11-20
@rodocop

Hmm... "An older flash drive" is most likely simply made on MLC, or even SLC memory, which is purely technologically faster (and at the same time, more durable and more reliable) than cheap and capacious modern TLC.
That's all love...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question