All this relates to one particular USB flash drive (the extrememory SNIPPY 16 GB). It is specified for read speed 10 MiB/s, write speed 3 MiB/s. A dealer tested it (reportedly) with read speed 15.8 MiB/s, write speed 5.97 MiB/s.
Read Speed Test
A read speed test is done like this:
$ sudo hdparm -t /dev/sdb;
$ /dev/sdb:
$ Timing buffered disk reads: 38 MB in 3.04 seconds = 12.51 MB/sec
These values are accurately repeatable over multiple tests.
Write Speed Test
Write speed depends on the file system / device architecture alignment, so should be tested by writing files to the mounted file system. Also, writing to the file system needs an option to disable caching (the “sync” flag), as this would erroneously increase the write speed. However, do not use the “-o sync” mount option, as that decreases write speed by a factor of ~12 to a value way below the manufacturer specs. Also, one should use /dev/zero as it is a fast enough data source (1 GiB/s or more), while /dev/urandom is very slow compared to that.
Write speed test procedure:
- Create a file system, if necessary:
$ sudo mkfs.vfat /dev/sdb1
- Test:
$ sudo mount /dev/sdb1 /media/misc
$ sudo dd count=100 bs=1M if=/dev/zero of=/media/misc/testfile.raw oflag=syncResult: 2.7 MiB/s, repeatably.
- Now optimize by aliging the filesystem to 128k blocks. Here, a ext4 file system was used, as in the linked instrucions.
- Test write speed again as above. Result: 4.2 MiB/s.
Notes on write speed tests:
- Using a vfat file system instead of ext4 for the write speed tests did not hurt. Result: 4.5-4.7 MiB/s, repeatably. Read speed on vfat, when testing again with hdparm as above, stays nearly, the same: 12.58 MiB/s.
- Measuring the write speed with “
sudo dd if=/dev/zero of=/dev/sdb1 bs=4096
” results in decreasing and then again increasing values, here from 17.0 MB/s down to 4.0 MB/s and then again up to 4.1 MB/s, with 2.7 GB copied. - Measuring write speed with “sudo dd count=100 bs=1M if=/dev/zero of=/dev/sdb1 oflag=sync” (that is, writing to the device instead to the file system) results in a value of 2.7 MiB/s (without oflag=sync, 2.8 MiB/s).
Leave a Reply