Tip: Check your disk speed

Share your own howto's etc. Not for support questions!

Tip: Check your disk speed

Postby Hallvor » 2019-07-08 20:25

Did you ever wonder how fast your disk is?

This command will write a file to disk, measure the speed and delete the created file

Code: Select all
$ dd if=/dev/zero of=/tmp/output.img bs=1M count=1024 conv=fdatasync; rm -rf /tmp/output.img

My own example output:

Code: Select all
hallvor@debian:~$ dd if=/dev/zero of=/tmp/output.img bs=1M count=1024 conv=fdatasync; rm -rf /tmp/output.img
1024+0 oppføringer inn
1024+0 oppføringer ut
1073741824 byte (1,1 GB, 1,0 GiB) kopiert, 44,4709 s, 24,1 MB/s


You can also try:

Code: Select all
# dd if=test of=/dev/null bs=1048576


And to check the disk read speed:

Code: Select all
# dd if=test of=/dev/null bs=1048576



https://www.tecmint.com/5-linux-command-line-tricks/
Last edited by Hallvor on 2019-07-14 09:50, edited 5 times in total.
Lenovo Thinkpad T440S, Intel Core i7-4600U CPU @ 2.10GHz, 8 GB RAM, 256 GB SSD, Debian Buster (KDE)
User avatar
Hallvor
 
Posts: 947
Joined: 2009-04-16 18:35
Location: Norway

Re: Tip: Check your disk write speed

Postby vbrummond » 2019-07-08 22:06

I personally am a fan of "real world work" benchmarks (even simple ones like this). Want to benchmark your GPU? Run a reproducible modern game segment. It will be the performance that "matters" what the actual end user is trying to do on the computer.

I don't care of "whateverMark" can net me a score of 3000. I care if processor A runs my code faster than processor B.
Always on Debian Testing
vbrummond
 
Posts: 4468
Joined: 2010-03-02 01:42

Re: Tip: Check your disk write speed

Postby sunrat » 2019-07-09 01:49

Your first command shows it running as root but not your example. I recommend not to run as root.

Mine:
Code: Select all
roger@siduction-brain2:~$ dd if=/dev/zero of=/home/roger/temp/output.img bs=8k count=256k conv=fdatasync
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 9.22376 s, 233 MB/s


I wrote the file to $HOME as I think /tmp is mounted in RAM so won't tell me anything about disk speed. When I tried it my RAM actually filled completely so the last part of the transfer failed (or went to swap) which made the result meaningless.

Code: Select all
roger@siduction-brain2:~$ dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf
dd: error writing '/tmp/output.img': No space left on device
252676+0 records in
252675+0 records out
2069917696 bytes (2.1 GB, 1.9 GiB) copied, 3.56912 s, 580 MB/s
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2875
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Tip: Check your disk write speed

Postby GarryRicketson » 2019-07-09 03:30

Would have to try it to be sure, but :
Code: Select all
$ dd if=/dev/zero of=/tmp/output.img bs=8k count=256k

====Changing the "bs=8k" to 25k or more should get a faster speed, if the system will support a faster speed.
Code: Select all
garry@debian:~$ dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf /tmp/output.img

262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 136.305 s, 15.8 MB/s

Looks like mine is really slow now.
Code: Select all
garry@debian:~$ dd if=/dev/zero of=/tmp/output.img bs=25k count=256k conv=fdatasync; rm -rf /tmp/output.img
262144+0 records in
262144+0 records out
6710886400 bytes (6.7 GB, 6.2 GiB) copied, 196.442 s, 34.2 MB/s

Now , it copied more bytes and faster ?
And using 500k:
Code: Select all
garry@debian:~$ dd if=/dev/zero of=/tmp/output.img bs=500k count=256k conv=fdatasync; rm -rf /tmp/output.img
987+0 records in
987+0 records out
505344000 bytes (505 MB, 482 MiB) copied, 16.0748 s, 31.4 MB/s
 

Seems to start getting slower.
User avatar
GarryRicketson
 
Posts: 5877
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Tip: Check your disk write speed

Postby sunrat » 2019-07-09 03:41

GarryRicketson wrote:Now , it copied more bytes and faster ?

You changed the block size so you need to change the count proportionally to copy the same amount of data.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2875
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Tip: Check your disk write speed

Postby GarryRicketson » 2019-07-09 04:09

I guess your right, now it is much faster:
Code: Select all
garry@debian:~$ dd if=/dev/zero of=/tmp/output.img bs=25k count=25k conv=fdatasync; rm -rf /tmp/output.img
25600+0 records in
25600+0 records out
655360000 bytes (655 MB, 625 MiB) copied, 3.6705 s, 179 MB/s
garry@debian:~$
 

So what is the real disk write speed ? It appears that can be changed, depending on what block size, and what count we use when we run the 'dd' command.
User avatar
GarryRicketson
 
Posts: 5877
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Tip: Check your disk write speed

Postby sunrat » 2019-07-09 06:49

Disk speed will vary widely depending on what you are reading/writing. Writing 10,000 4k files will be slower than writing one 40,000k file. Your system cache will affect it a lot too. Sequential reads will be faster than reads from all over the disk.

Code: Select all
root@siduction-brain2:/home/roger# hdparm -Tt /dev/sda
/dev/sda:
 Timing cached reads:   13088 MB in  1.99 seconds = 6579.36 MB/sec
 Timing buffered disk reads: 506 MB in  3.01 seconds = 168.23 MB/sec


There are many ways to benchmark and they probably will all give different results.
https://wiki.archlinux.org/index.php/Benchmarking

If you really want to get right into it, Phoronix Test Suite is very comprehensive.
https://www.phoronix-test-suite.com/?k=features
https://openbenchmarking.org/
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2875
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Tip: Check your disk write speed

Postby Hallvor » 2019-07-09 08:08

sunrat wrote:Your first command shows it running as root but not your example. I recommend not to run as root.


Fixed. Thank you.
Lenovo Thinkpad T440S, Intel Core i7-4600U CPU @ 2.10GHz, 8 GB RAM, 256 GB SSD, Debian Buster (KDE)
User avatar
Hallvor
 
Posts: 947
Joined: 2009-04-16 18:35
Location: Norway

Re: Tip: Check your disk write speed

Postby Head_on_a_Stick » 2019-07-09 16:44

Code: Select all
E485:~$ dd if=/dev/zero of=test bs=1M count=1024 conv=fdatasync,notrunc
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.998124 s, 1.1 GB/s
E485:~$

Do I win? :D

Hallvor wrote:to check the disk read speed

Flush the buffers before trying that:
Code: Select all
# echo 3 > /proc/sys/vm/drop_caches
Don't break DebianHow to report bugs

SharpBang GNU/Linux — a pre-configured Openbox/Tint2 desktop running on Debian stable
User avatar
Head_on_a_Stick
 
Posts: 10600
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Tip: Check your disk write speed

Postby 4D696B65 » 2019-07-09 16:52

Head_on_a_Stick wrote:
Code: Select all
E485:~$ dd if=/dev/zero of=test bs=1M count=1024 conv=fdatasync,notrunc
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.998124 s, 1.1 GB/s
E485:~$

Do I win? :D

No :mrgreen:
Code: Select all
mike@gl703:~$ dd if=/dev/zero of=test bs=1M count=1024 conv=fdatasync,notrunc
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.889298 s, 1.2 GB/s
User avatar
4D696B65
 
Posts: 2438
Joined: 2009-06-28 06:09

Re: Tip: Check your disk write speed

Postby Head_on_a_Stick » 2019-07-09 17:32

^ Gaah! What drive is that?

I'll show you mine:
Code: Select all
01:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981
Don't break DebianHow to report bugs

SharpBang GNU/Linux — a pre-configured Openbox/Tint2 desktop running on Debian stable
User avatar
Head_on_a_Stick
 
Posts: 10600
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Tip: Check your disk write speed

Postby 4D696B65 » 2019-07-09 18:52

Head_on_a_Stick wrote:^ Gaah! What drive is that?

I'll show you mine:
Code: Select all
01:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981

sumsung 970 pro nvme m.2
Code: Select all
02:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983
User avatar
4D696B65
 
Posts: 2438
Joined: 2009-06-28 06:09


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable