Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Benchmark your SSD or hard disk speed Apps
You can benchmark the speed of your SSD or hard disk using a few simple Terminal commands. To test write speed:
time dd if=/dev/zero bs=1024k of=tstfile count=1024
In the output, you should look for something that looks like "bytes transferred in 16.546732 secs (519131791 bytes/sec)." Copy and paste the bytes/sec speed into Google to convert to MB/s (e.g. Google search for "519131791 bytes/s in megabytes/s").

To test read speed:
 dd if=tstfile bs=1024k of=/dev/null count=1024
[kirkmc adds: While we're on the subject, here's an easy way to test data throughput from one disk to another. Open Activity Monitor (in /Applications/Utilities), click on the Disk Activity tab at the bottom of the window, then look at the Data read/sec and Data written/sec numbers. Copy a large file from one disk to another to see how fast it can go. FWIW, my new Thunderbolt drive has throughput of about 100 MB/sec.

You can run the above commands while watching the information in Activity Monitor, and skip making the conversions. This shows that I have a peak read speed of 137 MB/sec, and a peak write speed of 151 MB/sec (an SSD in a Mac mini). The commands above will give you average speeds, whereas Activity Monitor shows the speed in real time, as well as peak speeds. See the comments below for what may be a better approach.]
    •    
  • Currently 4.17 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[39,970 views]  

Benchmark your SSD or hard disk speed | 16 comments | Create New Account
Click here to return to the 'Benchmark your SSD or hard disk speed' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Benchmark your SSD or hard disk speed
Authored by: fracai on Jul 11, '12 07:44:16AM
That second command isn't going to measure the read speed of your disk at all. It's reading from /dev/zero and writing to /dev/null; both are virtual devices. The first command already wrote out a temporary file, so just read from that:
dd if=tstfile bs=1024k of=/dev/null count=1024
For a better view of disk performance, these commands should be run with varying block sizes (bs=) and the results plotted. This is left as an exercise for the reader.
---
i am jack's amusing sig file


[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: kirkmc on Jul 11, '12 07:59:51AM

Thanks. The submission had the same command twice, and as it was anonymous, I couldn't contact the poster. I did some Googling and found that second command. It seemed to work for me, but I've changed it in the hint.

---
Mac OS X Hints editor - Macworld senior contributor
http://www.mcelhearn.com



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: bfu.me on Jul 11, '12 07:52:12AM

The read speed test is flawed as written. Using /dev/zero as dd's input and output file doesn't hit the disk at all and will return ridiculous speeds like 15-20 GB/sec. The proper way to do the read test is to be to dd the tstfile created by the write benchmark into /dev/null (but only after clearing the RAM cache by using the "purge" command).

This one-liner will test the write speed, clear the cache, properly test the read speed, and then remove tstfile to reclaim disk space:

dd if=/dev/zero bs=1024k of=tstfile count=1024 && purge && dd if=tstfile bs=1024k of=/dev/null count=1024 && rm tstfile



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: ericswanson on Jul 11, '12 09:15:21PM

Here's what I get using this method (and dividing by 1048576 to get Mb/sec):

Internal laptop hd (7200 rpm, sata): Write=42.99 Mb/sec, Read=38.09 Mb/sec
External G-Raid (esata): Write=134.76 Mb/sec, Read=192.32 Mb/sec
External Seagate hd (laptop drive, USB-2): Write=33.59 Mb/sec, Read=36.38 Mb/sec
External G-Raid (Firewire 800): Write=60.79 Mb/sec, Read=66.17 Mb/sec
Encrypted sparsebundle image on external G-Raid above (esata): Write=68.66 Mb/sec, Read=81.33 Mb/sec



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: EldRick on Jul 11, '12 10:39:01AM

That's not really very fast for Thunderbolt.

I bought a Factory Refurb LaCie Little Big Drive for $229 (LaCie.com), removed the drives and the fan, and replaced the drives with a pair of SSDs. Using RAID0, I get around 450MB/s read and 360MB/s write speeds with every test I've tried. It's much faster than the internal SSD in my 2011 iMac.



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: kirkmc on Jul 11, '12 11:23:09AM
Yes, the WD My Book is a bit slower, but it has no fan, which is a big plus. I wonder, though, if I should be getting higher speeds... Oh, BTW, I'm not using RAID 0. I'm using mine as two 2 TB disks. That cuts the speed in half.
---
Mac OS X Hints editor - Macworld senior contributor
http://www.mcelhearn.com
Edited on Jul 11, '12 11:24:12AM by kirkmc


[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: chucky23 on Jul 11, '12 10:41:57AM

The freeware Xbench's Disk Test offers a nice method for getting a few different kinds of disk benchmarks.



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: wallybear on Jul 11, '12 04:08:32PM
To obtain speed expressed in MB/sec, just append the following string to each one of the commands:
2>&1 | grep sec | awk '{print "scale = 2 ; "$(NF-1048576) "}' | bc
i.e:
time dd if=/dev/zero bs=1024k of=tstfile count=1024 2>&1 | grep sec | awk '{print "scale = 2 ; "$(NF-1048576) "}' | bc
and
dd if=tstfile bs=1024k of=/dev/null count=1024  2>&1 | grep sec | awk '{print "scale = 2 ; "$(NF-1048576) "}' | bc
No need to google around.
Edited on Jul 11, '12 04:12:16PM by wallybear


[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: cagg on Jul 11, '12 08:22:16PM

Also keep in mind it's only as fast as your system's slowest bottleneck. I realized this myself when I recently upgraded my internal HDD to SSD. Obviously I didn't do proper research. I got a top of the line model and was expecting super fast speeds around 460MB/s on SATA-III, only to realize that my 2008 MBP only has SATA-I so I get about 120 MB/s.
Probably still faster than HDD, but I never did measure the speed before I upgraded.



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: MikeIT on Jul 12, '12 08:14:21AM

You wouldn't save a great deal of money going sata-I or II ssd and this way you are future proof if you'll get a new mac.



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: cagg on Aug 03, '12 02:28:38PM

That thought had occurred to me too. However if I was going to upgrade my Macbook Pro the new one would probably already have SSD and wouldn't be user-replaceable (like in the new Retina Display version)



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: wjv on Jul 12, '12 06:30:55AM
…or you can just use a disk benchmarking tool like bonnie, which is available to be installed from MacPorts.

[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: RogParish on Jul 13, '12 09:01:23AM

When I tried:

time dd if=/dev/zero bs=1024k of=tstfile count=1024 2>&1 | grep sec | awk '{print "scale = 2 ; "$(NF-1048576) "}' | bc

I got:

awk: non-terminated string }cale = 2 ... at source line 1
context is
>>> <<<
awk: giving up
source line number 2

Mac OS X Lion 10.7.4

---
Roger
Lovettsville, VA



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: bobsc on Jul 13, '12 10:06:59AM

That awk line has an extra quote, it appears.
Any way, I found that this works:

time dd if=/dev/zero bs=1024k of=tstfile count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }'

You don't need bc at all, awk can do the arithmetic. I am dividing the total bytes by the total seconds and by

By the way, my standard internal drive in my 27" iMac (2.8GHz, a couple of years old) did the writing at 91 MB/sec.

---
bobsc



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: bobsc on Jul 13, '12 11:50:35AM

Even better, leave out grep also. Awk can do its own pattern matching:


time dd if=/dev/zero bs=1024k of=tstfile count=1024 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }'

---
bobsc



[ Reply to This | # ]
Benchmark your SSD or hard disk speed
Authored by: madhornytoad on Jan 04, '14 12:17:21PM

One additional thing that might be worth mentioning...your test file (tstfile) should be larger than the amount of physical ram.
This prevents caching and artificially inflated read speeds. Allow me to demo this on my snazzy new iMac with the PCI-e drive...
The system has 16GB of ram, a 3.5 GHz i7 and 512 GB PCI-e SSD:

madht@host (]> 01:19:24
~> time dd if=/dev/zero bs=2048k of=tstfile count=1024 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }'
732.213 MB/sec

real 0m3.278s
user 0m0.002s
sys 0m1.155s

Wow faaaast writes - love this drive...
now check the file size

madht@host (]> 01:20:12
~>ls -al tstfile
-rw-r--r--+ 1 user staff 2147483648 Jan 4 13:30 tstfile

2GB, way less than 16GB.
Now lets Read it back...

madht@host (]> 01:30:19
~> time dd if=tstfile bs=2048k of=/dev/null count=1024 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }'
6262.12 MB/sec

real 0m0.329s
user 0m0.002s
sys 0m0.329s

Mother of God!! 6.2 GB/sec!!
Hmmm....that can't be right.
So lets try a much larger test file.
NOTE: The file size does not *need* to exceed your total ram, just the amount you have free. If you feel this is a valuable use of your time ;) hint, hint -- then adjust block sizes and counts to just exceed the amount of free memory you have available.

Here Goes with a 16GB file:

madht@host (]> 01:30:44
~> time dd if=/dev/zero bs=2048k of=tstfile count=8192 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }'
728.792 MB/sec

real 0m22.583s
user 0m0.007s
sys 0m5.543s

Still bloody fast writes, yum.
Check the size (I always do)

madht@host (]> 01:42:45
~>ls -al tstfile
-rw-r--r--+ 1 user staff 17179869184 Jan 4 13:42 tstfile

Yep, that one there is a whale that can't be crammed into my ram.

madht@host (]> 01:42:49
~> time dd if=tstfile bs=2048k of=/dev/null count=8192 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }'
779.598 MB/sec

real 0m21.018s
user 0m0.006s
sys 0m4.323s

Aaaah much more like it. And still pretty performant, yo.

One more thing to add and I don't know if was already mentioned or not tl:dr -- this is a sequential test only. iow - this is as fast as it gets and in no way indicative of how your drive performs when ~30-50% of its reads and writes are random - i.e. during regular multi application usage of the OS. ioMeter is the best open source benchmarker out there however they don't fully support OSX, just the worker engine binaries -- so iometer itself would have to run on a separate machine. But it's doable ;)



[ Reply to This | # ]