Here is a raw read using dd of my 3tb drive inside the enclosure. As you can see, the speed looks good for this old spinner. However, real life usage is a different story.
rock@RockSvr:~$ sudo dd if=/dev/sda of=/dev/null bs=100M
^C32+0 records in
31+0 records out
3250585600 bytes (3.3 GB, 3.0 GiB) copied, 25.6378 s, 127 MB/s
rock@RockSvr:~$
I’ve run modprobe uas, also added uas to /etc/modules, put the pendrive in lower USB 3.0 port and restarted the board. lsmod gives that uas is loaded. I have script:
Just thought I would add my unusual experience that may shed some light on a possible issue.
I have done quite a bit of speed testing (fio) with my Samsung EVO 970 250GB NVMe and for what ever reason after some random amount of testing the speeds drop by about 70% and nothing I do restores it. I have no explanation why this happens but formatting the drive fixes the speed problem. Drive is formatted with ext4.
Ok, so first off, that device you are referring to is M2. This thread is about USB3.
And second, 1.3 Gbps is only 162.5 MB/s, and 382 Mbps is only 47.75 MB/s… this is eMMC territory. I’m seeing people displaying MUCH better results from USB3 devices in this thread. Despite the “:D” you share on your post, you certainly don’t have anything to smile about.
Its not for “whatever reason”. There is a VERY SPECIFIC reason why this happens. You can’t re-write to previously written blocks on a solid state storage device until those blocks have been wiped clean. The reason why it is much slower is because of the time it takes to wipe those previously used blocks.
Two easy solutions;
Manually run fstrim on the filesystem:
# fstrim -v /mount/point
automatically, by mounting the filesystem with the “discard” option.
Now this is the key to the process; the DRIVE can’t just trim itself, because after a block has been written to, it has no way to know if it is still in use or is available. That means that the OS has to TELL it what blocks are available and should be trimmed. The OS queries the filesystem, which tracks what is and is not in use, and sends the results to the disk, which should do the job in the background, rather than you actually having to wait for the whole disk to write over.
When you’re FORMATTING a disk, it issues a trim command for the entire, CONTIGUOUS, region that will be occupied by the new filesystem (typically the entire partition). Now formatting your disk just to trim it is, of course, very wasteful – both in terms of the longevity of the disk itself, as well as the work it takes to return the disk to the state it was in. My advice to you would be to mount the filesystem using the discard option, and then occasionally check with the fstrim command to make sure. This will optimize the disk performance without unduly hurting its longevity. After all, blocks need to be wiped prior to being rewritten anyway, might as well do it proactively.
Edit: one of the reasons why the discard mount option is so powerful, is because it has basically zero overhead. When you delete a file, that fact is recorded in the filesystem as an unlink. On a magnetic disk, that is ALL that happens, whatever data was pointed to by the inode that was just erased ends up being “lost” somewhere on the drive. Same happens without the discard option, which means that in order for the fstrim command to work, it has to run through the entire filesystem in order to track down all the blocks that are IN USE, and then invert that selection before feeding the results to the disk for a trim. So if you run the fstrim command, it can actually take quite a while sometimes. But if you mount with discard, then before unlinking, it takes the list of blocks from the inode RIGHT THEN and sends it to the disk to be trimmed. No need to search for it later.