4

On Linux I would usually use "hdparm -tT device" when I want a quick idea of how an hard drive is performing compared to another; having switched to Mac OS X a few months back I have yet to find something similar and as easy to use.

I have read that diskutil can do similar things on Mac but I am not clear about how I should use it to do something similar to the hdparm command above.

Any ideas on how to do this or on alternatives? Thanks!

4 Answers4

2

Using file copy in general and dd in particular isn't the great way to measure I/O performance. This is a very good wrap up about WHY it's so.

https://barreto.home.blog/2014/08/18/using-file-copy-to-measure-storage-performance-why-its-not-a-good-idea-and-what-you-should-do-instead/

Microsoft DiskSPD (There's a Linux port for sure!) and a cross-platform FIO (Which is probably recommended...) should be used instead.

https://github.com/microsoft/diskspd/actions

https://github.com/microsoft/diskspd-for-linux

https://github.com/axboe/fio

Here's some HOWTO guides on using both DiskSDP and FIO. Windows, Linux, and MacOS X accordingly.

https://learn.microsoft.com/en-us/azure/virtual-machines/disks-benchmarks

https://docs.oracle.com/en-us/iaas/Content/Block/References/samplefiocommandslinux.htm

https://www.nivas.hr/blog/2017/09/19/measuring-disk-io-performance-macos/

1

I have yet to find an equivalent for hdparm on macOS.

Someone mentioned using dd to get at least a basic idea with a command that is available, which is a little bit helpful. They admitted to not knowing the macOS command line, so here is a Mac specific version:

dd if=/dev/disk0s1 of=/dev/zero bs=4096 count=10240

This will report a very basic bytes per second.

1

Some tools I use:

I'm sure there are others I"m not thinking of at the moment. My current favorite is probably DIskfire. I would also check out the Xsanity forums, because they're experts at OS X disk performance, especially in Xsan.

churnd
  • 4,237
0

(bear in mind I never used Mac CLI so there can be little differences from what I write)

you could try dd:

dd if=/dev/sda of=/dev/zero bs=4096 count=10240 iflag=direct

This will copy 40MiB of data from the beginning of the drive and show you the average speed.

Alicja Kario
  • 6,449