Outils pour utilisateurs

Outils du site


issue156:mon_histoire

Ceci est une ancienne révision du document !


I went and bought a bunch of USB thumb drives / memory sticks from a supplier on sale a while ago (actually a few years). Copying to and from these – I noticed some had horrible speeds. Now since they are all the same brand, I wondered if there was a way to test them. I used Parted to format them in different file systems and configurations, and the speed seemed to fluctuate a bit, but it could be my imagination. The question is: how does one measure the performance of your thumb drive / memory stick in Ubuntu?

The solution

The first thing that came to mind was dd. When dd is done, you get an output that lists the average speed. So, writing the Ubuntu image to the different drives (8, 16, 32) GB drives yielded different results. Then writing them to the same size drives (I bought two of each) again yielded different results. To get some sort of metric, I opened another terminal and ran iotop, This is not shipped with Ubuntu and you can install it with: sudo apt install iotop - The nice thing with this is you get read and write metrics. So not all USB thumb drives are created equally. The very first result in my search engine yielded: https://askubuntu.com/questions/539184/how-do-i-check-the-integrity-of-a-storage-medium-hard-disk-or-flash-drive (which was not quite what I was after, yet…).

A light went on and I considered hdparm, which I have not used in about ten years or more. I was introduced to hdparm by my friend Lloyd in the wild west days of Ubuntu 04.04, to speed up my laptop. I did not consider it as I did not know if it would work for USB thumb drives and SSDs. You do not need to install hdparm – like dd, it ships with Ubuntu. Just typing hdparm will bring up a list of options. If you go down the list to ‘t’ - you will see lowercase and capital ‘t’ – both perform read timings. So I had to try: sudo hdparm -Tt /dev/sdX - (where X is your USB thumb drive). Frown… >:o( …. The results here were much faster than dd. Okay, let’s turn write caching off and back on again (the W flag), and re-test. Although there is a performance impact, it still does not match my measurements from dd.

This was a mystery that needed solving. One of the 8GB memory sticks was quite a bit slower than the rest. Let us see what is happening. Running dmesg you should see the memory stick added at the end. Now run lsusb -v | grep bcdUSB to see what it was detected as:

Aaaand there it is. One of the USB 3.0 memory sticks only detects as USB 2.0. If you are not sure which is which, run lsusb -t, then you can see which bus and port it is on.

Before any of you say: “hey, why didn’t you just use gnome disks benchmarking?” I want to say that I did. However, it was not installed on the system I was testing on, and does not give the type of insight we have been looking at here. If you do not have it, you can add it with: sudo apt install gnome-disk-utility, and you will see a menu entry named ‘disks’. To benchmark a disk in ‘disks’ - select the thumb drive, then the hamburger menu to the top right, then ‘benchmark disk’.

Make sure your data is backed up before running the benchmark!

The Conclusion

I got different results on different drives of the same size, as well as different results between the same make but different sizes. Some drives, even though being labelled as USB 3.0, were detected as USB 2.0, so check your drives after buying them! (I could not return mine as they have been lying in a box for over a year).

Benchmarking is faster than real-world usage, as seen with dd, so rather work with that if you want to know the ‘true’ speed of your USB thumb drive. So - if the ‘true’ speed of your device does not match your expectation, do some digging!

issue156/mon_histoire.1587817450.txt.gz · Dernière modification : 2020/04/25 14:24 de auntiee