Skip to main content
Topic: benchmarking drive performance (Read 572 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

benchmarking drive performance

So here's an interesting read on that
https://forum.level1techs.com/t/benchmark-nvme-on-linux/130341/6

I chose the simplest one to try

first up is a gen 4 nvme drive in a gen 3 slot 500gb wd black
Code: [Select]
i7-7700:[catherdersoflinux]:~/Desktop$ sudo hdparm -Tt /dev/nvme0n1

/dev/nvme0n1:
 Timing cached reads:   38512 MB in  1.99 seconds = 19381.17 MB/sec
 Timing buffered disk reads: 6128 MB in  3.00 seconds = 2041.90 MB/sec

next up is a 1tb segate 2.5 inch drive ripped out of and external enclosure and installed into the pc because at the time that was all there was available from the walmart across the street from me.
Code: [Select]
i7-7700:[catherdersoflinux]:~/Desktop$ sudo hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   38800 MB in  1.99 seconds = 19524.51 MB/sec
 Timing buffered disk reads: 372 MB in  3.01 seconds = 123.68 MB/sec

finally i have an msata that was used in an old laptop which is long since dead but the 128gb beast refuses to die and lives on in a 2.5 inch sata case adapter thingy
Code: [Select]
i7-7700:[catherdersoflinux]:~/Desktop$ sudo hdparm -Tt /dev/sdb

/dev/sdb:
 Timing cached reads:   38690 MB in  1.99 seconds = 19470.96 MB/sec
 Timing buffered disk reads: 888 MB in  3.02 seconds = 294.30 MB/sec

Other things of note are these instructions for using dd command to test read and write speeds

Quote
Using DD to test read/write speeds
Alternatively you can use dd. Be careful with this as this is a data firehose, if you point it at the wrong drive you can obliterate the existing data :smiley:

So how does the dd command work?

It has a if Input File parameter, and an of Output File. Data flows from input to output. and then we can specify a few control parameters as well to control that flow. We are going to be using bs Block Size (how big chunks of data we want) and count , count is the amount of blocks we want to copy.

Navigate to the root of the nvme disk, if your os is installed on the nvme, cd / should work.

Now flush buffers with sync, this makes sure that all cached data in ram is first written out to disk, then write a 1GB file of data zero’s to disk.
Code: [Select]
sync; dd if=/dev/zero of=tempfile bs=1M count=1024; sync 
Note instead of /dev/zero you can also use some other sufficiently large file on your system as the if parameter, but you need to first copy it into /tmp so it is loaded in ram and not slowing down the disk you are benchmarking by simultaneously reading from it.

If you want to do that do that do the following instead
Code: [Select]
cp path_to_largefile /tmp/tempfile
sync; dd if=/tmp/tempfile of=tempfile bs=1M; sync
This will give you a speed result when it’s done.

And the last option gives read speeds only

Quote
Test read speeds
First clear caches so that our system isn’t just reading from ram/ ‘cheating’
Code: [Select]
$ sudo /sbin/sysctl -w vm.drop_caches=3
vm.drop_caches = 3
BTW supplementary info
Setting drop_caches frees pagecache, d entries and inodes

Next read the file we wrote earlier back into the null device.
Code: [Select]
$ dd if=tempfile of=/dev/null bs=1M count=1024
This should give you a read speed result once done.

There is another option too for gnome users but i won't talk about that because i use not gnome beyond 2.  The last two i will try another day.  Just curious how it all works in reality.

Have a go at it then yeah?
Cat Herders of Linux

Re: benchmarking drive performance

Reply #1
you can also use fio for benchmark

run this for write
fio --name TEST --filename=/path/to/drive/fio.tmp --rw=write --size=3g --blocksize=512k --ioengine=libaio --iodepth=32 --direct=1

then this for read
fio --name TEST --filename=/path/to/drive/fio.tmp --rw=read --size=3g --blocksize=512k --ioengine=libaio --iodepth=32 --direct=1

the io depth can be changed like 16 or 64, also the blocksize to 1M, 4M etc, tweak the benchmark to your drive's needs.