Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Tip: Check your disk speed

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Tip: Check your disk speed

#1 Post by Hallvor »

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.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

vbrummond
Posts: 4432
Joined: 2010-03-02 01:42

Re: Tip: Check your disk write speed

#2 Post by vbrummond »

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

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 461 times

Re: Tip: Check your disk write speed

#3 Post by sunrat »

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
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Tip: Check your disk write speed

#4 Post by GarryRicketson »

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
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 461 times

Re: Tip: Check your disk write speed

#5 Post by sunrat »

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
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Tip: Check your disk write speed

#6 Post by GarryRicketson »

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
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 461 times

Re: Tip: Check your disk write speed

#7 Post by sunrat »

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
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Re: Tip: Check your disk write speed

#8 Post by Hallvor »

sunrat wrote:Your first command shows it running as root but not your example. I recommend not to run as root.
Fixed. Thank you.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Tip: Check your disk write speed

#9 Post by Head_on_a_Stick »

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
deadbang

User avatar
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 85 times

Re: Tip: Check your disk write speed

#10 Post by 4D696B65 »

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
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Tip: Check your disk write speed

#11 Post by Head_on_a_Stick »

^ 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
deadbang

User avatar
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 85 times

Re: Tip: Check your disk write speed

#12 Post by 4D696B65 »

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

Post Reply